#### Archived

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

# Water

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

## Recommended Posts

Hi, I want to create water with waves and reflections. How can i do this?

##### Share on other sites
Well, what do you think you''d do to create water? You can first think of water a quad, then textured/multitextured with some textures that have moving texture coordinates to make a flowing effect. Then you can think of the water as a large grid that has points that can move up and down creating waves. Go to nehe.gamedev.net and read the flag tutorial there, or look at loderunners ( i think it''s his) water demo thingy and try to do that.

##### Share on other sites
Gamasutra, 2 part article on waves and refraction, intersting read.

##### Share on other sites
Ok, check out NeHe''s waving flag tutorial... Water is *A LOT* like that, except that you need some different mathematical formulas to make it look right. Can''t help you much on the refraction end though... But, I think I''ll do some research on it, and write a tut sooner or later (later most likely).

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials

##### Share on other sites
Nehe also has reflection tuts (using the stencil buffer if I remember right). I''m not advanced enough to understand it yet, but I have a feeling that the answer that you are looking for is a combination of the flag tutorial and the reflection tutorial.

##### Share on other sites
Reflection is nothing more then Negitive Scaleing about a plane.
(when the plane is infinate)

##### Share on other sites
You can create planar reflections like that and use the stencil buffer to limit the output to the water. If you have "big" waves will it not look right. Instead can spheremaps (perhaps also dynamic) be used.

The "amplitude" of the reflection is depending on the viewing angle. If you are looking right down at the water should the reflection almost be invisible. This can be achived by setting the alpha values for a spheremap. I think it is called the fresnel part.

Another interesting idea is to combine alpha maps and planar reflections. I have never seen a demo but here is an descripton http://reality.sgi.com/opengl/tips/puddles/