Sorry to necro this - I know it works in HDRP 14 point something, but if you’re using an older HDRP version (ex. 7.x) like I do, you can use the following workaround:
- Bring the HDRP package (folder
com.unity.render-pipelines.high-definition@7.x
) to your project’s local /Packages/
folder, so that it can be patched.
- Locate file
HDRenderPipeline.cs
(in /Packages\com.unity.render-pipelines.high-definition@7.x/Runtime/RenderPipeline/
).
- Open it for editing and move line
m_PostProcessSystem.DoUserAfterOpaqueAndSky(cmd, hdCamera, m_CameraColorBuffer);
(should be somewhere between SendGeometryGraphicsBuffers(...)
and RenderTransparentDepthPrepass(...)
) after RenderSubsurfaceScattering(...)
and before RenderForwardEmissive(...)
.
Your HDRP implementation might be different and m_PostProcessSystem.DoUserAfterOpaqueAndSky(...)
might be named differently, but ultimately, you want to move the AfterOpaqueAndSky injection point earlier in the RP, so that its effects execute earlier. Not too early though.
Of course, beware that doing so will affect all PP effects that are assigned to After Opaque And Sky injection point (they too will execute before fog), as changing its execution location effectively invalidates its original semantic (now it’s essentially “before transparent”). I only have the HBAO effect assigned to After Opaque And Sky, so for me, the workaround did not break anything.
I know it’s a dirty workaround, but perhaps somebody might find this useful as a last resort.
For more context, my RP looks like this now:
m_PostProcessSystem.DoUserAfterOpaqueAndSky(cmd, hdCamera, m_CameraColorBuffer);
// moved:
// before volumetric lighting, so that custom AO effects don't render after fog
m_PostProcessSystem.DoUserAfterOpaqueAndSky(cmd, hdCamera, m_CameraColorBuffer);
RenderForwardEmissive(cullingResults, hdCamera, renderContext, cmd);
RenderSky(hdCamera, cmd);
// Send all the geometry graphics buffer to client systems if required (must be done after the pyramid and before the transparent depth pre-pass)
SendGeometryGraphicsBuffers(cmd, hdCamera);
// default
// should be before volumetric lighting, so that custom AO effects don't render after fog
//m_PostProcessSystem.DoUserAfterOpaqueAndSky(cmd, hdCamera, m_CameraColorBuffer);
RenderTransparentDepthPrepass(cullingResults, hdCamera, renderContext, cmd);
Some before & after:
Before HDRP patch (left - HBAO off, right - HBAO on):
After HDRP patch (left - HBAO off, right - HBAO on):
Before (left) & after (right) HDRP patch (HBAO on in both):
All the best!