Creating clouds for planet (transparency+lighting)

Hey,



I am trying to get my clouds working for my planet.

When I try

[java]

Material cloudMat = new Material(assetManager,

“Common/MatDefs/Misc/SimpleTextured.j3md”);

[/java]

It works fine except that it doesn’t react to lighting. The problem is that while my planet one side is dark, clouds are still visible.



But when I use:

[java]

Material cloudMat = new Material(assetManager,

“Common/MatDefs/Light/Lighting.j3md”);

Texture clouds = assetManager.loadTexture(“Textures/Maps/clouds.png”);

cloudMat.setTexture(“m_DiffuseMap”, clouds);

cloudMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

[/java]

Then my cloudsphere is just white, no clouds, no planet visible.



So my question is, how to use transparency + lighting, or how do I correctly setup my material so I could see clouds with Lighting.j3md? :slight_smile:

[java]

Material cloudMat = new Material(assetManager,

"Common/MatDefs/Light/Lighting.j3md");

Texture clouds = assetManager.loadTexture("Textures/Maps/clouds.png");

cloudMat.setTexture("m_DiffuseMap", clouds);

cloudMat.setBoolean("m_UseAlpha", true);

cloudMat.setBoolean("m_UseMaterialColors", true);

cloudMat.setColor("m_Ambient", ColorRGBA.Black);

cloudMat.setColor("m_Diffuse", ColorRGBA.White);

cloudMat.setColor("m_Specular", ColorRGBA.White);

cloudMat.setFloat("m_Shininess", 2);

cloudMat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);

cloudSphereG.setQueueBucket(Bucket.Transparent);

[/java]





This works thanks :slight_smile: