Are these callbacks supposed to work on HDRP?
I’d like to know that as well, as I just ran into the same issue - the OnPreCull delegate isn’t called (at all?) on our HDRP-based project (Unity 2019.2.17f1 + HDRP 6.9.2). Are there any replacements?
Hi,
All the camera events have been deprecated in SRP so if you’re using Universal / HDRP your code won’t be called if you try to use them.
Two system are replacing these events:
- The render pipeline manager, it provides before and after frame / camera rendering events but is not designed to do any rendering operation (you don’t have access to the camera buffers) Unity - Scripting API: RenderPipelineManager.
- Builtin HDRP custom passes, this is the solution to write any custom effect, you can check out the doc here: Redirecting to latest version of com.unity.render-pipelines.high-definition and there is also a sample project with examples of custom passes: GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP
You can also note that there is custom post processes built-in HDRP too: Redirecting to latest version of com.unity.render-pipelines.high-definition
Hi,
I think this is related so i’ll ask here:
In built-in pipeline (old), i used to visualize unity’s built-in frustrum culling this way:
// 2) cull everything outside of camera frustrum
Camera.onPreCull = SetCamSizeDefault;
// 2) render everything inside the camera, and some distance outside of camera (which has been culled in (1), so it will show mostly as empty space)
Camera.onPreRender = SetCamSizeLarger;
This worked fine, following the old event exec order.
How do i do this visualization within URP? The URP loop only allows me to access BeginFrameRendering and BeginCameraRendering with delegates, but the ‘culling’/‘build rend data’ + ‘execute renderer’ happens deeper inside (to which i have no exposed delegates via which i could inject my c# code).
I’m aware the process in implementing said visualization for URP would be different from the built-in pipeline, but would welcome some additional resources - any (more detailed than the official docs) example code or links would be appreciated. I’m struggling to find them myself.
Bump
I found this Solution working for me. You can use this :
protected void OnEnable()
{
RenderPipelineManager.beginCameraRendering += CustomOnPostRender;
}
protected void CustomOnPostRender(ScriptableRenderContext context, Camera camera)
{
//Write your Code Here
}
private void OnDisable()
{
RenderPipelineManager.beginCameraRendering -= CustomOnPostRender;
}