About Store Forum Documentation Contact



Post Reply 
Ocean depth issue
Author Message
Dwight Offline
Silver Supporter

Post: #1
Ocean depth issue
Hello all,

I am having an issue which I am unable to find a solution for at the moment. I draw a world with an ocean like so:
Code:
void initWater()
{
   Water.draw = true;
   Water.wave_scale = 0.8f;
   Water.plane.set(Vec(0, 0, 0),Vec(0, 1, 0));
   Water.colorMap(UID(175945753, 1318862614, 1168212879, 52360947)).normalMap(UID(277242192, 1333697279, 1115435417, 3862791069));
   Water.density=0.125f;
   Water.scale_normal= 4.0f;
   Water.scale_color = 4.0f;
   Water.scale_bump = 100.0f;
   Water.reflect_tex = 0.150;
   Water.refract = 0.100f;
   Water.specular = 1.500f;
   Water.wave_scale = 0.250f;
   Water.rough = 3.000f;
   Water.refract = 0.500f;
  
}

And with an update function that includes:
Code:
Water         .update(-Vec2(0.05));
Water.plane.set(Vec(0, (Abs(sin(Time.curTime())/20)) - 0.2f, 0),Vec(0, 1, 0));

The ocean gets rendered nicely and moves up and down, but when I place the camera only slightly below the ocean's plane, I get the issue as shown in the screenshot attached.

I do not have this issue if I create a large water plane in the editor and have that rendered in the game.

What could cause this? Can anyone reproduce the issue if its a bug?

EDIT #1 : I found out that the issue lies with the setting of the colorMap. If I remove that and set the color manually, it works as expected. How can the setting of a colormap cause this issue?


Attached File(s) Image(s)
   
(This post was last modified: 02-27-2018 03:55 PM by Dwight.)
02-27-2018 02:58 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Ocean depth issue
Hi, could you please attach a sample test case
*.EsenthelProject

Also what is the issue you are experiencing?

Thank you
02-28-2018 12:38 AM
Find all posts by this user Quote this message in a reply
Dwight Offline
Silver Supporter

Post: #3
RE: Ocean depth issue
(02-28-2018 12:38 AM)Esenthel Wrote:  Hi, could you please attach a sample test case
*.EsenthelProject

Also what is the issue you are experiencing?

Thank you

In the aforementioned screenshot, when I place the camera slightly below the water surface, there is no effect like this (in this screenshot, I commented out the colorMap):


Attached File(s) Image(s)
   
02-28-2018 10:22 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Ocean depth issue
The bump map is stored in the color map, so without it, the bump will have different values then with it.
Bump is used for wave generation, moving water up and down, according to WaterMtrl.wave_scale
02-28-2018 09:14 PM
Find all posts by this user Quote this message in a reply
Dwight Offline
Silver Supporter

Post: #5
RE: Ocean depth issue
The issue that I am also seeing is that the shader is not being drawn correctly as soon as I apply a colorMap to the water (the blue-ish teint when going under water).

When I do not apply a colorMap, the Shader gets drawn nicely as seen in screenshot 2. However when I apply the colorMap, as seen in screenshot 1, the blue "underwater" teint does not show in the first few centimeters under the water surface if I place the camera there.
02-28-2018 10:40 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: Ocean depth issue
To get the same results as without a color map, try setting WaterMtrl.wave_scale to 0 or set the bump map to have pixel color values 128 (neutral) out of 0..255 range.
If this doesn't solve the problem, please attach *.EsenthelProject so I can test it myself.
03-01-2018 08:53 PM
Find all posts by this user Quote this message in a reply
Post Reply