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.

    See Using the Default Render Pass.

    ../../_images/default-render-pass.svg
  • Render to Texture Pass contains the render passes that enable you to render to a texture. See Rendering to texture.

    ../../_images/render-to-texture-pass.svg
  • 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.

    See Rendering content to composition targets

    ../../_images/compose-and-blit-pass.svg

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:

  1. In the Library > Rendering press Alt and right-click Render Pass Prefabs and select Default Render Pass.

    ../../_images/create-default-render-pass.png

    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.

      ../../_images/opaque-and-transparent-filters-in-library.png ../../_images/opaque-filter-in-library.png ../../_images/transparent-filter-in-library.png
    • 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.

      ../../_images/default-render-pass.png ../../_images/clear-render-pass-default-properties.png ../../_images/draw-objects-opaque-properties.png ../../_images/draw-objects-transparent-properties.png
  2. 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.

    ../../_images/scene-render-pass-set-to-default-render-pass.png
  3. (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.

    ../../_images/add-transparent-tag.png
  4. (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.

    ../../_images/clear-render-pass-with-clear-color-set.png

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:

  1. In the Library > Rendering press Alt and right-click Render Pass Prefabs and select Render to Texture Pass.

    ../../_images/create-render-to-texture-pass.png

    Kanzi Studio creates in the Library:

    • In Materials and Textures > Textures a Render Target Texture

      ../../_images/render-target-texture-in-library.png
    • 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.

    ../../_images/render-to-texture-pass1.png ../../_images/render-to-texture-pass-properties.png ../../_images/clear-render-pass-properties1.png ../../_images/draw-objects-properties.png
  2. 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.

    ../../_images/scene-render-pass-set-to-render-to-texture-pass1.png
  3. 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:

    1. In the Node Tree, press Alt and right-click and select Image.

    2. In the Node Tree, select the Image node. In the Properties, set the Image property to the Render Target Texture that you want to show in the Image node.

      ../../_images/render-target-texture-in-image.png