Bugfixes for ALS water shader lower terrain quality inconsistencies
This commit is contained in:
parent
20dda77d6f
commit
17b03d0b99
4 changed files with 31 additions and 9 deletions
|
@ -826,6 +826,11 @@
|
|||
<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>ocean_flag</name>
|
||||
<type>int</type>
|
||||
|
|
|
@ -853,6 +853,11 @@
|
|||
<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>ocean_flag</name>
|
||||
<type>int</type>
|
||||
|
|
|
@ -64,6 +64,7 @@ uniform float landing_light1_offset;
|
|||
uniform float landing_light2_offset;
|
||||
|
||||
uniform int quality_level;
|
||||
uniform int tquality_level;
|
||||
uniform int ocean_flag;
|
||||
uniform int cloud_shadow_flag;
|
||||
uniform int use_searchlight;
|
||||
|
@ -552,7 +553,7 @@ void main(void)
|
|||
|
||||
vec3 secondary_light = vec3 (0.0,0.0,0.0);
|
||||
|
||||
if (quality_level >5)
|
||||
if ((quality_level >5)&&(tquality_level > 5))
|
||||
{
|
||||
if (use_searchlight == 1)
|
||||
{
|
||||
|
@ -566,11 +567,11 @@ void main(void)
|
|||
{
|
||||
secondary_light += landing_light(landing_light2_offset);
|
||||
}
|
||||
|
||||
//specular.rgb+= secondary_light;
|
||||
}
|
||||
|
||||
finalColor = refl + specular * smoothstep(0.3, 0.6, ground_scattering) + vec4 (secondary_light, 0.0) * light_distance_fading(dist) * 2.0 * pow(max(0.0,dot(E,N)), water_shininess);
|
||||
|
||||
|
||||
//add foam
|
||||
vec4 foam_texel = texture2D(sea_foam, vec2(waterTex2 * tscale) * 25.0);
|
||||
if (dist < 10000.0)
|
||||
|
@ -605,18 +606,24 @@ void main(void)
|
|||
finalColor.a = 1.0;
|
||||
|
||||
|
||||
}
|
||||
//vec4 (secondary_light * light_distance_fading(dist), 0.0) * max(0.0,pow(dot(E,N)), water_shininess);
|
||||
|
||||
|
||||
|
||||
|
||||
finalColor *= vec4 (ambient_light.rgb + secondary_light * light_distance_fading(dist), ambient_light.a);
|
||||
|
||||
|
||||
// Rayleigh color shift due to out-scattering
|
||||
float rayleigh_length = 0.4 * 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);
|
||||
|
||||
float rayleigh_length;
|
||||
float outscatter;
|
||||
|
||||
if ((quality_level > 5) && (tquality_level > 5))
|
||||
{
|
||||
rayleigh_length = 0.4 * avisibility * (2.5 - 1.9 * air_pollution)/alt_factor(eye_alt, eye_alt+relPos.z);
|
||||
outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||
finalColor.rgb = rayleigh_out_shift(finalColor.rgb,outscatter);
|
||||
}
|
||||
|
||||
// here comes the terrain haze model
|
||||
|
||||
|
@ -768,7 +775,8 @@ if (intensity > 0.0) // this needs to be a condition, because otherwise hazeColo
|
|||
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);
|
||||
finalColor.rgb = mix(finalColor.rgb, rayleighColor, rayleighStrength);
|
||||
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);
|
||||
|
||||
|
|
|
@ -239,6 +239,10 @@ else // the faster, full-day version without lightfields
|
|||
|
||||
specular_light = specular_light * scattering;
|
||||
|
||||
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);
|
||||
|
||||
specular_light.rgb *= (1.0 + 1.2 * shade_depth);
|
||||
|
||||
yprime_alt = -sqrt(2.0 * EarthRadius * hazeLayerAltitude);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue