Difference between Shadow renderer and shadow filter?

The ShadowRenderer is the first one that has been implemented.
It works this way :
Pre pass : render the scene from the light pint of view to compute the shadow maps (depth maps, I encourage you to read on shadow mapping if you want to know the details)
Post pass : the actual rendering fo the shadows over the rendered scene : To render the shadows it does an additional geometry pass and renders the geometries with a forced shadow material.

If you have a big scene with several hundred geoms it’s gonna be slow because of all the additional draw call issued by the post pass.

That’s where the ShadowFilter is better.
Instead of doing an additional geometry pass, the shadow filter renders the shadows in screen space (in a filter), by reconstructing the geometries position from the depth buffer (some math tricks). this way it doesn’t matter how much geometries you have on screen, it will always render at the same speed. And that’s usually faster than the shadowRenderer.

It has some draw backs though :

  • The shadow mode hint “receive” is ignored by the filter. All objects that write depth are considered receiving geometries.
  • If you have less than around 25 geoms it might be slower than the Renderer.

About your issue, do you have some shader compilation error? or is it just not rendering the shadows?
Could you test the example projects test case (TestDirectionalShadows for example)

3 Likes