Rayleigh effect reworked with fog illumination as proxy for scene light, small bugfixes
This commit is contained in:
parent
dc791861d2
commit
fddf1edc54
15 changed files with 249 additions and 298 deletions
|
@ -239,6 +239,16 @@
|
|||
<use>quality-level</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>gquality_level</name>
|
||||
<type>int</type>
|
||||
<value><use>quality_level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>tquality_level</name>
|
||||
<type>int</type>
|
||||
<value><use>tquality_level</use></value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>snowlevel</name>
|
||||
<type>float</type>
|
||||
|
|
|
@ -458,6 +458,14 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
|
|||
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
vec3 hazeColor;
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
|
@ -465,8 +473,9 @@ if ((dist < 5000.0)&& (quality_level > 3) && (combined_wetness>0.0))
|
|||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt-340000.0);
|
||||
float lightIntensity = length(diffuse_term.rgb)/1.73 * rShade;
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
//float lightIntensity = length(diffuse_term.rgb)/1.73 * rShade;
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
@ -596,11 +605,6 @@ if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
|||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
|
|
@ -309,16 +309,31 @@ if (quality_level > 3)
|
|||
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length;
|
||||
float outscatter;
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
// Rayleigh color shift due to in-scattering
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
||||
|
@ -425,13 +440,7 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
@ -474,43 +483,16 @@ hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 4
|
|||
|
||||
hazeColor = clamp(hazeColor,0.0,1.0);
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
fragColor.rgb = mix((eqColorFactor * hazeColor * eShade)+secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
|
||||
}
|
||||
else // if dist < threshold no fogging at all
|
||||
{
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -55,12 +55,14 @@ float mie_angle;
|
|||
float shadow_func (in float x, in float y, in float noise, in float dist);
|
||||
float Noise2D(in vec2 coord, in float wavelength);
|
||||
float fog_func (in float targ, in float alt);
|
||||
float alt_factor(in float eye_alt, in float vertex_alt);
|
||||
float light_distance_fading(in float dist);
|
||||
float fog_backscatter(in float avisibility);
|
||||
float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt);
|
||||
|
||||
vec3 searchlight();
|
||||
vec3 landing_light(in float offset);
|
||||
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
|
||||
|
||||
|
||||
float light_func (in float x, in float a, in float b, in float c, in float d, in float e)
|
||||
|
@ -281,6 +283,30 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
|
|||
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shifts
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
// Rayleigh color shift due to in-scattering
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
||||
|
@ -389,13 +415,7 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
@ -439,45 +459,13 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
|
|||
hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator));
|
||||
}
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
fragColor.rgb = mix((eqColorFactor * hazeColor * eShade) +secondary_light * fog_backscatter(avisibility) , fragColor.rgb,transmission);
|
||||
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
|
||||
}
|
||||
else // if dist < threshold no fogging at all
|
||||
{
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -54,11 +54,11 @@ else
|
|||
float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt)
|
||||
{
|
||||
|
||||
float fade_length = avisibility * (2.5 - 2.0 * air_pollution);
|
||||
float fade_length = avisibility * (2.5 - 2.2 * sqrt(air_pollution));
|
||||
|
||||
fade_length = fade_length / alt_factor(eye_alt, vertex_alt);
|
||||
|
||||
return 1.0-exp(-dist/max(35000.0,fade_length));
|
||||
return 1.0-exp(-dist/max(15000.0,fade_length));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -141,6 +141,25 @@ void main()
|
|||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
@ -235,13 +254,7 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
|
||||
|
@ -281,44 +294,17 @@ float shadow = mix( min(1.0 + dot(normal,lightDir),1.0), 1.0, 1.0-smoothstep(0.1
|
|||
hazeColor = mix(shadow * hazeColor, hazeColor, 0.3 + 0.7* smoothstep(250000.0, 400000.0, terminator));
|
||||
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
// determine the right mix of transmission and haze
|
||||
|
||||
|
||||
fragColor.rgb = mix((eqColorFactor * hazeColor * eShade) + secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
}
|
||||
else // if dist < 40.0 no fogging at all
|
||||
{
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -494,12 +494,16 @@ void main (void)
|
|||
|
||||
vec3 hazeColor;
|
||||
|
||||
if (transmission< 1.0)
|
||||
{
|
||||
|
||||
hazeColor.b = light_func(fog_lightArg-0.5, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(fog_lightArg-0.5, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(fog_lightArg-0.5, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * rShade;
|
||||
|
||||
if (transmission< 1.0)
|
||||
{
|
||||
|
||||
|
||||
|
||||
if (fog_lightArg < 10.0)
|
||||
{
|
||||
|
@ -534,8 +538,11 @@ void main (void)
|
|||
|
||||
///BEGIN Rayleigh fog ///
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(light_diffuse.rgb)/1.73 * rShade;
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
|
||||
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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
@ -543,7 +550,6 @@ void main (void)
|
|||
/// END Rayleigh fog
|
||||
|
||||
|
||||
//fragColor = fragColor * smoothstep(-0.05, 0.05, ct);
|
||||
fragColor.rgb = mix(eqColorFactor * hazeColor * fog_earthShade +secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission);
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
|
48
Shaders/rock-ALS.frag
Executable file → Normal file
48
Shaders/rock-ALS.frag
Executable file → Normal file
|
@ -476,12 +476,26 @@ if ((dist < 5000.0) && (combined_wetness>0.0))
|
|||
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
@ -591,13 +605,9 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
@ -642,40 +652,14 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
|
|||
}
|
||||
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
|
||||
fragColor.rgb = mix(eqColorFactor * hazeColor * eShade , fragColor.rgb,transmission);
|
||||
|
||||
//fragColor.rgb = intensity_perception(fragColor);
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
|
||||
}
|
||||
else // if dist < threshold no fogging at all
|
||||
{
|
||||
//fragColor.rgb = intensity_perception(fragColor);
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,14 @@ float shadow_func (in float x, in float y, in float noise, in float dist);
|
|||
float Noise2D(in vec2 coord, in float wavelength);
|
||||
float DotNoise2D(in vec2 coord, in float wavelength, in float fractionalMaxDotSize, in float dot_density);
|
||||
float fog_func (in float targ, in float alt);
|
||||
float alt_factor(in float eye_alt, in float vertex_alt);
|
||||
float light_distance_fading(in float dist);
|
||||
float fog_backscatter(in float avisibility);
|
||||
float rayleigh_in_func(in float dist, in float air_pollution, in float avisibility, in float eye_alt, in float vertex_alt);
|
||||
|
||||
vec3 searchlight();
|
||||
vec3 landing_light(in float offset);
|
||||
vec3 rayleigh_out_shift(in vec3 color, in float outscatter);
|
||||
|
||||
|
||||
|
||||
|
@ -87,7 +89,7 @@ void main()
|
|||
|
||||
yprime_alt = diffuse_term.a;
|
||||
mie_angle = gl_Color.a;
|
||||
float effective_scattering = 1.0 - min(scattering, cloud_self_shading);
|
||||
float effective_scattering = min(scattering, cloud_self_shading);
|
||||
|
||||
// distance to fragment
|
||||
float dist = length(relPos);
|
||||
|
@ -295,14 +297,38 @@ if ((dist < 5000.0)&& (quality_level > 3) && (wetness>0.0))
|
|||
|
||||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shifts
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
// Rayleigh color shift due to in-scattering
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
||||
float delta_z = hazeLayerAltitude - eye_alt;
|
||||
|
||||
if (dist > 0.04 * min(visibility,avisibility))
|
||||
//if ((gl_FragCoord.y > ylimit) || (gl_FragCoord.x < zlimit1) || (gl_FragCoord.x > zlimit2))
|
||||
//if (dist > 40.0)
|
||||
{
|
||||
|
||||
alt = eye_alt;
|
||||
|
@ -378,7 +404,7 @@ if (visibility < avisibility)
|
|||
transmission_arg = transmission_arg + (distance_in_layer/visibility);
|
||||
}
|
||||
// this combines the Weber-Fechner intensity
|
||||
eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - effective_scattering;
|
||||
eqColorFactor = 1.0 - 0.1 * delta_zv/visibility - (1.0- effective_scattering);
|
||||
|
||||
}
|
||||
else
|
||||
|
@ -392,7 +418,7 @@ else
|
|||
transmission_arg = transmission_arg + (distance_in_layer/avisibility);
|
||||
}
|
||||
// this combines the Weber-Fechner intensity
|
||||
eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - effective_scattering;
|
||||
eqColorFactor = 1.0 - 0.1 * delta_zv/avisibility - (1.0 - effective_scattering);
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,13 +429,6 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// Mie-like factor
|
||||
|
@ -451,44 +470,18 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
|
|||
}
|
||||
hazeColor = clamp(hazeColor, 0.0, 1.0);
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
fragColor.rgb = mix((eqColorFactor * hazeColor * eShade)+secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
|
||||
}
|
||||
else // if dist < threshold no fogging at all
|
||||
{
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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))
|
||||
{
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -482,11 +482,28 @@ if ((dist < 5000.0) && (combined_wetness>0.0))
|
|||
fragColor = color * texel + specular;
|
||||
|
||||
|
||||
vec3 hazeColor;
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
fragColor.rgb = rayleigh_out_shift(fragColor.rgb,outscatter);
|
||||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
//float lightIntensity = length(diffuse_term.rgb)/1.73 * rShade;
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
float delta_z = hazeLayerAltitude - eye_alt;
|
||||
|
@ -588,13 +605,6 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
@ -639,39 +649,16 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
|
|||
}
|
||||
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
// finally, mix fog in
|
||||
|
||||
|
||||
fragColor.rgb = mix((eqColorFactor * hazeColor * eShade)+secondary_light * fog_backscatter(avisibility) , fragColor.rgb,transmission);
|
||||
}
|
||||
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
|
||||
}
|
||||
else // if dist < threshold no fogging at all
|
||||
{
|
||||
|
||||
// blue Rayleigh scattering with distance
|
||||
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float lightIntensity = length(diffuse_term.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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ light_ambient = light_ambient * ((1.0+steepness)/2.0 * 1.2 + (1.0-steepness)/2.0
|
|||
// deeper shadows when there is lots of direct light
|
||||
|
||||
float shade_depth = 1.0 * smoothstep (0.6,0.95,ground_scattering) * (1.0-smoothstep(0.1,0.5,overcast)) * smoothstep(0.4,1.5,earthShade);
|
||||
|
||||
shade_depth = 0.0;
|
||||
light_ambient.rgb = light_ambient.rgb * (1.0 - shade_depth);
|
||||
light_diffuse.rgb = light_diffuse.rgb * (1.0 + 1.2 * shade_depth);
|
||||
|
||||
|
|
|
@ -181,21 +181,29 @@ void main()
|
|||
vec4 fragColor = vec4 (gl_Color.rgb +secondary_light * light_distance_fading(dist),1.0) * texel;
|
||||
|
||||
|
||||
// Rayleigh haze
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rShade = 0.9 * smoothstep(terminator_width+ terminator, -terminator_width + terminator, yprime_alt-340000.0) + 0.1;
|
||||
float shade_depth = smoothstep (0.6,0.95,ground_scattering);// * smoothstep(0.1,1.2,rShade);
|
||||
float lightIntensity = ground_scattering * light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0)* rShade * (1.0 + 0.4 * shade_depth);
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
fragColor.rgb = mix(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
||||
|
@ -306,11 +314,7 @@ transmission = tree_fog_func(transmission_arg);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
@ -351,14 +355,8 @@ hazeColor = intensity * normalize(mix(hazeColor, shadedFogColor, (1.0-smoothste
|
|||
hazeColor = clamp(hazeColor,0.0,1.0);
|
||||
fragColor.rgb = mix(eqColorFactor * hazeColor * eShade + secondary_light * fog_backscatter(avisibility), fragColor.rgb,transmission);
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
|
||||
}
|
||||
else // if dist < 40.0 no fogging at all
|
||||
{
|
||||
|
||||
gl_FragColor = fragColor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ uniform int cloud_shadow_flag;
|
|||
uniform int use_searchlight;
|
||||
uniform int use_landing_light;
|
||||
uniform int use_alt_landing_light;
|
||||
uniform int gquality_level;
|
||||
uniform int tquality_level;
|
||||
|
||||
const float scale = 1.0;
|
||||
int linear_search_steps = 10;
|
||||
|
@ -305,7 +307,7 @@ vec4 dust_color;
|
|||
float noise_1500m = Noise3D(worldPos.xyz,1500.0);
|
||||
float noise_2000m = Noise3D(worldPos.xyz,2000.0);
|
||||
|
||||
if (quality_level > 2)
|
||||
if (gquality_level > 2)
|
||||
{
|
||||
// mix dust
|
||||
dust_color = vec4 (0.76, 0.71, 0.56, 1.0);
|
||||
|
@ -342,19 +344,31 @@ if (quality_level > 2)
|
|||
vec4 p = vec4( ecPos3 + tile_size * V * (d-1.0) * depthfactor / s.z, 1.0 );
|
||||
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// Rayleigh color shifts
|
||||
|
||||
if ((gquality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rayleigh_length = 0.5 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
finalColor.rgb = rayleigh_out_shift(finalColor.rgb,outscatter);
|
||||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt-340000.0);
|
||||
float lightIntensity = length(light_diffuse.rgb)/1.73 * rShade;
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt + 420000.0);
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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);
|
||||
finalColor.rgb = mix(finalColor.rgb, rayleighColor,rayleighStrength);
|
||||
}
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
@ -431,7 +445,7 @@ float eqColorFactor;
|
|||
|
||||
if (visibility < avisibility)
|
||||
{
|
||||
if (quality_level > 3)
|
||||
if (gquality_level > 3)
|
||||
{
|
||||
transmission_arg = transmission_arg + (distance_in_layer/(1.0 * visibility + 1.0 * visibility * fogstructure * 0.06 * (noise_1500m + noise_2000m -1.0) ));
|
||||
|
||||
|
@ -446,7 +460,7 @@ if (visibility < avisibility)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (quality_level > 3)
|
||||
if (gquality_level > 3)
|
||||
{
|
||||
transmission_arg = transmission_arg + (distance_in_layer/(1.0 * avisibility + 1.0 * avisibility * fogstructure * 0.06 * (noise_1500m + noise_2000m - 1.0) ));
|
||||
}
|
||||
|
@ -466,13 +480,7 @@ transmission = fog_func(transmission_arg, alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// now dim the light for haze
|
||||
|
|
|
@ -520,6 +520,13 @@ void main(void)
|
|||
|
||||
finalColor *= vec4 (ambient_light.rgb + secondary_light * light_distance_fading(dist), ambient_light.a);
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
|
||||
|
@ -535,12 +542,15 @@ void main(void)
|
|||
|
||||
// Rayleigh color shift due to in-scattering
|
||||
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt-340000.0);
|
||||
float lightIntensity = length(gl_Color.rgb)/1.73 * rShade;
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
float rShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt+420000.0);
|
||||
//float lightIntensity = length(gl_Color.rgb* gl_FrontMaterial.diffuse.rgb)/1.73 * rShade;
|
||||
float lightIntensity = length(hazeColor * effective_scattering) * 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(finalColor.rgb, rayleighColor, rayleighStrength);
|
||||
}
|
||||
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
@ -645,12 +655,7 @@ transmission = fog_func(transmission_arg, eye_alt);
|
|||
if (eqColorFactor < 0.2) eqColorFactor = 0.2;
|
||||
|
||||
|
||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||
|
||||
vec3 hazeColor;
|
||||
hazeColor.b = light_func(lightArg, 1.330e-05, 0.264, 2.527, 1.08e-05, 1.0);
|
||||
hazeColor.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||
hazeColor.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||
|
||||
// now dim the light for haze
|
||||
float eShade = 1.0 - 0.9 * smoothstep(-terminator_width+ terminator, terminator_width + terminator, yprime_alt);
|
||||
|
|
Loading…
Reference in a new issue