i'm looking for suggestions on how i could use shaders to create a water effect on the surface in the picture (below):
I am using noise to create heightmap and normalmap textures that is uploaded to GPU. I am the rendering a plane of vertices using Triangle strips. Each vertex then samples the those textures to get normals and Y-value (height). The Y value (0-1) is just used to sample a "palette" texture (with the color shown in the picture), the vertex Y value remains 0 across the entire terrain. So it has a 3D look but it's just a flat plane.
Now, if it were 3D i could render a quad at Y = 0 (water level), and use this to create a water effect like this tutorial: OpenGL Water Tutorial
But i am unsure how to do something simular in 2D. All vertices are mixed in the same mesh. Before i have used tiles. And then i could single out and render the "water-tiles" to an fbo and do some effects.
So does anyone have any suggestions on how to identify the water, and only do the effect on the "blue" and not the rest of the terrain? I'm not sure if the question is any good, but i can provide more details if needed.
(The picture shows below 0 terrain as blue, ideally it would be something like brown with a semi-transparent "water layer" on top of it)
Maybe i could render a quad and discard all the fragments above the water level or something like that?
EDIT After applying a shader: (The colors are not final, and i need to blend the shorelines. But a good start :))