Using render passes

Use render passes to define the rendering of 3D content in your Kanzi application.

For example, in render passes you can define:

To achieve a specific rendering result, create a hierarchy of render passes which together form a render pass prefab. In a Viewport 2D node the Render Pass Prefab property sets which render passes Kanzi uses to render the 3D content of that node. See Creating and using render passes.

You can reuse render passes in your Kanzi Studio project in these ways:

Learn how to use render passes by completing these tutorials:

Creating and using render passes

To create and use render passes:

  1. In the Library > Rendering > Render Pass Prefabs press Alt and right-click and select the render pass that you want to use as the root render pass of your render pass tree. See Render passes.

    In the Library > Rendering > Render Pass Prefabs each top-level render pass is the root of a render pass prefab.

    In a render pass prefab, you can create a hierarchy of render passes to achieve a specific rendering result.

    For example, create a Group Render Pass.

    Group Render Pass allows you to collect render passes so that you can refer to a single render pass prefab in your Viewport 2D node.

    ../../_images/create-group-render-pass4.png
  2. In the Node Tree select the Viewport 2D node that contains the 3D content that you want to render and in the Properties set the Render Pass Prefab property to the render pass that you created.

    When you set a Viewport 2D node to use a specific render pass, Kanzi instantiates in the Viewport 2D node the render pass tree defined by that render pass. Kanzi now renders the content of the Viewport 2D node using the render pass that you created.

    ../../_images/viewport-2d-in-the-project2.png ../../_images/render-pass-prefab-set-to-group-render-pass2.png
  3. In the render pass that you created, create the hierarchy of render passes that you need to render your 3D content.

    For example:

Customizing instances of render passes

A render pass can contain a hierarchy of render passes, each with their own properties. When you edit the render passes, you change how those render passes render content in all Viewport 2D nodes that use them. You can customize individual instances of a render passes to have individual values by overriding the values in the default render pass. For example, when you create a hierarchy of render passes that blits a composition target to the screen, you can blit the content using a different material in different instances of the render passes.

To customize instances of render passes:

  1. In the Library > Rendering > Render Pass Prefabs select the render pass that you want to customize.

    For example, to customize the material that you use to blit a composition target to the screen, in a Compose and Blit Pass render pass prefab, which renders content to a composition target and blits the result to the screen, select the Blit Render Pass. See Rendering content to composition targets.

    ../../_images/blit-render-pass-in-render-target-tree1.png
  2. In the Properties, next to the property that you want to customize, click enable-editing.

    Kanzi Studio creates from that property a custom property, adds it to the root of the render pass prefab, and creates a ##Template binding to the property in the render pass prefab root. See Prefab root bindings.

    For example, to customize the material which you use to blit the composition target to the screen, click enable-editing next to the Material property. Kanzi Studio adds the Material property to the Compose and Blit Pass render pass prefab and creates in the Blit Render Pass a ##Template binding to the Material property in that Compose and Blit Pass.

    ../../_images/publish-material-property1.png ../../_images/template-binding-to-blit-material2.png
  3. In the Node Tree or Prefabs select a Viewport 2D node and in the Properties set the Render Pass Prefab property to the render pass prefab that you customized.

    When you set a Viewport 2D node or prefab to use a render pass prefab, Kanzi Studio shows in that Viewport 2D node the properties of that render pass prefab as frequently used properties.

    ../../_images/viewport-2d-in-the-project2.png ../../_images/render-pass-prefab-set-to-compose-and-blit-pass2.png
  4. In the Properties click add-property next to the property that you customized and set the value of the property.

    Kanzi Studio adds to the Viewport 2D node a To Source binding which pushes the value of that property to the render pass prefab instance made available through the Viewport2D::RenderPassProperty property of the Viewport 2D node.

    You can set multiple Viewport 2D nodes to use the same render pass prefab and in each Viewport 2D node you can add and set the render pass prefab property to have different values.

    ../../_images/group-render-pass-material-frequently-used1.png ../../_images/tosource-binding-to-material1.png

Reusing render passes

You can reuse render passes in another render pass tree. In each instance of a render pass prefab you can set the property values of render passes in that render pass prefab. For example, reuse multiple instances of a render pass prefab to create render pass chains to achieve post-processing effects. See Tutorial: Create a bloom effect.

To reuse render passes:

  1. In the Library > Rendering > Render Pass Prefabs press Alt and right-click the render pass where you want to instantiate a render pass prefab and select Render Pass View.

    ../../_images/create-render-pass-view.png
  2. In the Properties add the Render Pass Prefab property and set it to the render pass prefab that you want to instantiate.

    Kanzi Studio shows in the Render Pass View all properties of the render pass prefab that the Render Pass View instantiates. See Customizing instances of render passes.

    ../../_images/render-pass-view-add-render-pass-prefab-property.png ../../_images/render-pass-view-properties.png

Tip

You can instantiate a render pass prefab by dragging it to a render pass or another render pass prefab.

Reusing render passes by merging

You can reuse render passes from another Kanzi Studio project by merging the render passes to the project in which you want to use them.

To reuse render passes by merging:

  1. In the project where you want to use render passes from another project, select File > Import > Merge Project, select the Kanzi Studio project which contains the render passes that you want to merge, and click Open.

    ../../_images/merge-project-menu-option1.png
  2. In the Project Merge dialog:

    1. At the bottom left of the dialog enable Select referenced items.

      You set Kanzi Studio to automatically select all items to which the render pass prefab, which you want to merge, refers.

    2. In Rendering > Render Pass Prefabs select the render pass prefab which contains the hierarchy of render passes that you want to use.

    Click Merge.

    ../../_images/merge-gaussian-blur.png
  3. In the Node Tree select the Viewport 2D node, which contains the 3D content you want to render using the render passes that you merged, and in the Properties set the Render Pass Prefab property to the render pass prefab that you merged to your project.

    ../../_images/viewport-2d-to-use-gaussian-blur.png

See also

Rendering

Tutorial: Create a bloom effect

Tutorial: Apply a stencil to 3D content

Tutorial: Create reflections

Tutorial: Progressive rendering

Using Kanzi Studio render pass presets

Setting materials for rendering

Creating a post-processing effect

Applying a stencil to 3D content

Using multisampling

Rendering content to composition targets

Bindings

Merging projects