1
0
Fork 0

Continuous water coloring between ocean and inland

This commit is contained in:
Thorsten Renk 2014-11-12 09:16:32 +02:00
parent fd99fb29d0
commit 77e382be75
2 changed files with 44 additions and 27 deletions

View file

@ -51,6 +51,14 @@
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<texture n="7">
<image>Textures/Globe/ocean_depth_1.png</image>
<type>2d</type>
<filter>linear-mipmap-linear</filter>
<wrap-s>repeat</wrap-s>
<wrap-t>repeat</wrap-t>
<internal-format>normalized</internal-format>
</texture>
<normalmap_dds type="float">0.0</normalmap_dds>
<saturation>
<use>/rendering/scene/saturation</use>
@ -315,6 +323,27 @@
<use>texture[3]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>4</unit>
<image>
<use>texture[7]/image</use>
</image>
<type>
<use>texture[7]/type</use>
</type>
<filter>
<use>texture[7]/filter</use>
</filter>
<wrap-s>
<use>texture[7]/wrap-s</use>
</wrap-s>
<wrap-t>
<use>texture[7]/wrap-t</use>
</wrap-t>
<internal-format>
<use>texture[7]/internal-format</use>
</internal-format>
</texture-unit>
<texture-unit>
<unit>5</unit>
<image>

View file

@ -361,15 +361,11 @@ void main(void)
refl.g = refl.g * (0.9 + 0.2* noise_2500m);
if (ocean_flag ==1) // use depth information
{
refl.rgb = mix(refl.rgb, 0.65* floorColour, floorMixFactor);
refl.rgb = refl.rgb * (0.5 + 0.5 * smoothstep(0.0,0.3,topoTexel.a));
}
else
{
refl.rgb = 1.3 * refl.rgb;
}
// 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));
float intensity;
// de-saturate for reduced light
@ -537,14 +533,22 @@ void main(void)
finalColor.rgb = rayleigh_out_shift(finalColor.rgb,outscatter);
}
// Rayleigh color shift due to in-scattering
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
float lightIntensity = length(gl_Color.rgb)/1.73 * rShade;
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity;
float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z);
if ((quality_level > 5) && (tquality_level > 5))
{finalColor.rgb = mix(finalColor.rgb, rayleighColor, rayleighStrength);}
// here comes the terrain haze model
float delta_z = hazeLayerAltitude - eye_alt;
//if (dist > 40.0)
if (dist > 0.04 * min(visibility,avisibility))
{
@ -683,26 +687,10 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothstep(0.5,0.9,eqColorFactor))));
}
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
float lightIntensity = length(gl_Color.rgb)/1.73 * rShade;
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity;
float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z);
if ((quality_level > 5) && (tquality_level > 5))
{finalColor.rgb = mix(finalColor.rgb, rayleighColor, rayleighStrength);}
finalColor.rgb = mix(eqColorFactor * hazeColor * eShade +secondary_light * fog_backscatter(avisibility), finalColor.rgb,transmission);
}
else
{
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
float lightIntensity = length(gl_Color.rgb)/1.73 * rShade;
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity;
float rayleighStrength = rayleigh_in_func(dist, air_pollution, avisibility/max(lightIntensity,0.05), eye_alt, eye_alt + relPos.z);
if ((quality_level > 5) && (tquality_level > 5))
{finalColor.rgb = mix(finalColor.rgb, rayleighColor, rayleighStrength);}
}
gl_FragColor = finalColor;