SubRenderPass QML Type | Qt Quick 3D | Qt 6.11.1
Description: Renders a sub-section of work within the same render target as the parent RenderPass.

- Qt 6.11
- Qt Quick 3D
- QML Types
- SubRenderPass
- Qt Quick 3D | Commercial or GPLv3

# SubRenderPass QML Type

Renders a sub-section of work within the same render target as the parent RenderPass. More...

Import Statement: | `import QtQuick3D`
Since: | Qt 6.11
Inherits: | Command

- List of all members, including inherited members

## Properties

- renderPass : RenderPass

## Detailed Description

SubRenderPass is a Command that subdivides a RenderPass into smaller, independently configured pieces while sharing the same render target. Only the parent RenderPass controls which textures are rendered into (via ColorAttachment and DepthTextureAttachment) and when the pass begins (and therefore when the render target is cleared). A SubRenderPass cannot set its own render target or clear settings — those are always inherited from the parent pass.

What a SubRenderPass can control is what gets rendered and how: it has its own commands, so it can carry a RenderablesFilter to select a subset of objects, a PipelineStateOverride to change depth/blend state, a different materialMode, and so on.

A typical use is a forward-rendering pipeline where a single color pass uses separate SubRenderPasses for the background, opaque objects, and transparent objects. All three sub-passes write into the same color and depth textures, but each has different pipeline state:

     RenderPass {
         id: mainColorPass
         commands: [
             // Render targets are set at the parent RenderPass level only
             ColorAttachment { name: "color0"; target: colorTexture },
             DepthTextureAttachment { target: depthTexture },

             // Sub-pass 1: render the skybox background
             SubRenderPass { renderPass: skyboxSubPass },

             // Sub-pass 2: opaque objects with depth testing and writing
             SubRenderPass { renderPass: opaqueSubPass },

             // Sub-pass 3: transparent objects with blending, no depth write
             SubRenderPass { renderPass: transparentSubPass }
         ]
     }

     // Sub-passes share mainColorPass's render target
     RenderPass {
         id: skyboxSubPass
         passMode: RenderPass.SkyboxPass
     }

     RenderPass {
         id: opaqueSubPass
         commands: [
             RenderablesFilter { renderableTypes: RenderablesFilter.Opaque }
         ]
     }

     RenderPass {
         id: transparentSubPass
         commands: [
             RenderablesFilter { renderableTypes: RenderablesFilter.Transparent },
             PipelineStateOverride {
                 blendEnabled: true
                 depthWriteEnabled: false
             }
         ]
     }

See also RenderPass, RenderablesFilter, and PipelineStateOverride.

## Property Documentation

### renderPass : RenderPass

The RenderPass that will be executed as a sub-pass when this command is processed.