Bugfix: Terrain quality taken into account in model shaders.
Objects like OSM buildings using the `model-combined` effect ignored the Terrain quality. Rayleigh Fog is computed for the terrain only at "Ultra" level, but was computed for models at all quality levels, which led to a visual disparity. The shader now takes into account the terrain quality before computing rayleigh fog for objects. The `road` effect also had the same issue and is fixed now.
This commit is contained in:
parent
6fd8a92b2f
commit
f3b455b699
4 changed files with 38 additions and 5 deletions
|
@ -194,6 +194,8 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
|
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
|
||||||
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
|
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
|
||||||
<building-flag type="int">0</building-flag>
|
<building-flag type="int">0</building-flag>
|
||||||
|
<quality_level><use>/sim/rendering/shaders/landmass</use></quality_level>
|
||||||
|
<tquality_level><use>/sim/rendering/shaders/transition</use></tquality_level>
|
||||||
<!-- END fog include -->
|
<!-- END fog include -->
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
|
@ -1026,6 +1028,17 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<value><use>fact_black</use></value>
|
<value><use>fact_black</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
|
||||||
|
<uniform>
|
||||||
|
<name>quality_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>
|
||||||
|
|
||||||
<!-- cloud shadows -->
|
<!-- cloud shadows -->
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>cloudpos1_x</name>
|
<name>cloudpos1_x</name>
|
||||||
|
@ -1268,7 +1281,6 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<value><use>building-flag</use></value>
|
<value><use>building-flag</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
|
||||||
|
|
||||||
<!-- END fog include -->
|
<!-- END fog include -->
|
||||||
<!-- BEGIN shadows include -->
|
<!-- BEGIN shadows include -->
|
||||||
<uniform>
|
<uniform>
|
||||||
|
|
|
@ -840,6 +840,17 @@
|
||||||
<value><use>fact_black</use></value>
|
<value><use>fact_black</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
|
||||||
|
<uniform>
|
||||||
|
<name>quality_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>
|
||||||
|
|
||||||
<!-- cloud shadows -->
|
<!-- cloud shadows -->
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>cloudpos1_x</name>
|
<name>cloudpos1_x</name>
|
||||||
|
|
|
@ -79,6 +79,9 @@ uniform float air_pollution;
|
||||||
uniform float snowlevel;
|
uniform float snowlevel;
|
||||||
uniform float snow_thickness_factor;
|
uniform float snow_thickness_factor;
|
||||||
|
|
||||||
|
uniform int quality_level;
|
||||||
|
uniform int tquality_level;
|
||||||
|
|
||||||
uniform float osg_SimulationTime;
|
uniform float osg_SimulationTime;
|
||||||
uniform mat4 osg_ViewMatrix;
|
uniform mat4 osg_ViewMatrix;
|
||||||
|
|
||||||
|
@ -660,7 +663,9 @@ void main (void)
|
||||||
//hazeColor = clamp(hazeColor, 0.0, 1.0);
|
//hazeColor = clamp(hazeColor, 0.0, 1.0);
|
||||||
|
|
||||||
///BEGIN Rayleigh fog ///
|
///BEGIN Rayleigh fog ///
|
||||||
|
// Only compute fog if terrain level is 'Ultra'
|
||||||
|
if ((quality_level > 5) && (tquality_level > 5))
|
||||||
|
{
|
||||||
// Rayleigh color shift due to out-scattering
|
// 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 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);
|
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||||
|
@ -669,7 +674,7 @@ void main (void)
|
||||||
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity;
|
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);
|
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(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||||
|
}
|
||||||
/// END Rayleigh fog
|
/// END Rayleigh fog
|
||||||
|
|
||||||
// don't let the light fade out too rapidly
|
// don't let the light fade out too rapidly
|
||||||
|
|
|
@ -76,6 +76,9 @@ uniform float air_pollution;
|
||||||
uniform float snowlevel;
|
uniform float snowlevel;
|
||||||
uniform float snow_thickness_factor;
|
uniform float snow_thickness_factor;
|
||||||
|
|
||||||
|
uniform int quality_level;
|
||||||
|
uniform int tquality_level;
|
||||||
|
|
||||||
uniform float osg_SimulationTime;
|
uniform float osg_SimulationTime;
|
||||||
|
|
||||||
uniform float landing_light1_offset;
|
uniform float landing_light1_offset;
|
||||||
|
@ -842,7 +845,9 @@ void main (void)
|
||||||
hazeColor = clamp(hazeColor, 0.0, 1.0);
|
hazeColor = clamp(hazeColor, 0.0, 1.0);
|
||||||
|
|
||||||
///BEGIN Rayleigh fog ///
|
///BEGIN Rayleigh fog ///
|
||||||
|
// Only compute fog if terrain level is 'Ultra'
|
||||||
|
if ((quality_level > 5) && (tquality_level > 5))
|
||||||
|
{
|
||||||
// Rayleigh color shift due to out-scattering
|
// 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 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);
|
float outscatter = 1.0-exp(-dist/rayleigh_length);
|
||||||
|
@ -851,7 +856,7 @@ void main (void)
|
||||||
vec3 rayleighColor = vec3 (0.17, 0.52, 0.87) * lightIntensity;
|
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);
|
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(fragColor.rgb, rayleighColor,rayleighStrength);
|
||||||
|
}
|
||||||
/// END Rayleigh fog
|
/// END Rayleigh fog
|
||||||
|
|
||||||
// don't let the light fade out too rapidly
|
// don't let the light fade out too rapidly
|
||||||
|
|
Loading…
Add table
Reference in a new issue