After getting shocked by the Screen Space water that is starting to appear at some IOTDs, I started to implement this little thing by myself, on my actual terrain engine that uses the traditional forward rendering approach.

Below is the result of a few hours messing with it. Please note that this water implementation is NOT COMPLETED yet, I just implemented the "virtual" aspect (there is no mesh for the water at all), and the raycasting to calculate transparency.

Now I'll add the sky reflections and bump mapping, so I'll probably post another image in here when I'm finished with it.

The edges clipping is vertex-based, unfortunately. I will be glad to hear some criticism and suggestions! Until now I'm excited with this.

The engine itself has support for sky and other features, but I was not using when I took this screenshot.

Cool! I implemented a partially screen-space water system for Infamous (which uses deferred shading) a few weeks ago. The ability to fog and distort the image behind the water really lends it a lot of realism. Another guy at my company wrote a nifty Fourier synthesis routine to generate the normal map for the water, and that works really well too.

I guess we use the word "render" pretty loosley. It's a post process effect, an easy extension for deferred shading. As I understand it, you take the world-space position of the pixel (presumably from the g-buffer) and set a variable "water line". From there you basicly just test if the pixel is below the water line and how far it is. Theres also other steps to do lighting of course.

At least I *think* thats what it is. I could be wrong. I just remember doing something similar a while back.

Personally though, I havent warmed up to the idea of it yet. IMO it might be hard to get consistant with other water effects that require geometry.

Reedbeta
—
2009-01-16T07:24:21Z —
#5

I guess we also use the term "mesh" pretty loosely. Actually, screen-space postprocessing effects use a full-screen quad (though in the case of the water, it would make more sense to clip the quad by the horizon line, to avoid using fillrate for the sky part of the screen).

That said, it's a good idea to use an actual water mesh, as you then get the benefits of early-Z culling to eliminate the pixels where there is no water. You can still recover the screen-space position, sample the depth buffer behind the water, and so on.

Well I just kind of assumed people knew that. Renering an effect without *any* geometry? Tha'd be a trick. Alright, well, I guess I'd say water geometry then.

vrnunes
—
2009-01-16T17:59:22Z —
#7

Just to make things clear, actually it is rendered within the terrain pixel-shader, very much like a fog effect.

It was my fault to mention the screen-space water and not to make it clear that my version is trying to "emulate" the screen-space water, but I'm not using a fullscreen quad.

For every pixel below the water plane, I cast rays from there to the eye position, intersecting with the water plane. Then, based on that distance, I determine the transparency at that pixel.

I made some further tests, and for the game that I'm currently making, it will fit nicely. What I really like about this water is that it is being really quick to implement, and does not add a single vertex to the batch.

EDIT: After some more tests, I am aborting my implementation of this technique, and returning to the water grid approach! I will keep the ray casting though, as I guess that was what really impressed me...

vrnunes
—
2009-01-17T09:03:00Z —
#8

OK, just to finish this thread that was just one of my very own equivoques, here is an up to date image made by my engine: