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?
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-Custom-Passes/blob/new-custom-pass-api2/Assets/CustomPasses/ExtractBuffers/ExtractBuffers.shader
https://github.com/alelievr/HDRP-Custom-Passes/blob/new-custom-pass-api2/Assets/CustomPasses/ExtractBuffers/ExtractBuffers.cs
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.