HDRP Shader GrabPass

Solution for GrabPasses or other workaround to replace in shader grap or in Amplify Shader Editor…

1 Like

Yes, hoping in a Grab Pass solution for HDRP too.

2 Likes

Any news?

1 Like

Please Grab Pass capability soon would great.

1 Like

Hi,

There is no grab pass in HDRP, lit shader already have builtin support for rough refraction.

@SebLagarde in light of this, I was wondering if there are plans to support refracted objects appearing through refracted objects in HDRP, I realise the back object can have Pre refraction enabled but then it isn’t refracting itself. Currently this effect is possible with Amplify when not using HDRP and I believe it uses the Grab Pass for this, but as you can see in the second image (unless I’m doing something wrong) the built in refraction for the HDRP/Lit shaders don’t support his?


Example using Amplify Shader - You can see the back object through the front object and both are refracting

4066525--354217--Annotation 2019-01-05 154836.jpg
Example 2: HDRP Lit shader - Rear object is invisible through the front object.

Is this possible and will this be supporting or are there any work arounds for this?

1 Like

This is now fixed in HDRP 4.8 by selecting the appear in refraction option in the HDRP/Lit shader Thank you

Hi,

by selecting the appear in refraction option
FYI: This functionality have been there since a long time. even since 2018.2. Not sure why you weren’t able to make it work before

There is no grabpass in HDRP (It is an extremely consuming operation and we decided to keep the control on it to have performance control)
Note that we have expose sceneColor node in shader graph (that have currently a remaining issue that will be fix in 4.9.0).

Note that I don’t know what Amplify is using, but to have a refracted object that see another refracted object, it require two resolve of the scene color (and if you handle rough refraction it require to convolve color buffer in mips - or two “grab pass”). In HDRP we have decided to only offer two options (which is already expensive), we offer rough refraction and distortion. (Refraction mimic properties of material, with IOR and absorption, distortion is artistic effect apply on whole screen and all objects). Render pass in HDRP are like this:

Render Opaque

Render Sky/Fog

Render Transparent that can appear in refraction

Resolve color buffer into a color pyramid (required to handle object that do refraction)

Render Transparent

Resolve color buffer into a color pyramid (for distortion effect))

Render distortion vector

Apply Distortion

Each group of transparent (Before refraction and regular) have their own sorting, and first group will appear before the other. Then distortion is apply on top of everything (an object performing distortion will distort itself).

This is the decision we have made for HDRP to keep control of performance (i.e avoid artists to make unreasonable choice). It could not fit a particular project (Also note that most engine only perform one resolve of color buffer as it is costly).

It mean that we don’t supported refracted object into refracted object as the example you show, but we support distortion on top of transparent object see through refracted object.

In HDRP you can disable option like distortion and refraction to remove them (note that last color pyramid is reuse for SSR next frame).

With transparent you will ALWAYS have sorting issue, and artists will always require a case we don’t support. Best in this case is to add additional resolve and additional group or reverse order of pass if the features is important for your project.

2 Likes

Thanks for the reply, that makes sense.

I like how even in the worst case HDRP finds a way to make the most of the data for example next frame.

1 Like

@SebLagarde Will it be possible to access the convolved mips in the sceneColor node? I want to blur by depth in a water shader. Basically like the distortion blur but without the self distortion/blurring which makes it limited in usefulness.

Thanks!

Hi, We add this feature request to our todo list.

Question: Is there a reasons to not used the refraction for this ? Refraction do what you want, or is it because you prefer the distortion vector map instead of normal map + IOR + Absoprtion for controlling the distortion ?

1 Like

Thank you Seb, if I can get it to work using the refraction feature that will be great. Last time I tried i couldn’t manage to get the result I wanted but I’ll try again and let you know!

Any news about how to replace GrabPasses? I would like to upgrade my shaders to use HDRP

Hi, I have answer here: https://discussions.unity.com/t/718020/9 you have Refraction, Distortion
and Scene node in shader graph

1 Like

Hi

Can we replace grabpass with a custom rendered rendertexture as in standard pipeline ?

Thanks

Hi,

How can we grab the correct texture to do refraction in HDRP inside a shader ?

Thanks

1 Like

Hi

How is is possible to get a refraction texture to feed our own shaders in HDRP ?

Like the camera.render() in previous versions.

Thanks

1 Like

Flexibility mostly, also the way refraction works kinda weird, it shift the entire refraction (based on mesh normal?) causing empty area on screen edges (Vignetting effect) or just cutoff on the bottom of the screen.
4307869--387244--Refr_Lit.png

While using scene color we avoid getting all of those artifact, and even a bonus we can do depth color.
4307869--387247--Refr_SceneColor.png

The only problem with this is there’s an artifact on the side of the screen a black area, this is also happened with scene depth node.
4307869--387250--Refr_SceneColor_SideArtifact.png

also currently i have to connect it into emission output, which mean sometimes the distortion can became brighter or darker when using automatic exposure, unlike using screen space refraction it stay the same.
It would be great if there’s a solution for those problem. Oh and mind you all of my case are for creating water shader :smile:

1 Like