From 846d756e55bf3f7621c3b9adc49b14099d321556 Mon Sep 17 00:00:00 2001 From: ehofman Date: Fri, 3 Apr 2009 07:56:59 +0000 Subject: [PATCH] logarithmic decrease in shinines/specular and limited linear increased ambient color due to reduced visibility. --- src/Time/light.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Time/light.cxx b/src/Time/light.cxx index 782418d7e..ee4865321 100644 --- a/src/Time/light.cxx +++ b/src/Time/light.cxx @@ -193,15 +193,15 @@ void FGLight::update_sky_color () { // local up float av = thesky->get_visibility(); if (av > 45000.0) av = 45000.0; - float visibility_norm = av/45000.0; - float visibility_inv = 1.0 - visibility_norm; + float visibility_log = log(av)/11.0; + float visibility_inv = (45000.0 - av)/45000.0; float deg = _sun_angle * SGD_RADIANS_TO_DEGREES; SG_LOG( SG_EVENT, SG_DEBUG, " Sun angle = " << deg ); - float ambient = _ambient_tbl->interpolate( deg ) + visibility_inv/2; + float ambient = _ambient_tbl->interpolate( deg ) + visibility_inv/10; float diffuse = _diffuse_tbl->interpolate( deg ); - float specular = _specular_tbl->interpolate( deg ) * visibility_norm; + float specular = _specular_tbl->interpolate( deg ) * visibility_log; float sky_brightness = _sky_tbl->interpolate( deg ); SG_LOG( SG_EVENT, SG_DEBUG, @@ -233,12 +233,12 @@ void FGLight::update_sky_color () { } gamma_correct_rgb( _cloud_color.data() ); - SGVec4f sun_color = thesky->get_sun_color(); - _scene_ambient[0] = _fog_color[0] * ambient; - _scene_ambient[1] = _fog_color[1] * ambient; - _scene_ambient[2] = _fog_color[2] * ambient; + _scene_ambient[0] = _fog_color[0] * _cloud_color[0] * ambient; + _scene_ambient[1] = _fog_color[1] * _cloud_color[1] * ambient; + _scene_ambient[2] = _fog_color[2] * _cloud_color[2] * ambient; _scene_ambient[3] = 1.0; + SGVec4f sun_color = thesky->get_sun_color(); _scene_diffuse[0] = (sun_color[0]*0.4 + _fog_color[0]*0.6) * diffuse; _scene_diffuse[1] = (sun_color[1]*0.4 + _fog_color[1]*0.6) * diffuse; _scene_diffuse[2] = (sun_color[2]*0.4 + _fog_color[2]*0.6) * diffuse;