I am trying to add the final piece to my water material but can’t seem to figure it out. I took some snippets from this article Real-time Multiside Refraction in Three Steps | Codrops and try to make it work on a sphere. I come close but from the side view, it gets ruined. Here are a few screenshots. with before, after, and a side view.
With Refraction front facing:
Side view with refracton:
And the water refraction code:
vec3 eyeVector = normalize(vWorldPos.xyz - cameraPosition); vec3 normalSurface = vec3( fbm(2.5 * sUv + .05 * uTime), fbm(2.5 * sUv + .05 * uTime), fbm(2.5 * sUv + .05 * uTime) ); vec3 refracted = refract(eyeVector, vNormal.xyz + normalSurface, 1.0/1.333); sUv += refracted.xy;
Had an idea to use triplanar uvs but not sure where to use them. Any help to get water refraction working would be great!!