Good-looking Water?

Post: #1
I've seen some really good looking water lately (mostly in console games). At the moment in my current project water is just a bluish semi-transparent plane. Now I'd like to implement much more complex water-effects. Does anyone know of any good techniques or tutorials on getting good looking water-effects?

Quote this message in a reply
Posts: 916
Joined: 2002.10
Post: #2
giant mesh plane, pick a couple random points and choose them as the epicenter and do a cos wave outwards taking into account interference and bouncing and such. This will generally suffice. Also, take a look at reflection and refraction and implement those into your water and you'll acheive what you are looking for.
Quote this message in a reply
Posts: 145
Joined: 2002.06
Post: #3
You should start by looking at the important visual properties of water:
1. transparency
2. refraction
3. reflection
4. surface turbulence
5. the relation of reflection and refraction as a function of the incidence angle

I'm going to assume 4 in all of these.

1 at it's simplest levels, is trivial. You already have that down. 5 affects this though.

2 can be accomplished through render-to-texture of the scene behind the water, then using a combination of texture coordinate displacement and bump mapping.

3 is hard to do right, but can be faked reasonably well by using multi-texturing to simulate the effects of turbulence on the phong hilites of bright sources. using a generic environment map can also simulate this reasonably well.

4 can be achieved through transparency and texture mapping.

5 is really important if you're going for photo-real. Basically, as the angle of incidence approaches a tangent, the surface becomes more reflective and less transparent. you can do this as a function of their eye-space position and normal.

"He who breaks a thing to find out what it is, has left the path of wisdom."
- Gandalf the Gray-Hat

Bring Alistair Cooke's America to DVD!
Quote this message in a reply
Posts: 164
Joined: 2002.04
Post: #4
I wrote a terrain engine a while ago with some interesting water effects, it renders quickly but doesn't reflect or refract accurately for speed reasons, but it does reflect the skybox and ripple in 3d and do god rays and fog and everything. I could explain how it works if you're interested.
Quote this message in a reply
Posts: 5
Joined: 2009.01
Post: #5
Take a look at the "Deep-Water Animation and Rendering" paper at this page: The are some nice images here:

Quote this message in a reply
Post: #6
Thank you all for your great input!

David: I really like how your water looks in those screenshots, and speed is important, i'd really like to know more about the specifics of how you did it.

JPersson: Those screenshots look amazing! although speed is an issue, and I don't think that would fare well with a game going on, i could be wrong. I haven't read the pdf file about it yet but after glancing through it it looks a bit complicated, i'll take a closer look at it tomorrow though.

Quote this message in a reply
Posts: 164
Joined: 2002.04
Post: #7
Water surface:
Alrighty, well basically what I do is have a mesh that's a grid with higher detail at the center, like this. I set the X and Z coordinates to always be at the player's coordinates, and set the scale to the square of the Y coordinates. This way the mesh is always highest-detail close to the player.

Then at run-time I point the camera upwards and set the fov to near 180 and take a screenshot to use for my fake reflection, and then just apply this to the water mesh with additive blending, and it looks like a reflection. I then draw a copy (or two, or more, if you want more level of detail) of the water mesh using a 'ripple' texture and multiplicative blending. I then perturb the water mesh vertices and texture coordinates using a function of time and x,z coordinates and the player's position relative to the water. The opacity of each vertex of the water mesh is based on the dot product of its normal and its position relative to the viewer. There is an ambient water-lapping sound.

Random specks of dust are spawned that fade from invisible to visible and back to simulate catching the light. The terrain vertices' color decreases as their depth increases to simulate underwater haze. The screen becomes light brown as soon as you enter the water for fog, and darkens as you go deeper. Rays of light pierce the surface, which are basically quads textured with a gradient texture that are stuck on a line and rotated to face the viewer. There is an ambient underwater sound.

I hope this helps.
Quote this message in a reply
Post: #8
Awesome, that should work great!

Some specifics on the math (for the water mesh and opacity) would help me out a lot, like a code example or a link to some specifics.

Thanks for the help!
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Water Reflection Marjock 29 19,027 Sep 1, 2006 02:00 AM
Last Post: Marjock
  Water gfx in a terrain engine Mars_999 3 4,932 Sep 4, 2003 04:32 PM
Last Post: David