Using Kanzi Studio render pass presets¶
Use render passes to define the rendering of 3D content in your Kanzi application.
To help you get started, Kanzi Studio comes with these render pass presets:
Default Render Pass contains a basic set of render passes that first render opaque nodes and then transparent nodes.
Render to Texture Pass contains the render passes that enable you to render to a texture. See Rendering to texture.
Compose and Blit Pass contains the render pass structure that enables you to blit to the screen Composition Target Render Pass render passes or textures using a specific material.
Using the Default Render Pass¶
Use the Default Render Pass preset to create a basic set of render passes you need to get started.
To use the Default Render Pass:
In the Library > Rendering press Alt and right-click Render Pass Prefabs and select Default Render Pass.
Kanzi Studio creates in the Library > Rendering the filters and render passes it needs to first render opaque nodes and then transparent nodes:
In Object Sources these Tag Filter filters:
Opaque picks the nodes that do not have the Transparent tag.
Transparent picks the nodes that have the Transparent tag.
In Render Pass Prefabs a Group Render Pass named Default Render Pass and inside it:
Clear Render Pass clears some or all of the buffers of the current render context.
By default the Clear Render Pass in the Default Render Pass clears the depth buffer.
Gather Lights Render Pass collects the Light nodes in the Viewport 2D node that you set to use the Default Render Pass, and passes them to its child Draw Objects Render Pass render passes.
Draw Objects Render Pass named Draw Objects Opaque renders the nodes picked by the Opaque filter.
Draw Objects Render Pass allows you to set a Camera node to render a specific list of nodes, to filter those nodes, and to control frustum culling. Draw Objects Render Pass by default renders nodes using the lights provided by its nearest ancestor Gather Lights Render Pass.
Draw Objects Render Pass named Draw Objects Transparent renders the nodes picked by the Transparent filter.
In the Node Tree select the Viewport 2D node whose content you want to render, and in the Properties set the Render Pass Prefab property to the Default Render Pass you created.
Kanzi Studio renders the Viewport 2D node using the Default Render Pass.
(Optional) If your Viewport 2D node contains transparent nodes, in the Node Tree select the nodes, in the Properties next to the Tags property click the Tags button, and select Transparent.
This way you set the Default Render Pass to first render transparent nodes and then opaque nodes.
(Optional) To set the background of the Viewport 2D node the content of which you want to render, in the Default Render Pass you created select the Clear Render Pass and in the Properties add and set the Clear Color 0 property.
Rendering to texture¶
Use the Render to Texture Pass preset to create the render passes that you need to render content to a texture.
To use the Render to Texture Pass:
In the Library > Rendering press Alt and right-click Render Pass Prefabs and select Render to Texture Pass.
Kanzi Studio creates in the Library:
In Materials and Textures > Textures a Render Target Texture
In Rendering > Render Pass Prefabs a Composition Target Render Pass named Render to Texture Pass, which renders itself to the Render Target Texture resource, and inside it:
Clear Render Pass clears some or all of the buffers of the current render context.
By default the Clear Render Pass in the Render to Texture Pass clears the first color buffer with transparent black color and the depth buffer with value 1.
Gather Lights Render Pass collects the Light nodes in the Viewport 2D node that you set to use the Render to Texture Pass, and passes them to its child Draw Objects Render Pass render pass.
Draw Objects Render Pass named Draw Objects allows you to set a Camera node to render a specific list of nodes, to filter those nodes, and to control frustum culling. Draw Objects Render Pass by default renders nodes using the lights provided by its nearest ancestor Gather Lights Render Pass. By default the Draw Objects Render Pass uses the default Camera node to render all nodes in a Viewport 2D node.
In the Node Tree select the Viewport 2D node whose content you want to render to a texture, and in the Properties set the Render Pass Prefab property to the Render to Texture Pass you created.
Kanzi Studio renders the Viewport 2D node using the Render to Texture Pass.
Apply the Render Target Texture you created in the first step to a node where you want to show the content of the Viewport 2D node that you selected in the previous step.
For example:
In the Node Tree press Alt and right-click and select Image.
In the Node Tree select the Image node, and in the Properties set the Image property to the Render Target Texture you want to show in the Image node.