Archived

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

Problems with Water Surface Rendering

This topic is 4945 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: http://www.epsilondev.com/water1.jpg (water height from 0 to 1 meters) http://www.epsilondev.com/water2.jpg (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