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

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #30 on: December 01, 2011, 04:22:09 am »

Can you show it?
The frequency is constant, distance affects only the phase. Amplitude is modulated on both ends - on large distances from shore it starts slowly from zero, and then once on the land it falls back to zero more quickly. The constants are specific to the sizes of our tiles.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #31 on: December 01, 2011, 07:32:38 am »


I've color-coded wave height with red, so you can see it distinctly. The 'disconnected' wave is circled with blue.
The effect appears mostly when the shore is very gentle.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #32 on: December 01, 2011, 08:36:50 am »

I see, yes it's a problem with gentle slopes. Did you try to attenuate it with the distance inland? I've got this voodoo for it there:

  amp *= saturate((0.6-w)*10);

With w being the signed distance to shore, >0 on land, <0 on water.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #33 on: December 01, 2011, 09:15:04 am »

Yes, I tried different attenuations.
I am currently using exponent, but, perhaps, will switch to your magic instead and experiment with some parameters :)
« Last Edit: December 01, 2011, 09:24:58 am by Aekold »
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #34 on: December 01, 2011, 09:25:39 am »

It still doesn't solve all the cases. The problem is the slope, but I'm thinking that something could be done about it. Once inland, the skew could be computed so that the trailing part of the wave matches the slope of the shore, or interpolates towards it. Together with the attenuation it would mean that as long as the peak is above terrain, the trailing part is too.
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #35 on: December 01, 2011, 01:51:36 pm »

Might work! Please, let me know if you find something
Logged

Aekold

  • Jr. Member
  • *
  • Posts: 23
  • newbie
Re: Ocean rendering
« Reply #36 on: December 03, 2011, 04:51:03 am »

I've got one more question about wave shape. Do you render waves which cannot be described as a height function y = f(x)? E.g., when gamma is 0.5, for x = 0 there two y values of the curve. How do you handle this? Or you just use gamma values when for any x there is only single y = f(x) value?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #37 on: December 03, 2011, 05:17:57 am »

I limited the function parameters to ones where the function is not multivalued, as it would cause graphical glitches anyway. Else, I'm generating the profiles at startup using Newton-Rhapson method, that will end up in one of the solutions, depending on the initial conditions, and thus it would not be well-defined.
Logged

xieweibo

  • Newbie
  • Posts: 4
  • newbie
Re: Ocean rendering
« Reply #38 on: October 30, 2014, 08:09:34 am »

Hi,
The shore wave and foam is great, Would you give some details(maybe some shader code) for the shore foam which looks really realistic.:)
I had tried the shore wave and get the basic shore wave workable, but they are continue all around the shore, I notice you use another texture to avoid this, would give some information of this(What the texture should be, how does change with time?)
Thank you very much.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #39 on: October 30, 2014, 11:31:26 am »

First, there are two separate shore wave frequencies, and the one to use at given place is selected using a helper texture that contains islands of values from -1 to 1, but usually its 0.

This texture that breaks the continuous shore waves is generated procedurally, and is made of a bunch of randomly generated circular gaussian peaks which are initially generated (position, size, positive or negative amplitude), and then rendered into the texture over their lifetime, growing from 0 to peak amplitude and back. After the peak falls back to zero, new peak parameters are generated and the peak starts appearing somewhere else. These peaks correspond to the shore waves appearing and disappearing

Pixels in the texture are rendered using the following equation:

Code: [Select]
float v=0;
for each active peak:
    //this is to make it seamless
    vec2 p = abs(texcoords - peak_coords);
    p = min(p, abs(p-1));

    float d = dot(p, p);
    v += amp * exp2(-d*inv_peak_size);
Logged

xieweibo

  • Newbie
  • Posts: 4
  • newbie
Re: Ocean rendering
« Reply #40 on: October 30, 2014, 11:00:12 pm »

Thanks for your kindly reply.
Now, I basically understood how to break continue shore wave, still some thing need to confirm.
The procedure is tiled for the whole terrain? How to solve peaks overlap?(Use alpha blend?)

For the foam in attachment(I don't know how to insert an image, sorry) would give some detail, it's really beautiful.(Some shader code and related texture).
Thanks a lot.
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #41 on: November 01, 2014, 10:54:25 am »

Yes it's tiled for the whole terrain, it does not have any information that's terrain specific - it's just a mask that breaks the surf waves.

Our foam textures can be found in textures/terrain folder, it either applies to wave peaks or to water close to the shore, nothing special shader-wise.
Logged

xieweibo

  • Newbie
  • Posts: 4
  • newbie
Re: Ocean rendering
« Reply #42 on: November 03, 2014, 08:42:48 pm »

Thanks a lot. :)
I'll have a try. I still have 2 quaestions:
1.Where was the gradient of distance map used?
2.For the shore wave it's normal is different from ambient wave, is some special operations to solve this?
Logged

cameni

  • Brano Kemen
  • Outerra Administrator
  • Hero Member
  • *****
  • Posts: 6721
  • No sense of urgency.
    • outerra.com
Re: Ocean rendering
« Reply #43 on: November 04, 2014, 12:47:17 am »

1.Where was the gradient of distance map used?
In the lookup into the foam textures, which are animated in the direction of the shore. The coordinates are computed as C*time*gradient + static tile coordinates.

Quote
2.For the shore wave it's normal is different from ambient wave, is some special operations to solve this?
Not sure what you mean here; the surf waves are skewing towards the shore as described on the blog, which is done using the distance-to-shore map.
Logged

xieweibo

  • Newbie
  • Posts: 4
  • newbie
Re: Ocean rendering
« Reply #44 on: November 04, 2014, 02:08:05 am »

Quote
2.For the shore wave it's normal is different from ambient wave, is some special operations to solve this?
Not sure what you mean here; the surf waves are skewing towards the shore as described on the blog, which is done using the distance-to-shore map.

I mean there is an ambient wave, for the shore it's another wave, each wave have different normal, how do you solve this?
Logged
Pages: 1 2 [3] 4