Custom Post processing in 2019.3 HDRP/URP

Is custom post processing available in either HDRP or URP post processing stacks? Based on my experiment, it doesn't seem to be the case. Is there a timeline on when we can expect this?

This is coming up for HDRP: https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/4317, it's not merged in yet.

Since 2019.3 is out, any updates on this? do we still have to pull the SRP from git to get access to custom post processing?

HDRP 7.2.0 comes out this week.


so with 7.1.8 we still need git i guess
EDIT: no need for git any more
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@7.1/manual/Custom-Post-Process.html

Custom post processing and custom passes have been for a while on 7.1 already. Been using both myself.

In addition to @jister 's link, here's one for custom passes:
https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@7.1/manual/Custom-Pass.html
and here's a demo repo on how custom passes:
https://github.com/alelievr/HDRP-Custom-Passes

Both custom passes and custom pp passes have their own use cases. Custom passes can be handy if you need to inject passes for specific meshes at some point in the frame graph, I've used this for example to tag objects from specific layers with simple stencil write shader so I can tag HDRP's built-in stencil bits like ExcludeFromTAA bit (which you can't set other than manually via shader right now).

1 Like

Here's a quickly ported color blindness emulation on HDRP PP using custom PP pass:

source code: HDRP_ColorBlindnessPP.zip

And here's a stencil write example for custom pass: CustomStencilPass.unitypackage (just drag the prefab to scene, then just change the stencil write bit from the included material).

HDRP's stencilbitmask values for 7.1.x here.
and for 7.2.0 and onwards, you can find the bits here.

Do note that these were just quick experiments, and are not a fully polished examples and can therefore still contain some errors.

2 Likes

@rz_0lento thanks for the examples
any idea how to get World Space Positions to work?
I use to do this in an Image Effect shader to get a world space reference frame:

struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
                float4 ray : TEXCOORD1;
            };

...

v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv.xy;
                o.interpolatedRay = v.ray;
                UNITY_TRANSFER_FOG(o,o.vertex);
                return o;
            }

...

half rawDepth = DecodeFloatRG(tex2D(_CameraDepthTexture, i.uv.xy));
                half linearDepth = Linear01Depth(rawDepth);
                half4 wsDir = linearDepth * i.interpolatedRay;
                half3 wsPos = _WorldSpaceCameraPos + wsDir;

If I Debugged wsPos, I got this:
5440176--554661--wsPos.PNG
with the Interpolated ray being the magic that gave this at the camera's position:
5440176--554664--interpolatedray.PNG

I tried almost everything i could find, but am not able to reproduce this in the PP Shader.
Could someone show how to get this result in HD Postprocessing shader?

Do note that HDRP is rendering camera relative, so some things don't work quite like they used to. If I know some PP effect needs similar thing, I can just peek into built-in PP shaders and see how they solved it there.

And I often also check how HDRP shader graphs do things to get an example snippet. For example wire a simple shader graph, put there some property name that I can easily search for and right click the master node on graph to get the generated shader code for it.

@rz_0lento thanks for the tip, found my answer here.

to get the same result as in the first screen, I use this now:

float depth = LoadCameraDepth(input.positionCS.xy);
        half linearDepth = Linear01Depth(depth, _ZBufferParams);

        PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw, depth, UNITY_MATRIX_I_VP, UNITY_MATRIX_V);

        float4 worldPos = float4(posInput.positionWS, 1.0);
        float4 curClipPos = mul(UNITY_MATRIX_UNJITTERED_VP, worldPos);
        float2 positionCS = curClipPos.xy / curClipPos.w;
half3 wsPos = _WorldSpaceCameraPos + worldPos;
return float4(wsPos, 1);

Possibilities are endless again! ;p

1 Like