From 906b0be675e5467665f65180924e6117700b4cbb Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Fri, 3 May 2019 08:47:13 -0700 Subject: SL-11087, SL-11086, SL-11092 Fix sun/moon glow factor bustage. Make darkness an option. Fix moon fade shader logic getting confused when sun was below horizon. --- .../app_settings/shaders/class1/deferred/alphaF.glsl | 13 ++++++------- .../app_settings/shaders/class1/deferred/materialF.glsl | 15 ++++++--------- .../shaders/class1/deferred/softenLightF.glsl | 2 +- 3 files changed, 13 insertions(+), 17 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index ecb1d599de..0a189ff416 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -119,9 +119,9 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec //distance attenuation float dist = (la > 0) ? d/la : 1.0f; fa += 1.0f; - float dist_atten = (fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f; + float dist_atten = (fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 0.0f; dist_atten *= dist_atten; - dist_atten *= 2.0; + dist_atten *= 2.2f; // spotlight coefficient. float spot = max(dot(-ln, lv), is_pointlight); @@ -131,15 +131,14 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec float lit = max(da * dist_atten,0.0); float amb_da = ambiance; - if (da > 0) + if (lit > 0) { col = lit * light_col * diffuse; amb_da += (da*0.5+0.5) * ambiance; + amb_da += (da*da*0.5 + 0.5) * ambiance; + amb_da *= dist_atten; + amb_da = min(amb_da, 1.0f - lit); } - amb_da += (da*da*0.5 + 0.5) * ambiance; - amb_da *= dist_atten; - amb_da = min(amb_da, 1.0f - lit); - col.rgb += amb_da * 0.5 * light_col * diffuse; // no spec for alpha shader... diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index f640dba59b..54bed38fb7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -120,7 +120,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe fa += 1.0f; float dist_atten = ( fa > 0) ? clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0) : 1.0f; dist_atten *= dist_atten; - dist_atten *= 2.0; + dist_atten *= 2.2f; if (dist_atten <= 0) { @@ -143,13 +143,10 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe { col = light_col*lit*diffuse; amb_da += (da*0.5 + 0.5) * ambiance; + amb_da += (da*da*0.5+0.5) * ambiance; + amb_da = min(amb_da, 1.0f - lit); } - amb_da += (da*da*0.5+0.5) * ambiance; - amb_da = min(amb_da, 1.0f - lit); - -#ifndef NO_AMBIANCE - col.rgb += amb_da * 0.5 * light_col * diffuse; -#endif + col.rgb += amb_da * 0.25 * light_col * diffuse; if (spec.a > 0.0) { @@ -362,7 +359,7 @@ vec3 post_diffuse = color.rgb; float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); vec3 speccol = sun_contrib*scol*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); - bloom = dot(speccol, speccol) / 6; + bloom = dot(speccol, speccol) / 6.0f; color += speccol; } } @@ -400,7 +397,7 @@ vec3 post_atmo = color.rgb; vec3 light = vec3(0,0,0); - #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w * 0.5); + #define LIGHT_LOOP(i) light.rgb += calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse_linear.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare, light_attenuation[i].w); LIGHT_LOOP(1) LIGHT_LOOP(2) diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 84642b2f98..d13a717761 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -146,7 +146,7 @@ vec3 post_diffuse = color.rgb; float scontrib = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); vec3 speccol = sun_contrib*scontrib*spec.rgb; speccol = clamp(speccol, vec3(0), vec3(1)); - bloom += dot (speccol, speccol) / 6; + bloom += dot(speccol, speccol) / 12.0; color += speccol; } } -- cgit v1.2.3