Render layers can be used to group render components and configure the order in which they should be rendered. nap::RenderLayer
objects are ordered in a nap::RenderChain
under the property Layers
. The index of the layer in this list determines the rank of the nap::RenderLayer
where 0 is the front, and the last index is the back. Render components without a layer assigned default to the front (index 0).
One useful approach for layers is when rendering a sky box or some other object that fills the background. This should always be rendered first, regardless of the transform it has. To do this, you add a layer named "Background" to the nap::RenderChain
and assign it to the background render component. Other objects in the scene can be assigned to the layer "Default" (on index 0) and will be sorted routinely based on the specified sorting algorithm.