Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

DecodeFromNormalBuffer in AfterOpaqueDepthAndNormal

Discussion in 'High Definition Render Pipeline' started by Kamael, Jun 2, 2020.

  1. Kamael

    Kamael

    Joined:
    Mar 11, 2013
    Posts:
    15
    Acording to Custom Pass Manual buffers for Normal and Depth should be avaiable in the AfterOpaqueDepthAndNormal injection point. But when I tried to use DecodeFromNormalBuffer, I got nothing. In BeforePreRefraction it works perfectly, but not earlier. Does anyone know how to get NormalBuffer in AfterOpaqueDepthAndNormal point?
     
  2. antoinel_unity

    antoinel_unity

    Unity Technologies

    Joined:
    Jan 7, 2019
    Posts:
    271
    Hello,

    You should have access to the normal buffer in the AfterOpaqueAndNormal injection point. You can take a look at this example in the custom pass example repository to see how it's done:
    https://github.com/alelievr/HDRP-Cu...omPasses/ExtractBuffers/ExtractBuffers.shader
    https://github.com/alelievr/HDRP-Cu...CustomPasses/ExtractBuffers/ExtractBuffers.cs
    upload_2020-6-9_17-0-48.png

    Note that the normal buffer is not cleared and will contain invalid values where there is no object rendered in your buffer,.
    You can check which pixel is right using either the stencil or the depth buffer.