Outerra forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Download Outerra Tech Demo. Unofficial Outerra Discord server, MicroProse Discord server for OWS.

Pages: [1] 2 3 4

Author Topic: Ocean rendering  (Read 52046 times)

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Ocean rendering
« on: November 22, 2011, 07:44:45 am »

Which technology do you use for the foam rendering? Do you have any ideas how to make breaking waves?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #1 on: November 22, 2011, 09:33:50 am »

Foam is just a moving texture applied to areas with steep slope, with rising probability as the water gets closer to a shore. Geometry of waves is rather simple at the moment, it's basically a heightfield without overhangs, it only makes an illusion of breaking wave. Full breaking waves would need to be modeled better, or the front part would have to be modeled as an addition to the existing water shape.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #2 on: November 22, 2011, 09:51:36 am »

You wrote that you store the wave profile for different skew factors. Do I understand correctly that this is an array of 1D periodic functions?
If yes, how you then convert it to the 2D height function when you need to create a shore wave depending on the distance field value?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #3 on: November 22, 2011, 10:11:37 am »

Yes, it's an array of 1D functions, but stored as a 2D texture, so that it's interpolated when you perform a lookup to it using the wave position and skew factor. So for the given point you compute the current position within the wave sample, and its skew factor (from distance to shore and depth, and current time). This creates waves moving synchronously towards the shore, with changing front as they near the land. To break up the artificial synchronous rhytm there's another random map generated, that's also changing over time, that basically controls selection from multiple such waves (each with a slightly different period, wave speed etc) coherently for continuous 10-20m regions.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #4 on: November 23, 2011, 07:52:10 am »

Thanks!
I try to experiment with the skewed trochoidals - what is the sensible range for parameters b and gamma?
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #5 on: November 23, 2011, 08:01:19 am »

i. e., which parameters were used to generate the wave profile here:
http://1.bp.blogspot.com/-JgtSygJ9i0k/TV13w2tPXUI/AAAAAAAAAFw/T77xJGYLuC4/s1600/trochoid2.gif
?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #6 on: November 23, 2011, 08:21:19 am »

I used Microsoft Mathematics to visualize and tune the waves, with this equation:

Code: [Select]
show2d(plotparam2d(t-0.05sin(2pi(t-floor(t))^0.4),0.25cos(2pi(t-floor(t))^0.4),{t, 0, 10},{x, 0, 10},{y, -1, 1}),{x, 0, 10},{y, -1, 1})
b should be something small, like the 0.05 there, to avoid overhangs. Gamma 0..1
You can toy with the parameters there, to see how it looks.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #7 on: November 23, 2011, 09:20:01 am »

« Last Edit: November 23, 2011, 09:50:09 am by cameni »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #8 on: November 23, 2011, 09:49:22 am »

Yes, I would use Wolfram today :)
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #9 on: November 24, 2011, 08:54:53 am »

How do you keep the computational time reasonable? Do you calculate only those shore waves inside a frustum? If yes, are they all synchronized so an observer can rotate his head forth and back and see a correctly travelled (while an observer was not seeing it => it was not processed) wave?
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #10 on: November 24, 2011, 10:09:00 am »

One more question: do you increase a frequency as a wave approaches a shore?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #11 on: November 24, 2011, 11:06:46 am »

The shore waves are only computed for tiles that actually touch the shore. Open sea waves are always computed, and then superimposed over the beach waves.

The wave computation is stateless - the wave height only depends on the current time, distance to shore and water depth, but not on the previous values of height or the neighboring points. A full simulation would be too heavy.

Increasing the frequency with shortening distance - would be possible, but it may introduce a shear effect. Variables that continuously change can have various ugly effects with this approach, for example the gradient map must be sampled in a discrete manner when used for foam rendering, otherwise the apparent foam movement will have wild directions. Took me a while to figure out, too.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #12 on: November 24, 2011, 11:32:09 am »

Interesting to notice, thanks!
Let me clarify one point.
Say you have a large island with a very long shoreline - will you generate all the shore waves on the tiles, touching the shores or only for the visible tiles?
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #13 on: November 24, 2011, 11:41:09 am »

I also wonder how you resolve an issue when a shore wave meets the shoreline. I've got a problem that it 'disconnects' from the ocean and continues running through the beach. On youtube videos from Outerra I've seen that this does not happens there, so it creates a nice surf effect. How do you achieve this?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #14 on: November 24, 2011, 12:55:18 pm »

Interesting to notice, thanks!
Let me clarify one point.
Say you have a large island with a very long shoreline - will you generate all the shore waves on the tiles, touching the shores or only for the visible tiles?
Only the visible ones. Or better said, only the visible ones that need the level of detail.

Quote
I also wonder how you resolve an issue when a shore wave meets the shoreline. I've got a problem that it 'disconnects' from the ocean and continues running through the beach. On youtube videos from Outerra I've seen that this does not happens there, so it creates a nice surf effect. How do you achieve this?
Two things - tuning the slope of the trailing part of the wave, so that it's lower than some average shore steepness, and attenuating the wave when it goes inland. The issue still occasionally appears here and there though.
Logged
Pages: [1] 2 3 4