PDA

View Full Version : Ocean Waves a la Gerstner

 Mic_Ma09-22-2008, 01:08 AMHas anybody tried to simulate an ocean surface using Gerstner Waves in ICE?　↓ http://www-viz.tamu.edu/students/jd/658/T_algorithms.html I've made single wave trains so far but I find that they don't look all that different from bog standard sine waves. They also appear to be exquisitely sensitive in their x,z movement with respect to wave amplitude. I wonder if anybody has experience with this and could tell me if the Gerstner approach is worth the trouble and render time (ultimately I want it in realtime).
CiaranM
09-22-2008, 02:14 AM
Patrick Boucher did:
http://www.xsi-blog.com/archives/273

Mic_Ma
09-22-2008, 02:47 AM
Patrick Boucher did:
http://www.xsi-blog.com/archives/273

Yes, it's nice but he doesn't explain it though... Summing up sine waves, adding noise and disturbing horizontal positions gives not unlike results.

Per-Anders
09-22-2008, 03:18 AM
It's very simple, just overlay (sum) the waves at different angles with different frequencies and amplitudes. The paper explains the relationship of frequency and height. The formula simply pushes points away from the trough in the horizontal and up and down in a standard sine pattern against this which when not overdone can give you an okish wave shape.

Here's a very quick knockup thing i did in another app using basic formula deformers and expressions and the described simple approach. It's massively exaggerating the effect of the horizontal motion which makes it look like jello but was there to give emphasis the difference between this and a standard displacement http://www.per-anders.net/general/waves06.mov (the foam was what was more interesting to me though, the waves was 2 minutes work).

To be honest the waveform is pretty hacky, even if you use a correct relationship between the values the result isn't that pleasing for any primary waves (very cg without a lot of tweakage) and it takes more effort than you want to bother with to make it handle shoreline and other colliders in a believable fashion. But it's good for filling in a lot of generic watery areas.

Mic_Ma
09-22-2008, 04:05 AM
OK, thanks Per-Anders.

I do get this &quot;stretchy&quot; effect in the horizontal direction of the troughs but in my case it's extremely exaggerated. (It even &quot;breaks&quot; the mesh when I adjust the amplitude by the tiniest degree, or travels along the scene)

Well, if you think it's hacky too then I'll just keep tweaking it!

Per-Anders
09-22-2008, 05:43 AM
The stretchyness is of course controlled by the strength of the x component formula or the relationship between the amplitude and the magnitude, you'll find formulae for relationships for the amplitude and magnitude further down in the paper that should give reasonable results (I didn't use them in my quick dirty example hence the overexagerated stretch).

Mic_Ma
09-24-2008, 01:04 AM
Thanks, it's working reasonably nice now. I summed up the wave nodes into an okish Ocean that reacts to the ground underneath as well. But one problem I have is that the whole ocean grid is travelling, albeit very slowly, in the world space. This is due to the "stretchy" movements in the horizontal plane. With many waves travelling in different directions they more or less cancel out the effect, but not completely.

Is there a remedy for that? I guess all the x and z movements should eventually summ up to 0.

Per-Anders
09-24-2008, 01:34 AM
There shouldn't be any overall movement, it's a basic sin/cos formula which means the result should always return to the start unless you have some serious rounding errors or incorrectly applied formulae (the formula for each point should not be modified during the cycle, but rather locally based on a predefined weight). As the waves build up the result will be that the smaller waves will amplify and limit the effect of the previous waves in localised areas, the aim is to randomize these nodes as much as possible for a more natural looking effect, you shouldn't end up with all your points static in the xz plane though.

grahamef
09-24-2008, 05:06 PM
Just a thought about the whole grid travelling...

Is your ICE tree in the Simulation region? If so, the effect is based on the previous frame and therefore will be cumulative over time.

You should either store the original point positions and base your calculations off of those, or apply the tree outside of the Simulation region. If you move it below the Simulation region you need to delete the region's marker otherwise the lower regions are not recalculated after the initial state (first frame). If you need the Simulation region for something else (I mean in general, you probably don't in this case) then you can use the Post-simulation region.

Mic_Ma
09-29-2008, 04:56 AM
Oh thanks! That solves a lot of problems! I didn't realize I'd have to delete the marker when I move to a different region! It does indeed get rid of the travelling and other artifacts. Weird, why exactly is that happening?

grahamef
09-29-2008, 06:28 PM
There's a hidden Evolve operator that gets added when you first create a simulated ICE tree on an object. To get rid of that Evolve operator you need to delete the marker.

ThE_JacO
09-29-2008, 11:01 PM
This was probably destined to be an ICE thread from the beginning, but I left it in the main forum because the question had a more general feeling to it.
It's now definitely moved in that direction, so I'm moving it to the ICE forums for you ladies.

CGTalk Moderation
09-29-2008, 11:01 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.