Jump to content
  • Advertisement
Sign in to follow this  
DarkCybo1

Where can I find resources on how to do water reflections?

This topic is 4571 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 know how to do reflections with the stencil buffer, but have no clue on how to do "wavy reflections" like those seen in this screenshot: http://www.facewound.com/images/2a.jpg I'd take and guess and say it has some to do with direct pixel manipulation or maybe just messing with texture coordinates, but it doesnt seem like a way/good way to do it.

Share this post


Link to post
Share on other sites
Advertisement
they just capture the screen above the waterline into a texture + just draw a polygon with this texture bound for the water.
using some texture lookup manipulation in a shader

eg glsl
vec3 col = texture2D( texture0, vec2(gl_FragCoord.x + sin( time + gl_FragCoord.x/10.0), gl_FragCoord.y + sin( time gl_FragCoord.y/10.0) );

Share this post


Link to post
Share on other sites
Hope this is not off topic - what graphic cards support above method?
Radeon 9200 + ? And what will be technique for older cards?

Share this post


Link to post
Share on other sites
for glsl u need at least radeon 9500 or nvidia nx3x or greater
u may be able to do something with lesser hardware using another extension fragment_program etc
check out if doom3 have the heat haze when u run it on a 9200

Share this post


Link to post
Share on other sites
You could also create the geometry on which the reflection is drawn out of many quads which are one above the other. That way you have many vertices on the left and the right of the water surface in a vertical row.
Now you can simply modify the texture coordinates every time before you're sending the corresponding vertex through the GL pipeline to make the texture on every second border between the quads on the water geometry moving a bit to the left and then to the right again. This won't create a sine wave, but for resolutions like in the screenshot the result should come close.
Additionally there is absolutely no need for any shaders that way, it's just a bit more cpu utilisation.
Maybe some optimisation can be done by reducing oGL overhead with vertex arrays.

Share this post


Link to post
Share on other sites
here is a very basic overview how i do my water

I use FBO to render the scene above the water to a texture
I use a 3D noise texture to create the offset for the ripples
I use GLSL to animate and create my texture coords , you can easily use fixed function pipeline todo this but i choose to use a vertex/pixel shader instead

Picture

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!