Login  Register

Re: JOGL 2 support for Ardor3D, JMonkeyEngine 3, jzy3d and NiftyGUI

Posted by Andreas on Feb 12, 2016; 2:54pm
URL: https://forum.jogamp.org/JOGL-2-support-for-Ardor3D-JMonkeyEngine-3-jzy3d-and-NiftyGUI-tp1706747p4036196.html

Hi,

I have one question about the transparency of objects. I added a Teapot to a scene and set the transparency by the following code:

        targetMesh.setDefaultColor(new ColorRGBA(0, 1, 0, 0.4f));
        targetMesh.setSolidColor(new ColorRGBA(0, 1, 0, 0.4f));
        // Add a material state
        final MaterialState ms = new MaterialState();
        targetMesh.setRenderState(ms);
        // Pull diffuse color for front from mesh color
        ms.setColorMaterial(MaterialState.ColorMaterial.Diffuse);
        ms.setColorMaterialFace(MaterialState.MaterialFace.FrontAndBack);
        // Set shininess for front and back
        ms.setShininess(MaterialState.MaterialFace.FrontAndBack, 100);

        BlendState blend = new BlendState();
        blend.setBlendEnabled(true);
        targetMesh.setRenderState(blend);

        targetMesh.getSceneHints().setRenderBucketType(RenderBucketType.Transparent);

I'm getting the result shown in the image. I don't understand why one side of the teapot is darker than the other and how to avoid this behaviour.



I hope somebody can give my an advise.

Andreas