Ambient light not working with custom mesh. Directional light works

I made a custom mesh programmatically. Colored the vertices, added normals, and tested with Directional light. Works great, awesome.

Then I tried adding an ambient light to the scene as well, but did not see a difference.
AmbientLight al = new AmbientLight();

I took out the directional light and the entire scene is black.
Am I missing something?

How is your material defined?

Material mat = new Material(assetManager, “Common/MatDefs/Light/Lighting.j3md”);

    mat.setBoolean("UseVertexColor", true);
    mat.setBoolean("VertexLighting", true);
    mat.setColor("Diffuse",ColorRGBA.White);  // minimum material color
    mat.setColor("Specular",ColorRGBA.White); // for shininess
    mat.setFloat("Shininess", 50f); // [1,128] for shininess


1 Like

So… you’ve told it to use material colors but you’ve left Ambient set to “black”. Probably not a coincidence that ambient has no effect.

1 Like

Ah, oops. Didn’t realize default was black. Mucho thanks speederino.