From 126191ada56cf5daa694493a9ad5188beda11253 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Tue, 7 Aug 2018 22:47:55 +0100 Subject: Protect sky code from (extremely unlikely yet still possible) lack of sky settings. --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llvosky.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d30657a30a..7e7b7fda84 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8664,7 +8664,7 @@ Type Boolean Value - 0 + 1 RenderLocalLights diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp index 899da3e420..64be033fdc 100644 --- a/indra/newview/llvosky.cpp +++ b/indra/newview/llvosky.cpp @@ -1418,8 +1418,11 @@ void LLVOSky::updateReflectionGeometry(LLDrawable *drawable, F32 H, void LLVOSky::updateFog(const F32 distance) { LLEnvironment& environment = LLEnvironment::instance(); - LLVector3 light_dir = LLVector3(environment.getClampedLightNorm()); - m_legacyAtmospherics.updateFog(distance, light_dir); + if (environment.getCurrentSky() != nullptr) + { + LLVector3 light_dir = LLVector3(environment.getClampedLightNorm()); + m_legacyAtmospherics.updateFog(distance, light_dir); + } } void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLVector3 &moon_dir_cfr) -- cgit v1.2.3 From facc678391417c5fa8ca659adc1d449bba2fd349 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 9 Aug 2018 22:46:47 +0100 Subject: MAINT-8951 Remove moon_dir related shader code causing sunlight shadow artifacting. --- indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl | 8 ++------ .../newview/app_settings/shaders/class1/deferred/materialF.glsl | 9 ++------- .../app_settings/shaders/class1/deferred/softenLightF.glsl | 9 ++------- .../app_settings/shaders/class2/deferred/softenLightF.glsl | 9 ++------- .../newview/app_settings/shaders/class2/deferred/sunLightF.glsl | 9 ++------- .../app_settings/shaders/class2/deferred/sunLightSSAOF.glsl | 8 ++------ indra/newview/app_settings/shaders/class3/deferred/skyF.glsl | 1 - .../app_settings/shaders/class3/windlight/advancedAtmoF.glsl | 1 - 8 files changed, 12 insertions(+), 42 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 8dda96984e..7f2c5add16 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -43,7 +43,6 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; -uniform vec3 moon_dir; #if HAS_SHADOW uniform sampler2DShadow shadowMap0; @@ -286,12 +285,9 @@ void main() calcFragAtmospherics(pos.xyz, 1.0, sunlit, amblit, additive, atten); vec2 abnormal = encode_normal(norm.xyz); - norm.xyz = decode_normal(abnormal.xy); + norm.xyz = decode_normal(abnormal.xy); - float da_sun = dot(norm.xyz, sun_dir.xyz); - float da_moon = dot(norm.xyz, moon_dir.xyz); - - float da = max(da_sun, da_moon); + float da = dot(norm.xyz, sun_dir.xyz); float final_da = da; final_da = min(final_da, shadow); diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 4dc15dbc89..6e06453a5b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -98,7 +98,6 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; -uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; VARYING vec3 vary_position; @@ -389,9 +388,7 @@ void main() vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz)); - float da_sun =dot(norm.xyz, sun_dir.xyz); - float da_moon =dot(norm.xyz, moon_dir.xyz); - float da = max(da_sun, da_moon); + float da =dot(norm.xyz, sun_dir.xyz); float final_da = da; final_da = min(final_da, shadow); @@ -421,9 +418,7 @@ void main() // the old infinite-sky shiny reflection // - float sa_sun = dot(refnormpersp, sun_dir.xyz); - float sa_moon = dot(refnormpersp, moon_dir.xyz); - float sa = max(sa_sun, sa_moon); + float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index a4543c325e..ec3c0cb68d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -56,7 +56,6 @@ uniform mat3 env_mat; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; -uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; @@ -107,9 +106,7 @@ void main() float envIntensity = norm.z; norm.xyz = decode_normal(norm.xy); // unpack norm - float da_sun = dot(norm.xyz, sun_dir.xyz); - float da_moon = dot(norm.xyz, moon_dir.xyz); - float da = max(da_sun, da_moon); + float da = dot(norm.xyz, sun_dir.xyz); float final_da = max(0.0,da); final_da = min(final_da, 1.0f); @@ -151,9 +148,7 @@ void main() // the old infinite-sky shiny reflection // - float sa_sun = dot(refnormpersp, sun_dir.xyz); - float sa_moon = dot(refnormpersp, moon_dir.xyz); - float sa = max(sa_sun, sa_moon); + float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 5046ede00d..1e2c49215f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -67,7 +67,6 @@ uniform vec4 shadow_clip; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; -uniform vec3 moon_dir; VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; @@ -117,9 +116,7 @@ void main() float envIntensity = norm.z; norm.xyz = decode_normal(norm.xy); // unpack norm - float da_sun = max(dot(norm.xyz, sun_dir.xyz), 0.0); - float da_moon = max(dot(norm.xyz, moon_dir.xyz), 0.0); - float da = max(da_sun, da_moon); + float da = max(dot(norm.xyz, sun_dir.xyz), 0.0); float light_gamma = 1.0/1.3; da = pow(da, light_gamma); @@ -170,9 +167,7 @@ void main() // the old infinite-sky shiny reflection // - float sa_sun = dot(refnormpersp, sun_dir.xyz); - float sa_moon = dot(refnormpersp, moon_dir.xyz); - float sa = max(sa_sun, sa_moon); + float sa = dot(refnormpersp, sun_dir.xyz); vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r); // add the two types of shiny together diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 11ccdf638c..aa5e99a2f7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -59,7 +59,6 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 proj_shadow_res; uniform vec3 sun_dir; -uniform vec3 moon_dir; uniform vec2 shadow_res; uniform float shadow_bias; @@ -140,14 +139,10 @@ void main() }*/ float shadow = 0.0; - float da_sun = dot(norm, sun_dir.xyz); - float da_moon = dot(norm, moon_dir.xyz); - float da = max(da_sun, da_moon); - - float dp_directional_light = max(0.0, da); + float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); vec3 shadow_pos = pos.xyz; - vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light); + vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 4fccb1d33c..58f3f2f91e 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -59,7 +59,6 @@ uniform mat4 inv_proj; uniform vec2 screen_res; uniform vec2 proj_shadow_res; uniform vec3 sun_dir; -uniform vec3 moon_dir; uniform vec2 shadow_res; @@ -201,13 +200,10 @@ void main() }*/ float shadow = 0.0; - float da_sun = dot(norm, sun_dir.xyz); - float da_moon = dot(norm, moon_dir.xyz); - float da = max(da_sun, da_moon); - float dp_directional_light = max(0.0, da); + float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz)); vec3 shadow_pos = pos.xyz; - vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light); + vec3 offset = sun_dir.xyz * (1.0-dp_directional_light); vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0); diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl index 43c0505046..47fa0efe06 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl @@ -34,7 +34,6 @@ in vec3 view_dir; uniform vec3 cameraPosLocal; uniform vec3 sun_dir; -uniform vec3 moon_dir; uniform float sun_size; uniform sampler2D transmittance_texture; diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl index bdb54a1d63..fed3edf7de 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl @@ -33,7 +33,6 @@ in vec3 view_dir; uniform vec3 cameraPosLocal; uniform vec3 sun_dir; -uniform vec3 moon_dir; uniform float sun_size; uniform sampler2D transmittance_texture; -- cgit v1.2.3 From 3a3d0cbc79cd7371446af38e6d1c6b9cff1da0c3 Mon Sep 17 00:00:00 2001 From: Graham Linden Date: Thu, 9 Aug 2018 22:48:52 +0100 Subject: Disable nSight debug. --- indra/newview/app_settings/settings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 7e7b7fda84..d30657a30a 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8664,7 +8664,7 @@ Type Boolean Value - 1 + 0 RenderLocalLights -- cgit v1.2.3