Advertisement Jump to content


This topic is now archived and is closed to further replies.


Problems with Water Surface Rendering

This topic is 5347 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am experimenting water surface but I have some problems to get it working correctly. Here are screenshots of the current result: (water height from 0 to 1 meters) (water height from -0.5 to 0.5) Here is how it is obtain: 1) Firstly I draw the reflected scene into à render texture (opengl PBuffer). 2) Next I draw the non-reflected scene in the frame buffer 3) Finally I draw the water. 3.a) The vertices position of the mesh are computer from a FTT-based height map, so I get a value from 0 to 255 for each point. I convert the height to (-0.5m;0.5m). 3.b) I compute vertex normal 3.c) I compute 3D texture coords by calculing intersection between the vertex normal (at ground altitude) and a virtual plane at 0.1m height. I add the vertice position and that was my 3D texcoord. 3.d) The good projection matrix is loaded in the texture matrix. IMPORTANT NOTES: When the water is a flat plane, the reflected texture is perfectly well mapped (a real mirror). So my problems are: 1) Since the water mesh is not flat, I can''t create the reflected image correctly because I use the reflected plane (0, 1, 0, 0). For example, the character on the screenshots is in water but since its position is above the water plane, the feet of the character are on the reflected texture 2) Some texture coordinates are outside the [0,1] range so you can see the clamp to edge effect. Any idea to correct my water?

Share this post

Link to post
Share on other sites
Ignore the second problem.
I found the solution.
I increase the fov of the render texture (1.5X).

But no idea for my first problem..

Share this post

Link to post
Share on other sites
I forgot a question:

To compute the texture coordinates, sould I modify the vertex position by the vertex normal or by the reflection of the eye direction with the vertex normal ?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!