From 2c6a962a349e11aef93d6958e70da00919e7e3d0 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Tue, 9 Apr 2013 09:52:19 +0300 Subject: [PATCH] Modified cloud lighting with dependence on air pollution --- Effects/cloud.eff | 6 ++++++ Nasal/local_weather/local_weather.nas | 12 ++++++------ Shaders/3dcloud-lightfield.vert | 9 +++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Effects/cloud.eff b/Effects/cloud.eff index fa22fa610..f888436a1 100644 --- a/Effects/cloud.eff +++ b/Effects/cloud.eff @@ -11,6 +11,7 @@ /sim/rendering/eye-altitude-m /environment/cloud-self-shading /environment/moonlight + /environment/air-pollution-norm /environment/visibility-m @@ -107,6 +108,11 @@ float moonlight + + air_pollution + float + air_pollution + visibility float diff --git a/Nasal/local_weather/local_weather.nas b/Nasal/local_weather/local_weather.nas index ce9a6bb3b..003fae88a 100644 --- a/Nasal/local_weather/local_weather.nas +++ b/Nasal/local_weather/local_weather.nas @@ -699,7 +699,7 @@ else # compute the cloud layer self shading correction 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 @@ -4125,11 +4125,11 @@ debug.dump(geodinfo(lat, lon)); -#var info = {}; - -#for (var i = 0; i< 100000; i=i+1) -# { -# info = geodinfo(lat, lon); +#var info = {}; + +#for (var i = 0; i< 100000; i=i+1) +# { +# info = geodinfo(lat, lon); # } diff --git a/Shaders/3dcloud-lightfield.vert b/Shaders/3dcloud-lightfield.vert index a3e580bfe..0d1797f61 100644 --- a/Shaders/3dcloud-lightfield.vert +++ b/Shaders/3dcloud-lightfield.vert @@ -12,6 +12,7 @@ uniform float altitude; uniform float cloud_self_shading; uniform float visibility; uniform float moonlight; +uniform float air_pollution; attribute vec3 usrAttr1; attribute vec3 usrAttr2; @@ -151,8 +152,8 @@ void main(void) 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.g = light_func(lightArg, 3.931e-06, 0.264, 3.827, 7.93e-06, 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 -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.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) )))); // 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 ) )); }