Calculate depth fade after refraction - water shader

Offline / Send Message
Ali_Youssef triangle
Ahoy fellow vertices and other geometrical shapes, I have a problem in a little water shader I'm testing out,
I used depth fade for the opacity of the water, which works fine until refraction offsets the object, so what I'm left with is the low-opacity outline of the object before the refraction takes place:

What I've tried:
_Googling: several results, none yielded full resolutions of the issue
_Using depth fade to lerp the refraction (which is actually in the screenshot), looks better than just using fresnel, but the issue is still there.
_Fiddled a bunch with the fresnel/depth fade settings, but it doesn't seem to change anything at all, it's simply using the depth information prior to the refraction.

I am aware that refraction is a screen-space effect, and the fact that it doesn't get picked up by screen depth isn't in my favour, but I was thinking if there was a way to refract the scene depth as well as the scene colour ?
Or you know, any other way to fix/hide this.

Here's my material setup (on the left is just a panning normal, nothing important there to show):

Cheers !


Sign In or Register to comment.