• Advertisement

Archived

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

Water, water, everywhere.

This topic is 5488 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

There are currently two ways to implement water that I am looking into, FFT and Perlin Noise. I was wondering what methods out of these two people have used and which (to them) gave the most pleasing result.

Share this post


Link to post
Share on other sites
Advertisement
...And all the boats did sink.

Perlin noise is not bad, though somehow I don''t think it will look that good when animated. I mainly answered to finish the line in your subject.

------------
- outRider -

Share this post


Link to post
Share on other sites
Perlin noise looks OK for very large water bodies, like oceans. You have to keep in mind, that it is not controllable. If you want, eg, a calm lake, where the wind creates some flowing ripple patterns, then FFT is much better suited for that task.

There is, of course, an even better method: using an NSE solver. It approximates the Navier Stokes equations (they describe the reaction of a non-compressible fluid such as water) over the surface of a water body. The result is a very realistic surface behaviour, you''ll get the typical circular ripples, if something touches the surface. You''ll also get wave interferences, and ripples will reflect from objects, just as in reality. Drawback is that an NSE solver is pretty performance hungry, and not that easy to implement.

You can also combine FFT or Perlin noise with an NSE solver.

Share this post


Link to post
Share on other sites
FFT is fairly easy and realistic. There are some recent papers that I also recommend reading.

You can also go way back to the originals -- Fournier & Reeves, Peachey -- and use trochoids (which do LOD well, for example):

Hinsinger et al, "Interactive animation of ocean waves," 2002

For ripples and wakes, the following paper will give a good understanding of what''s going on, although it''s probably too slow for real time:

Loviscach, "A convolution-based algorithm for animated water waves," 2002

Finally, another recent paper discussed choosing the waves spectrum based on real-world information, either an aerial photograph or National Weather Service buoy data. This is an interesting alternative to tweaking with some of the oceanographic spectrum functions:

Thon & Ghazanfarpour, "Ocean waves synthesis and animation using real world information," 2002

Share this post


Link to post
Share on other sites
All those papers are on animating water, not rendering it.

I''m curious, Yann, do you have glittering waves near the horizon? The Hinsinger paper mentions implementing a shader following [Fournier 92: Normal distribution functions and multiple surfaces] but I haven''t gotten around to looking up what they''re talking about.

Share this post


Link to post
Share on other sites
Rendering is a whole different matter.

quote:

I''m curious, Yann, do you have glittering waves near the horizon? The Hinsinger paper mentions implementing a shader following [Fournier 92: Normal distribution functions and multiple surfaces] but I haven''t gotten around to looking up what they''re talking about.


Me neither, haven''t read the paper yet. My waves kind of glitters when the sun strikes them, but that''s the standard perpixel specular shader effect (you know, the typical viewdependent long cone of glittering water, going from the view to the horizon when the sun is low). Other than that, there is a slight glitter from the reflected environment (sky + atmos), which gets stronger towards the horizon due to the smaller Fresnel viewangle.

I don''t know if that is what the Hinsinger paper is talking about, though. Hmm, do you have a screenshot of that effect ? (or is there one in the paper ?)

Share this post


Link to post
Share on other sites
I had a go at the FFT version of ocean waves (from a paper that i can''t remember, but I''d say it is well known). Lets just say it didn''t work . But I think I will have another go at it, I''m not ready for Navier Stokes yet.

Share this post


Link to post
Share on other sites
RobertC, there are two FFT implementations out there that I know of. Here and here. The paper by Jos Stam "A simple fluid solver based on the FFT" has some useful sample code as well.

Share this post


Link to post
Share on other sites
I''ve never tried any water techniques or any advanced graphics stuff, never even done shaders. But i was just wondering how the water was done in Super Mario Sunshine on Gamecube?

Share this post


Link to post
Share on other sites
quote:

But i was just wondering how the water was done in Super Mario Sunshine on Gamecube?


Screenshot ?

Share this post


Link to post
Share on other sites
By rendering all underwater elements into the framebuffer, then distorting it, then drawing all the other elements in the scene, is my (somewhat educated) guess.

It seems that GameCube games really like using this effect - I''ve seen it in Mario Sunshine, Rogue Leader, Metroid Prime, Star Fox Adventures, Wave Race...

Perhaps the GameCube hardware makes it really easy to do framebuffer distortion like this?

j

Share this post


Link to post
Share on other sites
that thing is called environmental bumped mapping, or so.. in the 3dmark2001 demo included as well in the nature scene, where you see the lake..

and yes, its very simple if hw supports it. there was support on old matrox'', and on all radeons. nvidia came quite late to support on the gf3. and yes, the gc has support for it..

very simple technique, but quite neat looking. now i just want to go home to look at 3dmark2003 to see the water with pixelshader2.0 done:D its told to look awesome..:D

"take a look around" - limp bizkit
www.google.com

Share this post


Link to post
Share on other sites
I have been trying to find out how to do environment bump mapped water for some time now, but can''t find anything on the net about it.

My current approach is to render the reflected scene to a texture and use that as my water texture (using projective texturing) combined with a bump map (as seen on the bumpwaves dx9 example).

Are there any alternative methods?

Share this post


Link to post
Share on other sites
I know that it''s easy to get access to the back buffer on both XBox and PS2 hardware, so those distortion effects are relatively easy to do (compared with using DX on a PC). I guess the Gamecube has similarly easy access to the back buffer...

If you''ve got a fixed platform, there''s not much reason for restricting something like that

Share this post


Link to post
Share on other sites
As a follow up question; does anyone know how to setup the texture matrix to map the reflection texture to the screen?

What I want is simply to map a 4:3 texture directly onto a 4:3 screen, where the corners of the texture map to the corners of the screen.

The dx9 example I mentioned before uses this logic:


  
// Set up projected texture coordinates

// tu = (0.8x + 0.5z) / z

// tv = (0.8y - 0.5z) / z

D3DXMATRIXA16 mat;
mat._11 = 0.8f; mat._12 = 0.0f; mat._13 = 0.0f;
mat._21 = 0.0f; mat._22 = 0.8f; mat._23 = 0.0f;
mat._31 = 0.5f; mat._32 =-0.5f; mat._33 = 1.0f;
mat._41 = 0.0f; mat._42 = 0.0f; mat._43 = 0.0f;

m_pd3dDevice->SetTransform( D3DTS_TEXTURE1, &mat );


However, I suspect this only maps the texture to half of the screen. Does anyone have any experience with this kind of thing?

Thanks in advance!

[edited by - axeman13 on February 13, 2003 6:13:18 PM]

Share this post


Link to post
Share on other sites

  • Advertisement