Modified cloud lighting with dependence on air pollution
This commit is contained in:
parent
2f01deb6bd
commit
2c6a962a34
3 changed files with 17 additions and 10 deletions
|
@ -11,6 +11,7 @@
|
||||||
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
|
<altitude><use>/sim/rendering/eye-altitude-m</use></altitude>
|
||||||
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
<cloud_self_shading><use>/environment/cloud-self-shading</use></cloud_self_shading>
|
||||||
<moonlight><use>/environment/moonlight</use></moonlight>
|
<moonlight><use>/environment/moonlight</use></moonlight>
|
||||||
|
<air_pollution><use>/environment/air-pollution-norm</use></air_pollution>
|
||||||
<visibility><use>/environment/visibility-m</use></visibility>
|
<visibility><use>/environment/visibility-m</use></visibility>
|
||||||
</parameters>
|
</parameters>
|
||||||
|
|
||||||
|
@ -107,6 +108,11 @@
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
<value><use>moonlight</use></value>
|
<value><use>moonlight</use></value>
|
||||||
</uniform>
|
</uniform>
|
||||||
|
<uniform>
|
||||||
|
<name>air_pollution</name>
|
||||||
|
<type>float</type>
|
||||||
|
<value><use>air_pollution</use></value>
|
||||||
|
</uniform>
|
||||||
<uniform>
|
<uniform>
|
||||||
<name>visibility</name>
|
<name>visibility</name>
|
||||||
<type>float</type>
|
<type>float</type>
|
||||||
|
|
|
@ -699,7 +699,7 @@ else
|
||||||
# compute the cloud layer self shading correction
|
# compute the cloud layer self shading correction
|
||||||
|
|
||||||
var sun_angle = 1.57079632675 - getprop("/sim/time/sun-angle-rad");
|
var sun_angle = 1.57079632675 - getprop("/sim/time/sun-angle-rad");
|
||||||
var cloud_layer_shading = 1.0 - ((1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
var cloud_layer_shading = 1.0 - (0.8*(1.0 - scatt_max) * math.pow(math.cos(sun_angle),100.0));
|
||||||
|
|
||||||
# compute the overcast haze
|
# compute the overcast haze
|
||||||
|
|
||||||
|
@ -4125,11 +4125,11 @@ debug.dump(geodinfo(lat, lon));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#var info = {};
|
#var info = {};
|
||||||
|
|
||||||
#for (var i = 0; i< 100000; i=i+1)
|
#for (var i = 0; i< 100000; i=i+1)
|
||||||
# {
|
# {
|
||||||
# info = geodinfo(lat, lon);
|
# info = geodinfo(lat, lon);
|
||||||
# }
|
# }
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ uniform float altitude;
|
||||||
uniform float cloud_self_shading;
|
uniform float cloud_self_shading;
|
||||||
uniform float visibility;
|
uniform float visibility;
|
||||||
uniform float moonlight;
|
uniform float moonlight;
|
||||||
|
uniform float air_pollution;
|
||||||
|
|
||||||
attribute vec3 usrAttr1;
|
attribute vec3 usrAttr1;
|
||||||
attribute vec3 usrAttr2;
|
attribute vec3 usrAttr2;
|
||||||
|
@ -151,8 +152,8 @@ void main(void)
|
||||||
|
|
||||||
float lightArg = (terminator-yprime_alt)/100000.0;
|
float lightArg = (terminator-yprime_alt)/100000.0;
|
||||||
|
|
||||||
light_diffuse.b = light_func(lightArg, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
light_diffuse.b = light_func(lightArg -1.2 * air_pollution, 1.330e-05, 0.264, 2.227, 1.08e-05, 1.0);
|
||||||
light_diffuse.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
light_diffuse.g = light_func(lightArg -0.6 * air_pollution, 3.931e-06, 0.264, 3.827, 7.93e-06, 1.0);
|
||||||
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
light_diffuse.r = light_func(lightArg, 8.305e-06, 0.161, 3.827, 3.04e-05, 1.0);
|
||||||
light_diffuse.a = 1.0;
|
light_diffuse.a = 1.0;
|
||||||
|
|
||||||
|
@ -160,9 +161,9 @@ void main(void)
|
||||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) ))));
|
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, (1.0 - smoothstep(0.5,0.9, min(scattering, cloud_self_shading) ))));
|
||||||
|
|
||||||
// correct ambient light intensity and hue before sunrise
|
// correct ambient light intensity and hue before sunrise
|
||||||
if (earthShade < 0.8)
|
if (earthShade < 0.6)
|
||||||
{
|
{
|
||||||
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.8,earthShade ) ));
|
light_diffuse.rgb = intensity * normalize(mix(light_diffuse.rgb, shadedFogColor, 1.0 -smoothstep(0.1, 0.6,earthShade ) ));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue