1
0
Fork 0

I forgot that the ocean depth was in the alpha channel but work around that by using the RGB colors to do the same

This commit is contained in:
Erik Hofman 2021-05-02 13:01:52 +02:00
parent f4edb0e362
commit d145a52ac1

View file

@ -220,7 +220,9 @@ void main(void)
// get depth map
vec4 topoTexel = texture2D(topo_map, TopoUV);
float floorMixFactor = smoothstep(0.3, 0.985, topoTexel.a);
float topoTexel_a = (topoTexel.r+topoTexel.g+topoTexel.b);
topoTexel_a = topoTexel_a*topoTexel_a;
float floorMixFactor = smoothstep(0.3, 0.985, topoTexel_a);
vec3 floorColour = topoTexel.rgb;
mat4 RotationMatrix;
@ -372,7 +374,7 @@ void main(void)
// the depth map works perfectly fine for both ocean and inland water texels
refl.rgb = mix(refl.rgb, 0.65* floorColour, floorMixFactor);
refl.rgb = refl.rgb * (0.5 + 0.5 * smoothstep(0.0,0.3,topoTexel.a));
refl.rgb = refl.rgb * (0.5 + 0.5 * smoothstep(0.0,0.3,topoTexel_a));
float intensity;
@ -518,12 +520,12 @@ void main(void)
surfFact += washStrength;
if ((windEffect >= 8.0) || (steepness < 0.999) || (topoTexel.a > 0.98) || (washStrength > 0.5))
if ((windEffect >= 8.0) || (steepness < 0.999) || (topoTexel_a > 0.98) || (washStrength > 0.5))
{
if ((waveSlope > 0.0) && (ocean_flag ==1))
{
surfFact = surfFact +(1.0 -smoothstep(0.97,1.0,steepness));
surfFact += 0.5 * smoothstep(0.98,1.0,topoTexel.a);
surfFact += 0.5 * smoothstep(0.98,1.0,topoTexel_a);
}
waveSlope = waveSlope + 2.0 * surfFact;