Customizing stereoscopic rendering

You can customize the stereoscopy composition to get the rendering result you need:

Rendering to a render target texture

The Stereoscopic Composer Render Pass renders to framebuffer object targets that Kanzi automatically creates and makes available only to that render pass. When you render to a Render Target Texture you can control the lifetime and properties, such as size, of the texture. For example, you can do supersampling or subsampling by setting the size of the render targets, allow multiple render passes to use the same render target, or create your own composition or additional visualization for each eye.

To render to a render target texture:

  1. Take Kanzi Stereoscopy into use in your Kanzi Studio project. See Setting up your Kanzi Studio project.

  2. In the Library press Alt and right-click Materials and Textures, select Render Target Texture, and name it Left.

    _images/create-rtt.png _images/left-render-target-texture.png
  3. In the Properties set:

    • Width and Height to the size that you want to use for the texture

    • Support Simple RenderTarget to enabled

    • Other texture properties that you want to apply to the texture

    _images/left-render-target-texture-properties.png
  4. In the Library duplicate the Left render target texture and rename the new render target texture to Right.

    _images/duplicate-left-rtt.png _images/right-render-target-texture.png
  5. In the Library > Rendering > Render Pass Prefabs select the Stereoscopic Composer Render Pass that you use to stereoscopically render the content in your project and in the Properties add and set:

    • Stereoscopy Mode to Material Composition: Full Resolution

    • Composition Material to one of the materials provided by the Stereoscopy Materials asset package

    • Left Eye Composition Target to the Left render target texture

    • Right Eye Composition Target to the Right render target texture

    • (Optional) Perform Blit In Composition Material Mode to disabled

      Disable this property when using one of the material composition stereoscopy modes and when you want to draw the result of the Stereoscopic Composer Render Pass using another render pass and do not want the Stereoscopic Composer Render Pass to draw the composed result.

    • (Optional) Aspect Ratio Multiplier to the value by which you want to multiply the aspect ratio of the content that you render stereoscopically

      For example, if the aspect ratio of the Viewport 2D node whose content you want to render is 2:1 but you created square-shaped render target textures, set Aspect Ratio Multiplier to 1.5.

    _images/stereo-composer-render-pass-rtt-properties.png

Inverting interlacing

When the display of your device uses interlacing to achieve a 3D effect, the Stereoscopic Composer Render Pass composes the content for the position of each eye using alternating horizontal or vertical lines. If the depth of the content appears inverted, to correctly render the content use:

  • InterlaceHorizontalRightFirstMaterial for displays that show content from the position of each eye using alternating horizontal lines.

  • InterlaceVerticalRightFirstMaterial for displays that show content from the position of each eye using alternating vertical lines.

To invert interlacing:

  1. Take Kanzi Stereoscopy into use in your Kanzi Studio project. See Setting up your Kanzi Studio project.

  2. Create the render passes that you need to render 3D content stereoscopically using a composition material. See Rendering 3D content stereoscopically with a composition material.

  3. In the Library > Rendering select the Stereoscopic Composer Render Pass that you use to stereoscopically render the content in your project and in the Properties set the Composition Material property to:

    • InterlaceHorizontalRightFirstMaterial for displays that show content from the position of each eye using alternating horizontal lines.

    • InterlaceVerticalRightFirstMaterial for displays that show content from the position of each eye using alternating vertical lines.

    For example, set the Composition Material property to InterlaceHorizontalRightFirstMaterial.

    _images/stereo-composer-render-pass-invertedmaterial.png

Applying anti-aliasing

You can use multisampling (MSAA) to reduce aliasing in the content that you render stereoscopically with a composition material.

To apply anti-aliasing:

  1. Take Kanzi Stereoscopy into use in your Kanzi Studio project. See Setting up your Kanzi Studio project.

  2. Render 3D content stereoscopically using a composition material. See Rendering 3D content stereoscopically with a composition material.

  3. In the Library > Rendering > Render Pass Prefabs select the Stereoscopic Composer Render Pass that you use to stereoscopically render the content in your project, in the Properties add the Stereoscopic Composer Render Pass > Multisample Level property, and set it to the number of anti-aliasing samples that you want to use.

    For example, set Multisample Level to 4.

    See the documentation of the device on which you want to run your Kanzi application for supported values, because the number of anti-aliasing samples depends on the device. If you set the Multisample Level property to a value which your device does not support, Kanzi clamps the value to the largest value supported by the device driver.

    _images/multisample-level.png