Using lights in rendering¶
Use the Gather Lights Render Pass to collect from a list of nodes the light nodes for lighting 3D nodes in a scene.
Collecting lights¶
The Gather Lights Render Pass collects light nodes for lighting 3D nodes in a scene.
By default a Gather Lights Render Pass collects either all the light nodes in a scene or the light nodes provided by its nearest ascendant Node List Render Pass.
You can use any Node List Render Pass in the same Render Pass Prefab to provide light nodes to a Gather Lights Render Pass. To learn how to use filters to pass nodes to render passes, see Filters.
To set the Node List Render Pass that you want to use to collect lights:
In the Library > Rendering > Render Pass Prefabs select the Gather Lights Render Pass that you want to use to collect light nodes.
In the Properties click + Add Binding, and in the Binding Editor set:
Property to Node List
Expression to the Output Node List property of the Node List Render Pass
For example, to collect the light nodes provided by a sibling Node List Render Pass of the Gather Lights Render Pass, set the Expression to:
{@../Node List Render Pass/NodeListRenderPass.OutputNodeList}
Click Save.
Render 3D content using the light nodes that you collected. See Lighting 3D nodes.
Lighting 3D nodes¶
Use the Draw Objects Render Pass and Draw Objects With Material Render Pass render passes to draw 3D nodes. Kanzi by default lights the 3D nodes drawn by a Draw Objects Render Pass or Draw Objects With Material Render Pass using the light nodes provided by the nearest ascendant Gather Lights Render Pass.
The Gather Lights Render Pass has output properties that each contain the set of lights of specific type collected by that Gather Lights Render Pass. You can manually set a Draw Objects Render Pass or Draw Objects With Material Render Pass to use the lights provided by any Gather Lights Render Pass in the same render pass prefab.
To set the Gather Lights Render Pass whose output lights you want to use to light 3D nodes:
In the Library > Rendering > Render Pass Prefabs select the Draw Objects Render Pass or Draw Objects With Material Render Pass that you use to draw 3D content.
In the Properties click + Add Binding, and in the Binding Editor set:
Property to the type of lights that you want to use:
Directional Lights for Directional Light nodes
Point Lights for Point Light nodes
Spot Lights for Spot Light nodes
Expression to the output lights property of the Gather Lights Render Pass that you want to use:
Output Directional Lights for Directional Light nodes
Output Point Lights for Point Light nodes
Output Spot Lights for Spot Light nodes
For example, to use the Directional Light nodes of the sibling Gather Lights Render Pass of the render pass to which you add the binding, set:
Property to Directional Lights
Expression to
{@../Gather Lights Render Pass/GatherLightsRenderPass.OutputDirectionalLights}
Click Save.
Repeat the previous step to add bindings for the other types of light nodes that you want to use.
Take the render passes into use:
In the Node Tree select the Viewport 2D node that contains the 3D content that you want to render.
In the Properties set the Render Pass Prefab property to the render pass prefab that contains the Gather Lights Render Pass that you use to collect the light nodes and the Draw Objects Render Pass or Draw Objects With Material Render Pass that draws the 3D content.