From 31924129227eb28bae6949e4b2b8fd6d5cffed61 Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Sun, 16 Aug 2020 14:16:17 -0700 Subject: SL-13465 Partially restore atmospheric effects for the moon. --- .../newview/app_settings/shaders/class1/deferred/moonF.glsl | 12 ++++++++++++ .../newview/app_settings/shaders/class1/windlight/moonF.glsl | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 80f232948a..4fac46fdfb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -45,6 +45,12 @@ uniform float blend_factor; // interp factor between moon A/B VARYING vec2 vary_texcoord0; vec3 srgb_to_linear(vec3 c); + +vec3 getAdditiveColor(); + +/// Soft clips the light with a gamma correction +vec3 scaleSoftClip(vec3 light); + void main() { vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy); @@ -65,6 +71,12 @@ void main() //c.rgb *= moonlight_color.rgb; + // Partial atmospherics calculation + vec3 ac = getAdditiveColor(); + c.rgb += ac; + + c.rgb = scaleSoftClip(c.rgb); + frag_data[0] = vec4(c.rgb, c.a); frag_data[1] = vec4(0.0); frag_data[2] = vec4(0.0f); diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 24f3992e32..310bb15fdf 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -44,6 +44,9 @@ uniform sampler2D altDiffuseMap; uniform float blend_factor; // interp factor between moon A/B VARYING vec2 vary_texcoord0; +vec3 getAdditiveColor(); +vec3 scaleSoftClip(vec3 light); + void main() { vec4 moonA = texture2D(diffuseMap, vary_texcoord0.xy); @@ -59,6 +62,12 @@ void main() c.rgb = pow(c.rgb, exp); //c.rgb *= moonlight_color.rgb; + // Partial atmospherics calculation + vec3 ac = getAdditiveColor(); + c.rgb += ac; + + c.rgb = scaleSoftClip(c.rgb); + frag_color = vec4(c.rgb, c.a); } -- cgit v1.2.3 From f156730f3b3671be15bc769c0f17c5a7f4cb3faa Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Sun, 16 Aug 2020 14:19:54 -0700 Subject: SL-13465 Fix local scalar mix masking global mix() function. --- indra/newview/app_settings/shaders/class1/deferred/moonF.glsl | 4 ++-- indra/newview/app_settings/shaders/class1/windlight/moonF.glsl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl index 4fac46fdfb..4366945214 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl @@ -64,9 +64,9 @@ void main() vec3 luma_weights = vec3(0.3, 0.5, 0.3); vec4 light_color = max(sunlight_color, moonlight_color); - float mix = 1.0 - dot(normalize(light_color.rgb), luma_weights); + float blend = 1.0 - dot(normalize(light_color.rgb), luma_weights); - vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0; + vec3 exp = vec3(1.0 - blend * moon_brightness) * 2.0 - 1.0; c.rgb = pow(c.rgb, exp); //c.rgb *= moonlight_color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl index 310bb15fdf..72d2c4cdfa 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl @@ -56,9 +56,9 @@ void main() // mix factor which blends when sunlight is brighter // and shows true moon color at night vec3 luma_weights = vec3(0.3, 0.5, 0.3); - float mix = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); + float blend = 1.0f - dot(normalize(sunlight_color.rgb), luma_weights); - vec3 exp = vec3(1.0 - mix * moon_brightness) * 2.0 - 1.0; + vec3 exp = vec3(1.0 - blend * moon_brightness) * 2.0 - 1.0; c.rgb = pow(c.rgb, exp); //c.rgb *= moonlight_color.rgb; -- cgit v1.2.3