Layering component

Layers allow to explicitly define the rendering order of items (independently of what is closer, what is further from the camera).

See also X3D specification of the Layering component.

Contents:

1. Supported nodes

For now, we have a really basic support for the nodes in this X3D component.

  • Our LayerSet just enumerates all the layers mentioned in LayerSet.order.

  • Our Layer, if it is visible (Layer.visible), just enumerates all its children.

This means that contents of your layers will render — but mostly as if they were part of the normal scene graph. The layering order specified by LayerSet.order is not yet enforced during rendering.

Support us to improve this! Various ways to help are welcome, in particular donations so that we can spend time on this feature.

2. TODO

Important features are missing to call it "real support":

  • We don't yet actually render things following the layers order. Everyting is rendered with the Z-buffer "on" and undefined order, so things are visible in the order "what is closer to the camera".

    Note: Castle Game Engine has ways to do this, even 2. But they are "above" X3D rendering logic.

    1. TCastleTransform.RenderLayer (limited but trivial to use)
    2. Multiple TCastleViewport with the same size, but different items to render, and transparent background (TCastleViewport.Transparent).

  • Our treatment of Layer.visible is really simplistic: we completely exclude invisible layers from enumeration, so they will not even collide.

  • Toggling the fields, like Layer.visible, at run-time is expensive. This is in contrast to our super-optimized

    • Switch.whichChoice
    • and X3DGroupingNode.visible