Custom Pass reference
Custom Pass Volume component properties
Property | Description |
---|---|
Mode | Use the drop-down to select the method that Unity uses to determine whether this Custom Pass Volume can affect a Camera: • Global: The Custom Pass Volume has no boundaries, and it can affect every Camera in the scene. • Local: Allows you to specify boundaries for the Custom Pass Volume so that it only affects Cameras inside the boundaries. To set the boundaries, add a Collider to the Custom Pass Volume's GameObject. |
Injection point | Use the drop-down to define when Unity executes this Custom Pass in the HDRP render loop. For more information about each injection point, see [Injection Points](#Injection Points.md) |
Priority | If you have more than one Custom Pass Volume assigned to the same injection point, use this property to control the order that Unity executes them in. Unity executes these Volumes in order of Priority, starting with 0. |
Fade Radius | Defines when Unity starts to fade in the effect of the Custom Pass as you approach the Volume. A value of 0 means HDRP applies this Volume’s effect immediately at the edge of the Volume. A high value means the effect starts to appear far away from the Volume. This property only appears when Mode is set to Local. |
Custom Passes | Click the Add (+) button to create a Custom Pass. The Custom Pass Volume component includes the following types of Custom Passes by default: • FullScreen Custom Pass: Use this to execute an effect that Unity applies to the Camera view or stores in the Custom Pass buffer. For more information, see Full-screen Custom Pass. • DrawRenderers Custom Pass: Use this to apply a Custom Pass to GameObjects that are in the Camera view. For more information, see Draw renderers custom pass. • ObjectID Custom Pass: Use this to apply a unique color controlled by the Object ID to GameObjects in your scene. For more information, see Object ID Custom Pass. If you create your own Custom Pass, it also appears in this drop-down. For more information, see Scripting your own Custom Pass in C#. If there are one or more Custom Passes in this component, you can click **-** to delete one. |
FullScreenCustomPass properties
Configure a full-screen Custom Pass in the Custom Passes panel using the following properties:
Property | Description |
---|---|
Name | Use this field to name this Custom Pass. Unity uses this name to refer to this Custom Pass Volume in the Profiler. |
Target Color Buffer | Select the buffer that Unity writes the color data to: Camera: Targets the current camera color buffer that renders the Custom Pass. Custom: Uses the Custom Pass Buffer allocated in the HDRP asset. None: Doesn’t write the data to a buffer. You can't write color data to the Camera color buffer if you have Fetch Color Buffer enabled. When the Target Color Buffer and The Target Buffer are both set to None Unity does not execute a Custom Pass because there is no buffer to render to. |
Target Depth Buffer | Select the buffer where Unity writes and tests the depth and stencil data. This buffer does not contain transparent objects that have Depth Write enabled in the shader properties. When the Target Color Buffer and The Target Buffer are both set to None Unity does not execute a Custom Pass because there is no buffer to render to. |
Clear Flags | A clear flag discards the contents of a buffer before Unity executes this Custom Pass. This property assigns a clear flag to one of the following buffers: None: Doesn’t clear any buffers in this pass. Color: Clears the depth buffer. Depth: Clears the depth buffer and the stencil buffer. All: Clears the data in the color, depth, and stencil buffers. |
Fetch Color Buffer | Enable this checkbox to allow this Custom Pass to read data from the color buffer. This applies even when you enable Multisampling anti-aliasing (MSAA). When you enableFetch Color Buffer and MSAA, it forces the color buffer to resolve, and the Custom Pass uses one of the following injection points: Before PreRefraction Before Transparent After Opaque Depth And Normal A Custom Pass can’t read and write to the same render target. This means that you can’t enable Fetch Color Buffer and use Target Color Buffer at the same time. |
FullScreen Material | The material this Custom Pass renders in your scene. |
Pass Name | Select the shader Pass name that Unity uses to draw the full-screen quad. |
Draw renderers Custom Pass properties
Configure a draw renderers Custom Pass in the Custom Passes panel using the following properties:
Property | Description | ||
---|---|---|---|
Name | Assigns a name to this Custom Pass. Unity uses this as the name of the profiling marker for debugging. | ||
Target Color Buffer | Determines the buffer that Unity writes the color data to: •Camera: Targets the current camera color buffer that renders the Custom Pass. •Custom: Uses the Custom Pass buffer allocated in the HDRP Asset. •None: Doesn’t write the data to a buffer. |
||
Target Depth Buffer | The target buffer where Unity writes and tests the depth and stencil data: •Camera: Targets the current camera depth buffer that renders the Custom Pass. •Custom: Uses the Custom Pass buffer allocated in the HDRP Asset. •None: Doesn’t write the data to a buffer. This buffer does not contain transparent objects that have Depth Write enabled in the shader properties. |
||
Clear Flags | Discards the contents of a buffer before Unity executes this Custom Pass. Assign a clear flag to one of the following buffers: •None: Doesn’t clear any buffers in this pass. •Color: Clears the depth buffer. •Depth: Clears the depth buffer and the stencil buffer. •All: Clears the data in the color, depth and stencil buffers. |
||
Filters | Properties in this section determine the GameObjects that Unity renders in this Custom Pass. | ||
Queue | Determines the kind of materials that this Custom Pass renders: •Opaque No Alpha test: Opaque GameObjects without alpha test only. •**Opaque Alpha Test: **Opaque GameObjects with alpha test only. •All Opaque: All opaque GameObjects. •After Post Process Opaque: Opaque GameObjects that use the after post process render pass. •Pre Refraction: Transparent GameObjects that use the the pre refraction render pass. •Transparent: Transparent GameObjects that use the default render pass. •Low Transparent: Transparent GameObjects that use the low resolution render pass. •All Transparent: All Transparent GameObjects. •All Transparent With Low Res: Transparent GameObjects that use the Pre-refraction, Default, or Low resolution render pass. •After Post Process Transparent: Transparent GameObjects that use after post process render pass. •Overlay: All GameObjects that use the overlay render pass. •All: All GameObjects. |
||
Layer Mask | Determines the GameObject layer that this Custom Pass applies to. | ||
Overrides | |||
Override Mode | Determines what this Custom Pass volume uses to render GameObjects included in this Custom Pass: •Material •Shader •Pass Name |
||
Material | Determines the Material that this Custom Pass uses to override the Material and Material properties of every GameObject included in this Custom Pass. This property appears when you select the Material override mode. This field accepts an unlit Shader Graph, unlit HDRP Unity shader or lit shader. For a full list of compatible materials, see Material and injection point compatibility. To create a Unity shader that is compatible with a draw renderers Custom Pass, navigate to Create > Shader > HDRP > Custom Renderers Pass . |
||
Shader | Determines the Shader that this Custom Pass uses to override the Materials of every GameObject included in this Custom Pass. This override keeps all the properties of the original Material and renders them with the Shader you assign. You can use this to sample Textures or other values from the Material this Custom Pass overrides. This property appears when you select the Shader override mode. This field accepts an unlit Shader Graph, unlit HDRP Unity shader or lit shader. For a full list of compatible materials, see Material and injection point compatibility. To create a Unity shader that is compatible with a draw renderers Custom Pass, navigate to Create > Shader > HDRP > Custom Renderers Pass . |
||
Pass Name | Determines the Custom Pass that Unity uses to draw the full-screen quad. You can use this to switch between multiple Custom Pass effects. This field appears when you assign a material to the Material or Shader field. The drop-down options for this field change depending on the material or shader you assign. |
||
Override Depth | Enable this checkbox to override the depth render state in the materials of the rendered GameObjects. This allows you to replace the default Depth Test value, and write the depth using custom values. |
||
Depth Test | When Unity renders a GameObject, it uses the Depth Test value to check if it is behind another object. To do this, Unity tests the z-value (the depth) of a given GameObject’s pixel, and compares it against a value stored in the depth buffer. By default, Depth Test is set to Less Equal, allowing the original object to appear in front of the object it is tested against. Use the drop-down to select the comparison method to use for the depth test. Each comparison method changes how the Shader renders: •Disabled: Do not perform a depth test. •Never: The depth test never passes. •Less: The depth test passes if the pixel's z-value is less than the stored value. •Equal: The depth test passes if the pixel's z-value is equal to the stored value. •Less Equal: The depth test passes if the pixel's z-value is less than or equal than the Z-buffers value. This renders the tested pixel in front of the other. •Greater: The depth test passes if the pixel's z-value is greater than the stored value. •Not Equal: The depth test passes if the pixel's z-value is not equal to the stored value. •Greater Equal: The depth test passes if the pixel's z-value is greater than or equal to the stored value. •Always: The depth test always passes, there is no comparison to the stored value. This setting only appears when you enable Override Depth. |
||
Write Depth | Instructs Unity to write depth values for GameObjects that use this material. Disable it if you do not want Unity to write depth values for each GameObject. |
||
Override Stencil | Overrides the stencil operations of the Materials in this Custom Pass. Enable this property to control all stencil fields. For more information, see ShaderLab command: Stencil. | ||
Reference | Determines the stencil reference value this Custom Pass uses for all stencil operations. | ||
Read mask | Determines which bits this Custom Pass can read during the stencil test. | ||
Write mask | Determines which bits this Custom Pass can write to during the stencil test. | ||
Comparison | Determines the comparison function this Custom Pass uses during the stencil test. | ||
Pass | Determines the operation this Custom Pass executes if the stencil test succeeds. | ||
Fail | Determines the operation this Custom Pass executes if the stencil test fails. | ||
Depth Fail | Determines the operation this Custom Pass executes if the depth test fails. This option has no effect if the depth test is disabled. | ||
Sorting | Determines how Unity sorts the GameObjects in your scene before it renders them. For more information, see Sorting criteria. |
Object ID Custom Pass properties
Configure an Object ID Custom Pass in the Custom Passes panel using the following properties:
Property | Description |
---|---|
Name | Use this field to name this Custom Pass. Unity uses this as the name of the profiling marker for debugging. |
Target Color Buffer | Select the buffer that Unity writes the color data to: Camera: Targets the current camera color buffer that renders the Custom Pass. Custom: Uses the Custom Pass buffer allocated in the HDRP Asset. None: Doesn’t write the data to a buffer. |
Target Depth Buffer | The target buffer where Unity writes and tests the depth and stencil data: •Camera: Targets the current camera depth buffer that renders the Custom Pass. •Custom: Uses the Custom Pass buffer allocated in the HDRP Asset. •None: Doesn’t write the data to a buffer. This buffer does not contain transparent objects that have Depth Write enabled in the shader properties. |
Clear Flags | A clear flag discards the contents of a buffer before Unity executes this Custom Pass. This property assigns a clear flag to one of the following buffers: •None: Doesn’t clear any buffers in this pass. •Color: Clears the depth buffer. •Depth: Clears the depth buffer and the stencil buffer. •All: Clears the data in the color, depth and stencil buffers. |
Filters | This section determines the GameObjects that Unity renders in this Custom Pass. |
Queue | Select the kind of materials that this Custom Pass renders. |
Layer Mask | Select the GameObject layer that this Custom Pass applies to. |
Overrides | |
Override Depth | Enable this checkbox to override the depth render state in the materials of the rendered GameObjects. This allows you to replace the default Depth Test value, and write the depth using custom values. |
Depth Test | When Unity renders an GameObjects, it uses the Depth Test value to check if it's behind another object. To do this, Unity tests the z-value (the depth) of a given GameObject’s pixel, and compares it against a value stored in the depth buffer. By default, HDRP sets Depth Test to Less Equal, allowing the original object to appear in front of the object it is tested against. Use the drop-down to select the comparison method to use for the depth test. Each comparison method changes how the Shader renders: •Disabled: Do not perform a depth test. •Never: The depth test never passes. •Less: The depth test passes if the pixel's z-value is less than the stored value. •Equal: The depth test passes if the pixel's z-value is equal to the stored value. •Less Equal: The depth test passes if the pixel's z-value is less than or equal than the Z-buffers value. This renders the tested pixel in front of the other. •Greater: The depth test passes if the pixel's z-value is greater than the stored value. •Not Equal: The depth test passes if the pixel's z-value is not equal to the stored value. •Greater Equal: The depth test passes if the pixel's z-value is greater than or equal to the stored value. •Always: The depth test always passes, there is no comparison to the stored value.This setting only appears when you enable Override Depth. |
Write Depth | Enable Write Depth to instruct Unity to write depth values for GameObjects that use this material. Disable it if you do not want Unity to write depth values for each GameObject. |
Sorting | Select the way Unity sorts the GameObjects in your scene before it renders them. For more information, see Sorting criteria. |