Poor Shadow Quality

For some reason, my shadows look very blocky and the shading appears unnatural. Although they improve somewhat as I increase a value (Commented in code - I assume resolution?), I can go up to 8192 with 4X AA and the results are still substandard. I’m sure I’m doing something wrong. The only way I could get them to work is with this code:



[java]BasicShadowRenderer shadow = new BasicShadowRenderer(assetManager, 1024); //this value

shadow.setDirection(new Vector3f(.5f, -1, .5f));

viewPort.addProcessor(shadow);[/java]







How can I improve the appearance of the shadows?

You can use the PssmShadowRenderer for better results (same usage as the basicShadowRendrer), but be aware that shadow edges will still be a little jagged.



We are thinking of several ways to get smooth shadow edges. It’s in the todo list :smiley:

Thanks! PssmShadowRenderer works much better. What does the second int value do? (int nbSplits)



PssmShadowRenderer shadow = new PssmShadowRenderer(assetManager, int size, int nbSplits);



Is it normal that edge filtering (“EDGE_FILTERING_PCF” additional string parameter) crashes the program?

PSSM stands for Parallel Split Shadow Mapping. It splits the view frustum into several parts (the splits) and apply a shadow map on each part.

The closer the split is from the point of view, the smaller it is, thus giving a better shadow map resolution near the camera and a lesser far from it.

nbSplit is the number of splits, the more splits you have, the better quality, but of course…this come with a fps cost.

You can experiment, but for your scene, 2 or 3 splits can be enough.

Making the ground to only receive shadows can greatly improve the render too, because the map will be projected only on the area of the cube.



the program crash is an issue, i’m gonna check on that thank you.