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 52049 times)

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #15 on: November 25, 2011, 01:24:23 am »

Thank you for your detailed answers!
How do you calculate foam factor (how much foam you should render) near the shore? Do you use world depth or screen-space depth?
If first, how do you pass to to the GPU and how to you store it, if second, how do you avoid different foam factors at different view angles as it is here:
http://www.youtube.com/watch?feature=player_detailpage&v=UMHgBplll8Q#t=202s
(watch from 3:22)
?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #16 on: November 25, 2011, 10:30:08 am »

Hmm, I'm simply using the distance map to shore to determine the static foam factor, combining it with dynamic foam strength value stored as the second channel in the wave profile texture.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #17 on: November 28, 2011, 10:06:44 am »

How do you define the shape of the wave? Is it deformed by the distance field or is the center of the wave always ahead of the side parts?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #18 on: November 28, 2011, 10:39:25 am »

I'm not sure what you mean here. The distance determines the shape, as it serves as the second coordinate into the trochoid shape texture.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #19 on: November 28, 2011, 04:13:41 pm »

I mean not the profile, but the shape of the wave front (i.e., projection of the wave of the ocean plane).
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #20 on: November 29, 2011, 03:58:41 am »

Um, maybe I didn't explain myself clearly. Let me describe the process again:
  • water geometry comes in the form of quad-tree meshes, same as terrain, except it's all on sea level
  • vertex shader takes the coordinates of current vertex and looks up the distance to shore in the distance map
  • using this distance, current time, current sea depth and some timing constants it fetches the wave height from the trochoid texture, as I described earlier
  • the obtained height is subjected to some filtering, attenuation if it's inland etc, and it's used to displace the input sea-plane coordinates in the direction of the normal vector
That's essentially all there is. The waves appear as the result of this algorithm.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #21 on: November 29, 2011, 05:47:14 am »

So, the wave is not a separate object, right?
How do you achieve then that the waves appear separately, not in a continuous front?
Logged

cameni

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

No, it's not a separate object. I wrote about why they appear separately earlier here:
... 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 rhythm 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.

It's the second map that creates batches of waves out of the uniform waves concentric around the shores (con-shoric waves? :D), that smoothly emerge and then vanish, being randomly replaced by another batch with a different phase and slightly different frequency and wave speed.

I should really write a paper about it :)
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #23 on: November 29, 2011, 06:55:16 am »

Thanks for your patience!
Quote
I should really write a paper about it
Well, that would be super great! I would volunteer to review it then :)
Logged

Aekold

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

It's the second map that creates batches of waves out of the uniform waves concentric around the shores (con-shoric waves? :D), that smoothly emerge and then vanish, being randomly replaced by another batch with a different phase and slightly different frequency and wave speed.
Could you please give some more hints about this batch map, how to create and animate it?
Some more formulas on that would be really valuable :)
Logged

cameni

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

The goal is simple, to generate a tileable map that contains values used for wave selection and modulation. I'm generating a few random positions in the map, together with the values for peak width and amplitude. Using the position, width and amplitude, the peaks are rendered into the texture (or, rather, a contribution of each peak is accumulated for each pixel) using the following equation:
dx = x - xp;
dy = y - yp;
h = A*exp(-(dx*dx + dy*dy)/W)

(It's not cut, I don't know how to set the z-range in Wolfram Alpha)

Since it's just a single channel, I'm using positive/negative amplitudes to select from two wave functions, giving appearance of multiple non-uniform waves.
The amplitudes are also animated - when a peak is generated, it's amplitude is initially set to 0, slowly changing to the desired amplitude over time and then back to zero. Once it reaches zero, another set of parameters is generated.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #26 on: November 30, 2011, 07:13:20 am »

Huh, so simple :) Thanks!
I was trying to paraemterize the wave along the wavefront - that's a devil)
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #27 on: November 30, 2011, 07:59:31 am »

Tried that one too, no way :)
It's impossible to get the second coordinate (along the contour, the first one being the shore distance). Nothing that would be continuous and universal.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #28 on: November 30, 2011, 08:43:10 am »

Well, if the islands, generating shore waves, are well away enough, you could.
You can put the circle center in the middle and stretch it from inside until it hits the shoreline. Then you can use original angular coord from the circle to parameterize the shoreline. You can then normalize it by calculating the shoreline perimeter and adjusting coords according to real distance (so they are not overstretched or overshrinked due to relief). Then you can continue dilating it radially to spread the same coords to the shore waters.
Should work even if the island is not convex.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #29 on: December 01, 2011, 04:08:21 am »

Do you modify the wave's frequency dependant on depth/distance in the point? Or do you modify only the amplitude? If yes, how?
I've got an issue with a wave, disconnecting from ocean.
« Last Edit: December 01, 2011, 04:15:27 am by Aekold »
Logged
Pages: 1 [2] 3 4