View Full Version : Do you have a cheap way to do realistic water
Mike Boeh
12-27-2005, 08:20 AM
I am trying to code a realistic water effect... Has anyone done one of these or know a good technique to do one? Keep in mind that this is for a low-end game, so all I can really do is blitting and alpha (bump mapping, etc are out).
I guess the first technique I am going to try is to scroll a couple of textures in opposite directions- that kind of looks like what's going on in quake3. I am just wondering if there is some simple way to do it.
Thanks!
EDIT: I figured out a good way to do it, but got a few requests to undelete the thread and discuss. I basically am taking 2 textures of water ripples at 50% alpha, and moving them in opposite vertical directions.... Looks good...
VladR
12-27-2005, 11:31 PM
You haven`t specified whether it`s 2D or 3D water. But since you`re mentioning Quake3, it`s probably 3D water.
Options for low-end gfx cards (GF2Ti and lower) where you can`t use pixel shaders:
1. Quad with animated texture coordinates of water texture
2. More quads above each other with opposite directions of texture coodinates animation
3. Animated mesh of 3d water (regular heighmap) with specular enabled - if your waves are animated/interacting well (common physical (statistical) simulation like Navier-Stokes Equations), the result is pretty realistic especially compared to previous option.
Though you`ll need some memory reserved for precomputed heightmap animation so that it isn`t slow - i.e. you`ll just interpolate (Tween) between separate frames (Vertex Buffers) of the water heightmap. I managed to fit a pretty realistic sea waves animation (quite a dense mesh - no visible triangle edges) into 5 MB of vertex buffers - though I admit, those 5 MB were compressed and decompressed in a vertex shader and it ran acceptably on a GF2MX.
4. Option 3 + animated caustics on the terrain below (if it`s just regular water and not sea waves) the water gives even more realistic result
5. Option 4 + reflection (at least from skybox, but it`s best if everything is reflected) through environment mapping
6. Option 5 + Refraction gives a AAA quality of water rendering which is how we`re doing the water in our 3D screensavers that have to be able to run on GF2MX and lower and still look the same.
EDIT:
Estimated time for implementation of each option:
1. 1 day
2. 2 days (because it takes time to find a correct matching second texture, id it`s the same texture, it will look weird)
3. 3-10 days
4. Additional 2 days
5. Additional 3 days
6. Additional 2 days
It all depends on how good are your water textures and you`ll spend lots of time just googling for nice water and caustics textures.
Chris Evans
12-27-2005, 11:43 PM
EDIT: I figured out a good way to do it, but got a few requests to undelete the thread and discuss. I basically am taking 2 textures of water ripples at 50% alpha, and moving them in opposite vertical directions.... Looks good...
This is pretty close to what I do with my water effect in Pow Pow's Mini-Golf. Though I have the 2 texture ripples scaled differently, so one texture has closer smaller ripples and the other texture has bigger ripples. I don't move them in opposite directions, instead I move one texture diagonal to the other. Then one texture has a 40% translucency and the other has a 80% translucency. This seems to give it a slightly more natural look. I'm not sure what kind of body of water you're doing, but this worked for me when I was doing a river.
Raptisoft
12-28-2005, 05:49 AM
You could get a web camera and point it at a pond somewhere in a city near you. Then run a T1 from that camera to an ISP, and establish a domain/IP for that camera. Then when the user runs the program, have it contact the web, and use the stencil buffer to just show the webcame image in the area where you want the water in the game. I think this could make for some pretty realistic water.
Savant
12-28-2005, 06:19 AM
You could get a web camera and point it at a pond somewhere in a city near you. Then run a T1 from that camera to an ISP, and establish a domain/IP for that camera. Then when the user runs the program, have it contact the web, and use the stencil buffer to just show the webcame image in the area where you want the water in the game. I think this could make for some pretty realistic water.
I agree. This seems like the best way to go.
Vorax
12-28-2005, 10:11 AM
In my WIP game, I use alot of water (player is travelling to different islands). I have found various ways of using two textures to get pretty nice water effects. I have also found some nice ways to make a horizon by generating an atmosphere haze at about 50% level of my sky box.
Screenshot (http://www.voraxgames.com/screenshots/kumariwater.jpg)
The water at the horizon is the same as the water that is close to the camera. It's all animated by having each texture go in two directions (not just opposite, but same idea).
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.