The original code, before using HDRP, essentially grabbed a screenshot of whatever the main camera was seeing and fed it to a shader. The shader would then draw a quad image over that image.
What I am hoping for in HDRP is an alternative, performant way of grabbing all pixels on screen and feeding them to a shader.
I understand the latest HDRP has no access to
OnRenderImage(RenderTexture source, RenderTexture destination)
and instead has access to
RenderPipelineManager.beginCameraRendering
RenderPipelineManager.beginFrameRendering
RenderPipelineManager.endCameraRendering
RenderPipelineManager.endFrameRendering
However, what I don’t understand is how to grab the equivalents of OnRenderImage’s source and destination from endFrameRendering (or any of the above), since the RenderPipelineManager delegate functions only feed/receive an SRP context and an entire camera/cam array.
Insight appreciated.
2 Likes
Am also down this rabbit hole, and would like clarification, on how to grab the Src, Dest equivalents
Hello,
The renderpipeline events in the RenderPipelineManager class are SRP agnostic and especially useful for tooling as they are outside of the render loop, these events weren’t design to allow post processing or other effect that must be inside the render loop.
That’s why each pipeline must have a way to extend the render pipeline by injecting passes at certain points. In HDRP you have roughly two option for this:
- Custom Post Process which look like the custom post process in the post processing stack V2, it’s integrated in volumes and you can create new post process volume with Create > Rendering > C# Post Process Volume. This is the closest thing to OnRenderImage because you have a Render callback in the volume:
public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination)
Note that there are currently 3 injection points for custom post processes in HDRP: before transparent, before post process and after post process
- Custom Pass, this one is more complicated because it gives you access to the ScripotableRenderContext which then allow you to draw objects in the camera view or do fullscreen passes. It allow you to create more complex effects like the one in this repo: GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP, note that this repo is currently using a branch on the SRP repository that will be merged soon and will most likely be part of the next release. Custom passes can be injected before rendering, before transparent and before post process (after post process is coming).
6 Likes
More info about Custom Post Processes can be found in the PR on github:
https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/4484
I’m working in Unity 2019.4.34f1 (LTS).
Sometime ago I migrated my project from built-in RP to HDRP (7.7.1 - 21 Jule 2021). And now I have to remake some visual effects.
-
Official documentation about “Volume” framework doesn’t tell anything about managing of volume’s overrides at run-time
-
GitHub - alelievr/HDRP-Custom-Passes: A bunch of custom passes made for HDRP - any version is unworkable. Parent class CustomPass doesn’t contains methods overrided in samples. (Descripted as project have been setup for Unity 19.3 version with HDRP 7.4.1.)
Assets\CustomPasses\CustomPasses\Fur\Fur.cs(53,37): error CS0246: The type or namespace name 'CustomPassContext' could not be found (are you missing a using directive or an assembly reference?)
Assets\CustomPasses\CustomPasses\RenderWithNormalBuffer\RenderWithNormalBuffer.cs(26,29): error CS0115: 'RenderWithNormalBuffer.Execute(CustomPassContext)': no suitable method found to override
Assets\CustomPasses\CustomPasses\RenderMotionVectors\RenderMotionVectors.cs(5,29): error CS0234: The type or namespace name 'RendererUtils' does not exist in the namespace 'UnityEngine.Rendering' (are you missing an assembly reference?)
etc.
51 error in total.
3)https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/4484 - gets 404 error.
-
Trying to install a Unity 2021.3.11f1 or 2022.1.20f1 and upgrade a project (it has more then 28 Gb of assets) leads to Unity (any exclude 2019.4.34f1) silently crashes after project loading.
-
There is no Create > Rendering > C# Post Process Volume - component or object to create. Only Density volume or Decal projector.
Where can I get an actual detailed API documentation of Volume framework \ using Custom Pass \ creating Post process ?