My goal is rendering some underwater effects (for example depth base fog) when the camera is underwater. The above water and below water are separated by the water plane which is based on the FFT implementation. How can I use (if possible) stencil masks/operations to only render in the below water area of the screen?

I have no problem rendering the Fog effect when the camera is fully submerged or fully above water, my issue is when the camera is halfway underwater, so you can see below and above the water at the same time:

enter image description here

So in this my beautifully drawn paint picture, the black line is the water line in the screen so the shader would only apply fog to the blue part, leaving the green part intact.

If stencil isnt the adequate tool for the job then i can use other methods for this. Any suggestions?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.