Unity | HDRP high-definition rendering pipeline study notes: HDRP Custom Pass

Table of contents

1. Introduction to Custom Pass Volume Components

1.Mode (mode)

2.Injection Point (injection point)

3.Priority

4.Fade Radius

5.custom passes

2. View the rendering stage of Custom Pass


        Custom Pass allows you to do the following ( official documentation ):

  • Change the appearance of materials in the scene.
  • Changes the order in which Unity renders game objects.
  • Allows Unity to read camera buffers to shaders.

        Unity uses injection points to execute custom passes at a specific point during the HDRP render loop. You can control how custom passes affect the appearance of your scene by changing the injection point.

        Custom Pass also uses the Volume framework to manage various settings. However, the Volume framework of Custom Pass has the following differences from the Volume framework described in detail before:

  • It is not possible to mix Custom Passes like normal Volumes. If there are multiple overlapping Custom Passes, the Custom Pass Volume with the smallest Bounding Volume will be executed, and other Custom Passes will be ignored.
  • The data of the Custom Pass is not saved in the HDRP configuration file like a normal Volume, but is saved in the GameObject of the current Custom Pass Volume.

1. Introduction to Custom Pass Volume Components

1.Mode (mode)

        You can choose two modes in Custom Pass Volume: Global or Local. These two modes are basically the same as the two modes in normal Volume. In Global (global) mode Custom Pass affects the entire scene. In Local (local) mode, we need to add an additional collider for collision testing. Only when the camera in the scene collides with the Custom Pass Volume object with the collider, the Custom Pass will affect the entire scene.

2.Injection Point (injection point)

        An injection point can be selected to execute the logic on the Custom Pass. The 6 injection points in the options are executed in order from top to bottom. At each point we can read and write some buffer data, and we also know what objects have been rendered before each injection point starts to execute the Custom Pass logic.

3.Priority

        If multiple Custom Pass Volumes are assigned to the same injection point, use this property to control the order in which Unity executes them. Unity executes these Volumes in order of priority (starting from 0).

4.Fade Radius

        In Local mode, there is an additional Fade Radius option, the default value is 0, and the unit is m.

  • If set to 0, it means that the Custom Pass will be invalid as soon as the camera leaves the Box Collider associated with the Custom Pass Volume.
  • If it is set to be greater than 0, such as 3m, then the Custom Pass will only become invalid when the camera leaves the Box Collider greater than 3m.

5.custom passes

  • FullScreen Custom Pass: Used to perform effects applied by Unity to the camera view or stored in a custom pass buffer.
  • DrawRenderers Custom Pass: Used to apply custom passes to game objects in the camera view.
    • Filters: Set the conditions here to select the objects that need to replace the material.
      • Layer Mask: Used to select the Layer where the object in the scene is located.
      • Queue: Select the material we need to affect through the tags here. For example: select All Opaque for the opaque material.
    • Overrides: Select the material information for overriding here.
      • Material: Associate a material to replace the material found by the Filters condition.
      • Pass Name: Because all opaque (Opaque) objects are rendered in the Forward pass, we choose Forward here (Note: If the Deferred mode is set in the HDRP configuration file, you must select Both to support the Forward mode).
      • Override Depth (override depth): If you want to render objects that are only rendered through Custom Pass, then you need to turn on this option and select Less Equal, so that the information of opaque objects can be written into the depth buffer and then rendered correctly.
  • ObjectID Custom Pass: Applies unique colors controlled by ObjectID to GameObjects in the scene.

2. View the rendering stage of Custom Pass

        Open the Frame Debugger window through the menu Window→Analysis→Frame Debugger, and we can view the entire process of rendering each frame in the Frame Debugger window. After opening the Frame Debugger window, it can be enabled by the Enable button in the upper left corner.

Guess you like

Origin blog.csdn.net/weixin_39766005/article/details/131457444