Scene Depth to Vertex position not compatible

Not sure how this is done, but I have a wave (ocean) shader graph and would like to tone down the wave heights when near islands. I’m already using refraction with scene depth to get clear water in shallow water, figured I could use the same scene depth to tone down my waves but the scene depth node isn’t compatible with the vertex position. What do I need to do?

Could you get the nodes you used to make the water clearer in shallow areas to divide your values before outputting to vertex position? So like, whatever gradient noise or sine wave or whatever you used for the waves, divide them by that first?

It doesn’t matter where I use the scene depth, if scene depth is used I can’t plug the results into vertex position…or maybe I don’t understand what your asking

Oh I see, actually IIRC the vertex stuff is calculated before depth so they can’t be used together, though there might now be an option to change that, see if anybody from Unity weighs in…

Awesome, thanks for chiming in and the info…i’ll wait patiently

If you meant shader graph dev then I don’t believe they exist :stuck_out_tongue:

I have not enough experience with that, so everything I’m gonna say might be completely wrong, but in forward renderer if you enable depth texture and depth priming (or even without it in transparents)? it should be available in theory, so you could use sample texture lod on _CameraDepthTexture for screen position uv and you would get depth. This depth would be raw, so it must be also converted for example to eye space. You must do research in this topic, but Scene Depth Node for sure can’t be used in fragment stage.

Ahh, I didn’t know about this, I tried to access the _CameraDepthTexture but you cannot access it directly. You get a redefinition error if you do. Not sure how to access the depth texture via the shader graph, if someone could enlighten me?

Why you get redefinition, create texture graph property and make it not exposed in the inspector.

Btw, I am working in HDRP but unless I’m doing something wrong, thats the error i’m getting when I assign a property ref ID to _CameraDepthTexture

8007032--1030028--upload_2022-3-30_12-16-29.png

8007032--1030031--upload_2022-3-30_12-16-57.png

Ah, sorry I have no experience with HDRP shaders.

:frowning: thxs for the assist though!