My Shadows are not quite right... Is there a good resource for me to learn how to do them right?

I really don’t know what I’m doing…

I followed the lighting documentation and read a few threads and I do have shadows “working”, but for this simple icosphere (and other models) I’m getting some odd lighting.

Here is my code for my lighting:

DirectionalLight sun = new DirectionalLight();
sun.setDirection(new Vector3f(.7f, -0.5f, 0.05f));

AmbientLight al = new AmbientLight();

final int SHADOWMAP_SIZE = 4096;
final int nbSplits = 4;

DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, nbSplits);

DirectionalLightShadowFilter dlsf = new DirectionalLightShadowFilter(assetManager, SHADOWMAP_SIZE, nbSplits);
FilterPostProcessor fpp = new FilterPostProcessor(assetManager);

And here’s my code for setting up my geometry before adding it to the scene:

geom = assetManager.loadModel("assets/Models/treething/testthing.scene");
Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
mat.setBoolean("UseVertexColor", true);
mat.setBoolean("UseMaterialColors", true);
mat.setColor("Ambient", color);
mat.setColor("Diffuse", color);
mat.setColor("Diffuse", ColorRGBA.White);
mat.setColor("Specular", color);
mat.setBoolean("VertexLighting", true);

I don’t think it being a part of a scene has much to do with my problem because I get strange lighting like this if I just load .mesh.xml models as well.

I’m sure there’s just something that I’m doing wrong, and that something could be easily fixed if I knew what I was doing. While an immediate solution to this problem would be greatly appreciated, I’d also like to be more independent instead of having to depend on the forums for simple things like this.

Thank you!

You are supposed to have either dlsr or dlsf, but not both. Personally I’d recommend using dlsr over dlsf.

1 Like

Thank you! That solved my issue.

The dlsr looks great! If I just have the dlsf, it looks like the pic above. Will I have any need for the dlsf, or is the dlsr simply superior?

The Filter is faster I guess:
Reederer is run per vertex where as the Filter is run per screen pixel

#dlsrmasterrace :stuck_out_tongue: