Ripples and Stuff

Started by
17 comments, last by Tokage 21 years, 1 month ago
Hi, I''m the original poster.

I''m mainly just using this for fun. I heard along the grapevine that there''s a way to simulate ripples using sums of sine functions. Is that hard too?

What FAQ are you referring to? Is it on GameDev?

Thank you all for being so helpful. This is why I love these forums.
Advertisement
quote:
I''m mainly just using this for fun. I heard along the grapevine that there''s a way to simulate ripples using sums of sine functions. Is that hard too?

No, not really. But it ultimately depends on how realistic you want your water animation to be. Perhaps you should have a look into Fourier synthesis, the results are quite nice, esp. on large water bodies such as lakes.

quote:
What FAQ are you referring to? Is it on GameDev?

The FAQ of this forum: click.
quote:Original post by jdi
Of course there are better ways of doing it. But I wouldn''t call it a "Perchance mathematical glitch." Mathematics doesn''t have glitches.


However the mathematics is not presented on that web page. This is why I recommended the convolution paper, which properly presents the mathematics, and lets the implementer choose how expensive a filter to use.

If you (the original poster) are having bugs implementing the algorithm, are you writing into the same array you are reading from? That''s the simplest bug I can think of. I do recommend reading the paper -- I think it is better than solving the Navier Stokes equations when you just want ripples.
greeneggs, do you have a link to that convolution paper ? I can't seem to find a free download.

Although the convolution approach is easier to code and offers better performance than the NSE, it is pretty unstable in my experience. Unless you apply a really large damping factor, but that makes the waves fade out to quickly. If you want nice long lasting waves, with interference and all, the convolution dataset tends to degenerate into wild high frequency oscillations, and it's pretty much impossible to recover (other than zeroing out the whole heightfield). It also creates those unrealistic high frequency noise around circular wavefronts.

Or does the paper you mentioned provide a solution to those problems ? I guess using a wider filter kernel will probably solve the noise problem, it will also reduce performance.


[edited by - Yann L on March 19, 2003 1:56:59 PM]
The code at

http://freespace.virgin.net/hugo.elias/graphics/x_water.htm

is based on a spring model and works really well for generic water waves.

Here is a site with lots of water stuff:

http://www.vterrain.org/Water/
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
link

It is very slow with a wide filter, yes, but understanding how this works should be very helpful in implementing and extending the simple hugo.elias model.
Just wanted to mention that the code mentioned here: http://freespace.virgin.net/hugo.elias/graphics/x_water.htm isn''t a "mathmatical glitch" but rather is a simplified version of a discrete forward differencing approximation of a mass/spring system. The book "Game Programming Gems 2" has an article on it, but it takes into account grid size, wave speed and delta time (instead of being frame based). If you look at their final equations however, with the right constants you get EXACTLY the same equation used in the x_water article.
I''ve used this system for surface waves but I''ve run into problems (especially with low resolution simulations, say 64x64) with ripples being oddly shaped and have run into stability issues as well. For these reasons I will probably switch to a 2D NSE solver and the results should be much better.
Thank you all very much for all this information. Would anyone recommend the "Game Programming Gems" series for someone realtively (but not totally) new to game programming? If so, which one(s)?
quote:Original post by Tokage
Thank you all very much for all this information. Would anyone recommend the "Game Programming Gems" series for someone realtively (but not totally) new to game programming? If so, which one(s)?


Get all three =). If you order directly from the publisher you can get all 3 for the price of 2. Be aware that they're not exclusively focused on graphics though(a strength if you ask me). Great books!

edit:
To answer your question, the first book probably has the most newbe-ish to game programming stuff.

Chapel

[edited by - Chapel on March 19, 2003 10:10:22 PM]

This topic is closed to new replies.

Advertisement