#### Archived

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

# Problems with Water Surface Rendering

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

## 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 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 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 ?

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633307
• Total Posts
3011289
• ### Who's Online (See full list)

There are no registered users currently online

×