MaterialState vs Alphastate

Hi,

here's my question:



If I use AlphaState for the transparency of the objects I've to to turn off the lights.

Btw I need to add lights to my scene…

So I've to use MaterialState(?).



I tried this way:



Sphere s = new Sphere("MySphere", new Vector3f(100, 100, 100), 20, 20, 300f);

Node sphere = new Node("SphereNode");

sphere.attachChild(s);

MaterialState ms = display.getRenderer().createMaterialState();

ms.setAlpha(0.5f);

ms.setEnabled(true);

sphere.setRenderState(ms);



Is it correct?

If yes, why doesn't it work?

If no(and I hope so), what has to be done?



Thank you!  :slight_smile:

You need both an AlphaState and MaterialState to do what you are trying to do.  See TestRenderQueue for an example.

Thank you renanse,

always helpful  :smiley:

I solved doing



myspatial.setLightCombineMode(LightState.OFF);



then applying the AlphaState so the effect of the AlphaState is not erased by the lights of the scene.



Thanks!

Ok, not exactly what you said you wanted earlier, but as long as it gives you the results you like I guess. :slight_smile: