- Home /
Mask water for underwater effects
I'm writing an ocean shader using gerstner vertex displacement and now I want to add an underwater effect for every pixel that is under the water surface.
The only solution that I can think of is comparing the y-coordinate of every pixel with the y-coordinate of the water vertices, however this seems like it would be very slow and I bet that there are better ways to achive this.
The underwater shader is an image effect and I know that I have to generate som kind of mask where the pixels that are above the water on the camera near clipping plane are masked off. What method would one use for this?
This is the kind of effect that I want to achieve :
Your answer
![](https://koobas.hobune.stream/wayback/20220613003243im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Caustic underwater effect 1 Answer
Water foam 1 Answer
Subnautica like underwater effect / rays 0 Answers
underwater shader 1 Answer
underwater fog script 1 Answer