Directional Light Shadow problems

I’m using a directional light shadow renderer and filter. I wanted to show you the difference between the two so you can the output yourself.

directional light shadow filter

directional light shadow renderer

Same thing but with a more complex object this time a tree.

directional light shadow filter

directional light shadow renderer

As you can see the shadow filter is off on the edges and doesn’t shade the entire area it should. Notice the ground by the grave markers only has half a shadow. On the other hand the shadow rendered shades the edges properly but it misses large portions of the volume on more complex objects. The renderer also scatters the shadows improperly on complex objects.

I tried combing the two but the filters conflict with each other make the shadows look worse. I tried removing all other filters and testing each one at a time but it still does the same thing.

Is there a work around for this so I can get proper edge shading and volume ?

Mhh idk if it may be related, but your shadows look quite squared in both cases… which settings are you using?

That is my default test settings. Only 1 pass and 1024 map. I’ve testing it using multiple passes , higher map sizes and different edge filtering. That doesn’t solve any of the problems other that giving the shadows straighter edges.

Looks like the shadow cam is too far away from the main surface. I don’t remember anything about directional light’s shadows, but at this level none of the edge smoothing algorithm would help. There is some shadow’s z-fighting on the bottom of the mountains, it can be corrected by tuning Polyoffset values in the material definition.
Increasing shadowmaps resolutions should at least decrease pixelization in shadows.

mhhh. To me it’s the polygon ofset used to render the shadow maps…
But that’s weird you have different behavior from the filter and the renderer on this particular aspect…
Could you post the code please?
Also yeah… one 1024 map for such a wide area seems very very small.

DLshadowRender = new DirectionalLightShadowRenderer(gameManager.app.getAssetManager(), control.getShadowMapSize(),control.getShadowSplits());
        DLshadowFilter = new DirectionalLightShadowFilter(gameManager.app.getAssetManager(), control.getShadowMapSize(), control.getShadowSplits());
        
        DLshadowRender.setLight(sun);
        DLshadowRender.setEdgeFilteringMode(control.getEdgeFilteringMode());
        DLshadowRender.setShadowIntensity(control.getShadowIntensity());
        gameManager.app.getViewPort().addProcessor(DLshadowRender);
        
        DLshadowFilter.setLight(sun);
        DLshadowFilter.setEdgeFilteringMode(control.getEdgeFilteringMode());
        DLshadowFilter.setShadowIntensity(control.getShadowIntensity());

The map size is 1024 and 1 pass by default. Edge filtering nearest and shadow density 0.7f.

I’m not sure if this has anything to do with it but I have adjust the camera frustum a bit.

app.getCamera().setFrustumPerspective(45f, (float) app.getCamera().getWidth() / app.getCamera().getHeight(), 0.01f, 1000f);

You don’t add both of them right? Because you have to use only one of them.

Also read this Learning to Love your Z-buffer.
and discover why 0.01 near and 1000 far ar every very bad values for the frustum.

No , I only use one at a time. I keep them both set up so I can switch between the two for testing.