Shadow ignors DistanceCulling

I have placed two scenes. One with DistanceCulling = 0 and one with DistanceCulling = 100.
When the DistanceCulling starts, the scene (left house) becomes invisible, but the shadow is still visible.

Maybe a bug?


Fixed, thank you for reporting!

I have already committed the fix, Do not render shadows for objects eliminated by DistanceCulling · castle-engine/[email protected] · GitHub . It will be available in binary CGE downloads ( Download | Castle Game Engine ) in ~6 hours, once Jenkins builds new CGE.

Indeed, we should not render shadows for invisible objects.

  • Not only it looks a bit weird…

  • … but in case of shadow volumes it is actually a bug: the calculation of shadow volumes assumes that shadow caster is really rendered, otherwise weird things may be visible.

I tested on a quickly hacked version of “3D FPS game” template, here are screenshots before and after.

Note: The “shadow maps” algorithm, that I will want to expose in the future, will actually enable to render shadows for invisible objects. We can have it as an option then (but still, by default off, so we will not render shadows from invisible objects).