Sign in to follow this  
jmpep

Deep water simulation

Recommended Posts

Hi all!

 

I am currently engaged with learning more about deep water simulations. I have just began to scratch the surface but there is one thing I have been wondering for a while: why most modern methods compute the inverse fft in realtime instead of precomputing one (or several) animated textures and use them as vertex displacement textures? Is it actually more efficient to compute the IFFT in realtime than simply fetching from the textures?

 

I can think of a pretty good reason which is that a texture for a 256x256 grid with a periodicity of 30 seconds, at 30 fps that would be: 3 * 30 * 30 * 256 * 256 bytes  =  177 megabytes. I don't know what the usual memory budget for a thing like this is so I don't know if that might be too much. Is this the reason for computing the IFFT in realtime or am I missing something?

 

Thanks in advance!

 

Javier

Share this post


Link to post
Share on other sites

Of course it is the reason. Also you get another problem that is much worse :

 

your baked animation will be tiled and repeated !

Not only, it is very difficult to MAKE it tileable in space, but you must also make it repeatable in TIME, and those are 2 pretty crazy stuff to have correctly.

 

In the era of shader model 2 (c.f AMD render monkey, ocean sample), water was indeed made using baked animated noise.

 

Also, about huge textures, think about the bandwidth, not only the memory is great, but today's graphic cards are limited by memory bandwidth rather than raw ALU.

Share this post


Link to post
Share on other sites

Thanks for answering, Lightness1024! I had lost hope :)

 

Tessendorf's method actually results in seamlessly tileable textures, so that's not really a problem. Not sure about whether it is periodic in time or not. I mean, it must be, since the waves comes from the IFFT of the spectra, but the period might be too long, I don't know.

 

About the bandwidth, the texture is big, but you only read a small, coherent part from it each frame, so I though that wouldn't be such an issue? Except upon uploading it, of course.

 

But yeah, between the memory amount and the periodicity problem you pointed out I guess there's enough reason not to go there and try :)

Share this post


Link to post
Share on other sites

Well, coherent depends on what kind of swizzling the hardware excpects, or tiling. But it will affect latency only. if the quantity is small its still ok. Also the ALU is mostly underutilized nowadays, so it can be OK to load it with some heavy stuff if you dont have other heavy stuff more important on the side :) (like voxel tracing, or volumetric rendering etc) depends on the budget...

Share this post


Link to post
Share on other sites

You do realize that if you plan to simulate underwater life you need to apply certain laws of physics and that it will be one hell of a work? Mostly because it's difficult to test it on yourself and many things we know just from reading how they work. However it's not impossible and it would be interesting to see.

 

Here is an old thread about Bullet underwater simulation. It's not perfect, it's dead but still has some info you may find useful. http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=5714  Here is one more http://forum.unity3d.com/threads/underwater-physics.16797/ and finally something about basic floating and how objects react http://www.scienceclarified.com/Bi-Ca/Buoyancy.html

Share this post


Link to post
Share on other sites

You do realize that if you plan to simulate underwater life you need to apply certain laws of physics and that it will be one hell of a work? Mostly because it's difficult to test it on yourself and many things we know just from reading how they work. However it's not impossible and it would be interesting to see.

 

Here is an old thread about Bullet underwater simulation. It's not perfect, it's dead but still has some info you may find useful. http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?t=5714  Here is one more http://forum.unity3d.com/threads/underwater-physics.16797/ and finally something about basic floating and how objects react http://www.scienceclarified.com/Bi-Ca/Buoyancy.html

 

Where do you see the word "life" in the thread? Seems to me that it's about rendering deep water waves... and implementing Tessendorf waves isn't that hard. A bit frustrating to get it right, and hard to optimize, as with most nontrivial things, but not conceptually difficult.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this