[SOLVED] Some basic lighting issues

I’m attempting to procedurally generate asteroids along with their textures etc.

I just got the shape to work buuuuuuuut I can’t seem to get it to have a light and dark side with directional lighting.

    DirectionalLight sun = new DirectionalLight();
    sun.setColor(ColorRGBA.White);
    sun.setDirection(new Vector3f(-.5f,-.5f,-.5f).normalizeLocal());
    rootNode.addLight(sun);
    AsteroidGeo asGeo = new AsteroidGeo(3, 12);
    Geometry geom = new Geometry("Asteroid", asGeo);
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
    geom.setMaterial(mat);
    geom.setShadowMode(ShadowMode.CastAndReceive);
    rootNode.attachChild(geom);

All that it shows is the geometry but lit as if I was using unshaded.

Any ideas?

Sounds like you don’t have normals in your mesh.

When answering the question “is this point facing the light and by how much”… the shader will certainly need to know what direction things are facing: ie: normals

2 Likes

Argh. I shoulda known that. Thanks!

1 Like