[Solved] Varying transparency

i want varying transparency effect, like stealth units in CnC generals.
so far it looks like i’m going to have to fiddle with shaders again, is there really no implementation for this or am i not able to find it?

You can set a color to your model’s material, with an alpha value below 1.
For it to render properly, you have to put the model in the transparent bucket and set the blend mode to alpha.

model.getMaterial().setColor("Diffuse", new ColorRGBA(1,1,1,0.5f));// half transparent white
model.getMaterial().setColor("UseMaterialColors", true);// if you want the diffuse to be taken into account.
model.getMaterial().getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
model.setQueueBucket(RenderQueue.Transparent);

You may also have to set a non black ambient color.
This is from memory, there might be some typo, but the logic is that.

1 Like

model.getMaterial().setBoolean(“UseMaterialColors”, true); <-this helped