Cant get DLSR's setShadowZFadeLength() to work

Dear jMonkey Pros :slight_smile:

I am trying to set the fade length of a directionalLightShadowRenderer. If I understood it right, this should prevent the abrupt appearing of shadows on approaching objects if the zExtent of the Shadow is set and let the shadow appear gradually on approaching. I am setting my shadow as follows, can you see what my mistake is? Did anyone else ever encounter problems using this method / property?

DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, shadowMapSize, 4);

Any help is much appreciated,


I tried a bit more, and I found, that with my current performance using multiple “nbsplits”, I could simply set the shadow-Distance to the frustum far distance. This kind of solves my problem, but also creates another:

The DirectionalLightShadowRenderer uses “splits” to optimize the performance:
Quote from the Documentation:

It splits the view frustum in several parts and compute a shadow map for each one. splits are distributed so that the closer they are from the camera, the smaller they are to maximize the resolution used of the shadow map.

Now, the borders between these splits are “hard”, which means when moving through a scene, one can see these borders moving along. Is there a way to interpolate between these splits to have smooth transitions between them?



OK indeed shadowsZExtend does not do the smooth transition anymore. I’m gonna look into it.

As your second question it’s a drawback of the PSSM technique that can’t be worked around. No interpolation is possible between splits.
It’s caused by the big difference in rasterized resolution of the shadow maps because the splits doesn’t cover the same surface.
Reducing the first split distance usually does make the issue less obvious.

I’m gonna try to fix the first issue and the second issue should be less noticeable then.

EDIT : I meant shadowZFadeLength

@nehon: Okay, thanks a lot for taking care! I have one more question: You said:

Reducing the first split distance usually does make the issue less obvious.

I did not find any way to reduce the distances of the single splits, how can that be done?



there is a setLambda parameter. the lower the value the shorter are the splits (except the last one).
This may not be intuitive. It is a lot more obvious when you know about PSSM
Lambda is a logarithmic factor that is used to split the frustum.

@nehon said: there is a setLambda parameter

Great! I’ll try that and let you know if it helped. Let me know if you found a fix for the shadowZFadeLength,




the lambda parameter actually did help the problem a bit. So thanks again for the hint. Is there any news / workaround / etc. regarding the shadowZFadeLength functionality?



No sorry I didn’t have time to look into it.
I’ll keep you informed

1 Like

Finally got to work on this, the issue about shadowZFadeLength is solved in last git revision

Great! Very Happy :slight_smile: Thanks a thousand times!