Actually you don’t need to do that, there’s a built-in way to do it.
Once you load the model, you need to go through each geometry and modify its material to change the color/alpha:
[java]Geometry geom = …
Material material = geom.getMaterial();[/java]
Then set the m_UseAlpha parameter to true, this will use the alpha from the diffuse color as the model’s alpha. Set the m_Diffuse parameter to modify both the color and alpha of the model:
[java]material.setBoolean(“m_UseAlpha”, true); // use alpha from diffuse color
material.setColor(“m_Diffuse”, … ); // specify diffuse color[/java]
You also need to enable alpha blending and put the model in the appropriate render queue to indicate it is transparent:
[java]
material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); // enables alpha blending mode
geom.setQueueBucket(Bucket.Transparent); // enables back-to-front sorting
[/java]