Hi guys!
I need to create an underwater effect just like the out-of-the-box underwater post-process effect from the water system, the only difference is that I don’t want the camera to drive the effect, but a third object.
Basically, I need to see the effect from inside a glass sphere (the spaceship in the picture), so the effect would be local, so the view would have the regular view from above the water, and the underwater effect where the water is being “cut” with the glass sphere.
Is there a way to make that possible?
You can only fake it with stencil and post processes overlays, and it’s not 100% accurate in regards to the water line.
The higher the wave the more error prone it becomes.
(Actually is more about the amplitude and sudden chang in height).
If you look for it, I believe I previously shared pseudo code to do it in a discussion about it.
You may be better off creating a vertical mesh with the wave formula applies to the verts at the top.
You isolate them via a vertex color, and run the function on it to shift the Z like the rest of the water.
The material for the plane could then also use transparency and other effects, which will likely look way better and more polished.
Above all, if you drive the mesh formula correctly based on the vert location you’ll have a 100% accurate stencil that represents where the edge of the water actually is.
Instead of relying on the stencil of the top of the water (the water mesh) which is highly inaccurate depending on angles.
Either way you go about this is rather performance intensive. Particularly with how bad rendering is right now.
Edit:
made some quick footage on it once it uploads:
Edit 2:
Noticed this. If you can’t find the engine function you can make your own based on this essentially. (personal note: it doesn’t seem 100% accurate to the grstner formulae. https://developer.nvidia.com/gpugems/gpugems/part-i-natural-effects/chapter-1-effective-water-simulation-physical-models eqation 9. Chanches are the engine one sin’t right either?)
Thank you for the answer, it looks so advanced that I’ll have to study everything step-by-step to see if I’ll be able to apply it…lol.
Also thanks for your complimentary video explaining the custom material.
Hey, can you please describe the stencil idea? I know how to use them on meshes and so on, but I didn’t get how to apply it for the division between the atmosphere and the underwater.