Shadow volumes: new WholeSceneManifold option, fixes and docs

Posted on

Shadows in editor
Shadow volumes
WholeSceneManifold demo in editor
WholeSceneManifold demo
Select Non-Manifold in Blender
  1. A new feature of our shadow volumes is that you can turn on TCastleRenderOptions.WholeSceneManifold to say that the whole scene must be a closed volume (2-manifold), not necessarily each shape.

    This makes especially sense if your model is, as far as geometry in a 3D authoring tool like Blender is concerned, a single mesh but with different materials. For glTF and X3D (and finally GPU), such mesh must be split into multiple shapes. The whole scene may be thus a closed volume (2-manifold) even if each shape is not.

    The details of when you may want to use this are described in our documentation and example examples/viewport_and_scenes/shadow_volumes_whole_scene_manifold.

  2. An important fix was done to our algorithm that culls shadow casters in case shadow volumes are cast by directional lights. Previously sometimes the shadows could disappear when the shadow caster was not visible — causing funny artifacts (shadows unexpectedly disappearing) in certain views. This is fixed now.

  3. Interaction of frustum culling (TCastleScene.SceneFrustumCulling, TCastleScene.ShapeFrustumCulling), distance culling (TCastleScene.DistanceCulling) and shadow volumes is now simpler and more reliable. If we render shadow quads for something, then we have to also render the shadow caster.

  4. As part of this work, we’ve also removed long deprecated properties TCastleScene.FrustumCulling and TCastleScene.OctreeFrustumCulling. They allowed to configure details… they weren’t really ever useful to configure, in my experience. We recommend to use instead a simpler boolean TCastleScene.ShapeFrustumCulling for a long time now, and even this is usually something you don’t really need to care about. As always, make a noise on our forum or Discord if this change affects your project in any way. From my experience, all usage of these old properties can be just removed — tweaking them most likely didn’t have any effect on the performance anyway.

    Removing these old things allowed to make this code simpler, for shadow volumes fixes described above, and also for upcoming rework how shapes are rendered.

  5. Finally, our shadow volumes documentation was much improved.

    The details about X3D nodes and fields have been moved to a section at the bottom, as likely not relevant for most CGE users. The information how to use it all using Pascal and CGE editor is now prominent.

Start the discussion at Castle Game Engine Forum