How do I smooth the edges of shadows? [Fixed]


I’ve set up directional light shadow renderers and filters as follows:

    final int SHADOWMAP_SIZE=1024;
    DirectionalLightShadowRenderer dlsr = new DirectionalLightShadowRenderer(assetManager, SHADOWMAP_SIZE, 3);

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

As you can see I’ve tried playing with the EdgeFilteringMode on both filter and renderer (I’ve also tried setEdgesThickness, but that also seems to do nothing) but no matter what combinations I’ve tried so far the result still looks as follows:


I don’t need/want “hard” shadows, so I’d be completely happy to have some sort of blurring or softening of the shadow - but what I don’t want are the current “jagged” lines. Is there any setting that will reduce the harshness of these shadow edges?


Hold on, are you using both the renderer and filter together? They’re supposed to be either/or. Also Bilinear is bound to be one of the less impressive filtering modes. What did PCF8 and Poisson look like for you?

The documentation here:

Seems to say I should be adding both and if I only add DirectionalLightShadowRenderer I get no shadows…although DirectionalLightShadowFilter does seem to work by itself so that’s confusing.

I had tried all the various render modes, but with both renderer and filter active. Removing the renderer and setting the filter to DCFPoison seems to have improved things a lot thanks.


It’s either renderer or filter. the renderer does an additional geometry pass to render shadows, the filter does not, so it’s faster when you have complex scenes, however it ignores the shadowMode sets on the spatials and render shadow over everything that writes depth.

The documentation here:

Literally says the exact opposite…

if you use shadow rendering, you won’t need a shadow filter and vice versa

My guess would be that you have everything (or some high parent node) set to ShadowMode.Off or something so the DLSR does nothing and the filter does what you can see.

I was literally just playing with this yesterday so I know it works.

Here is the directional light shadow filter with an edge thickness of 10 or 15 (I can’t remember) and PCFPOISON edge filtering:

Soft edges: (see left)

Turning all of that off, hard edges:

I was trying to get rid of the artifacts on vertical surfaces so these pics are not the best for illustrating soft edges but you can still see them.

Edit: and BTW, I have to say that PBR is super fun.

1 Like

Ok, I see that now. It wasn’t clear to me when I first read it though and the code sample just presented one big block adding both - not saying that you should choose one or the other.