Download

How would I approach depth in an ocean shader for spheres?

Hello. I am working on a game with spherical planets as levels and have been trying to make a spherical ocean shader. I have been able to find next to no information on the subject and decided to do my best to adapt an existing planar solution for spheres. I chose to follow Ben Cloward’s tutorial series and managed to get normals rendering in 3D world space, but I am struggling with adapting the depth shown in the video linked below to 3-dimensional space instead of just on the Z-axis.

Ben Cloward’s Water Depth Turorial: https://www.youtube.com/watch?v=9N-pQNPChxU&list=PL78XDi0TS4lGXKflD2Z5aY2sLuIln6-sD&index=7

? Thats water flow, not depth?

Regardless a vector field is already in 3 dimensions by nature, so it would definitely go Up as well as left/right - which again has little to do with depth?

Generally, when working water you distort the plane to a sphere within the material - which brings a slur of restrictions like not being able to walk/swim on the whole surface.

Perhaps explain more what you are attempting to do and how you are going about it so far?

Sorry, I think I posted the wrong video. He has a whole series on water.

The tutorial demonstrated a way to get an accurate depth effect with the camera being at any angle, but it only works on the Z-axis. He did say that for 3D meshes or rotated planes, you could use a less accurate depth effect. I implemented it and it doesn’t look too bad as the changing depth mixes with the refraction effect a bit, but I was still wondering if there are other ways I could approach more accurate depth in 3D.

Here is the correct tutorial video I used and a screen recording of the ocean sphere I am using to test the shader:

Tutorial: https://www.youtube.com/watch?v=TObymSnTwV0
Screen Recording: https://drive.google.com/file/d/1Bbwrv-9O2tflBe-1IywBW8uIJxxNcJJ4/view?usp=sharing