How to create a gradient based on Depth? Method in Unity's Tutorial no longer works...

I am trying to create a water shader in URP as per the instructions here:

The problem is that method no longer works as far as I can tell as I described here:

https://forum.unity.com/threads/cant-recreate-this-water-shader-from-unity-tutorial-wont-create-depth-gradient-effect.1411119/

So I am wondering if there is some working method to create such a depth-based color gradient.

I even tried downloading Boat Attack to see if that might work, but opening in the current 2022 versions of Unity breaks it and nothing even comes up on the screen when you press play (just a blank screen).

So is there any known effective method for doing this? Thanks.

I haven’t deep analyze your link, but it does not look like correct math and screen position is not even connected.
In any case compare yours with this.

Thanks. I realized screen position wasn’t connected after I posted but that wasn’t the issue. Even connected it wasn’t working. The math was just weird.

I actually found a tutorial that explained it a bit more here and got a basic depth gradient working about an hour ago from it:
https://www.cyanilux.com/tutorials/depth/#sample-depth-texture

But I appreciate the link. That is a great tutorial and I will try playing with that shader. It has many neat features that don’t work in URP out of the box (needs hi res) but I will try to capture some.