From 3564b24e2a90e0772c37185cc5dcedca29d62ab8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 19 May 2022 22:24:41 -0500 Subject: SL-17286 Reflection probe alpha/fullbright support. --- .../shaders/class1/deferred/fullbrightShinyF.glsl | 50 ++++++++++++++-------- 1 file changed, 33 insertions(+), 17 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index 9fcee04c32..a04f611440 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -35,10 +35,11 @@ out vec4 frag_color; uniform sampler2D diffuseMap; #endif + VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING vec4 vary_position; +VARYING vec3 vary_position; uniform samplerCube environmentMap; @@ -54,6 +55,14 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 linear_to_srgb(vec3 c); vec3 srgb_to_linear(vec3 c); +#ifdef HAS_REFLECTION_PROBES +// reflection probe interface +void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyEnv, + vec3 pos, vec3 norm, float glossiness, float envIntensity); +void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); +void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); +#endif + // See: // class1\deferred\fullbrightShinyF.glsl // class1\lighting\lightFullbrightShinyF.glsl @@ -70,21 +79,29 @@ void main() // SL-9632 HUDs are affected by Atmosphere if (no_atmo == 0) { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - vec3 pos = vary_position.xyz/vary_position.w; - - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - - //color.rgb = srgb_to_linear(color.rgb); - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + vec3 pos = vary_position; + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); + + float env_intensity = vertex_color.a; +#ifndef HAS_REFLECTION_PROBES + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, env_intensity); +#else + vec3 ambenv; + vec3 glossenv; + vec3 legacyenv; + vec3 norm = normalize(vary_texcoord1.xyz); + vec4 spec = vec4(0,0,0,0); + sampleReflectionProbes(ambenv, glossenv, legacyenv, pos.xyz, norm.xyz, spec.a, env_intensity); + legacyenv *= 1.5; // fudge brighter + applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); +#endif + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = fullbrightScaleSoftClip(color.rgb); } /* @@ -98,7 +115,6 @@ void main() */ color.a = 1.0; - //color.rgb = linear_to_srgb(color.rgb); frag_color = color; -- cgit v1.2.3 From 0940e8871894e08da80730d11c31cbd252a05b35 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 24 May 2022 10:34:47 -0500 Subject: SL-17472 Add checkbox to preferences for enabling "PBR" that uses "class3" deferred shaders. Move reflection probe shaders to class3 and restore class2 shaders to non-reflection probe versions. --- .../shaders/class1/deferred/fullbrightShinyF.glsl | 50 ++++++++-------------- 1 file changed, 17 insertions(+), 33 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index a04f611440..9fcee04c32 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -35,11 +35,10 @@ out vec4 frag_color; uniform sampler2D diffuseMap; #endif - VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING vec3 vary_position; +VARYING vec4 vary_position; uniform samplerCube environmentMap; @@ -55,14 +54,6 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 linear_to_srgb(vec3 c); vec3 srgb_to_linear(vec3 c); -#ifdef HAS_REFLECTION_PROBES -// reflection probe interface -void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyEnv, - vec3 pos, vec3 norm, float glossiness, float envIntensity); -void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm); -void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); -#endif - // See: // class1\deferred\fullbrightShinyF.glsl // class1\lighting\lightFullbrightShinyF.glsl @@ -79,29 +70,21 @@ void main() // SL-9632 HUDs are affected by Atmosphere if (no_atmo == 0) { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - vec3 pos = vary_position; - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - float env_intensity = vertex_color.a; -#ifndef HAS_REFLECTION_PROBES - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); -#else - vec3 ambenv; - vec3 glossenv; - vec3 legacyenv; - vec3 norm = normalize(vary_texcoord1.xyz); - vec4 spec = vec4(0,0,0,0); - sampleReflectionProbes(ambenv, glossenv, legacyenv, pos.xyz, norm.xyz, spec.a, env_intensity); - legacyenv *= 1.5; // fudge brighter - applyLegacyEnv(color.rgb, legacyenv, spec, pos, norm, env_intensity); -#endif - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); + vec3 sunlit; + vec3 amblit; + vec3 additive; + vec3 atten; + vec3 pos = vary_position.xyz/vary_position.w; + + calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); + + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + float env_intensity = vertex_color.a; + + //color.rgb = srgb_to_linear(color.rgb); + color.rgb = mix(color.rgb, envColor.rgb, env_intensity); + color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); + color.rgb = fullbrightScaleSoftClip(color.rgb); } /* @@ -115,6 +98,7 @@ void main() */ color.a = 1.0; + //color.rgb = linear_to_srgb(color.rgb); frag_color = color; -- cgit v1.2.3 From 0837b65fdd2ea7f50f47209bd8f1109968a677fb Mon Sep 17 00:00:00 2001 From: Ptolemy Date: Tue, 7 Jun 2022 16:14:54 -0700 Subject: DRTVWR-559: Fix fullbrightShiny not compiling on AMD due to type mismatch --- .../app_settings/shaders/class1/deferred/fullbrightShinyF.glsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index 9fcee04c32..f693323d45 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -38,7 +38,7 @@ uniform sampler2D diffuseMap; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; VARYING vec3 vary_texcoord1; -VARYING vec4 vary_position; +VARYING vec3 vary_position; uniform samplerCube environmentMap; @@ -74,7 +74,7 @@ void main() vec3 amblit; vec3 additive; vec3 atten; - vec3 pos = vary_position.xyz/vary_position.w; + vec3 pos = vary_position.xyz; calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); -- cgit v1.2.3 From 830cb6b66551025285120fb628f0b5ebf3841756 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Feb 2023 17:18:39 -0600 Subject: SL-19148 Decruft some forward shaders and drawpools. Fix HUDs being in wrong color space. --- .../shaders/class1/deferred/fullbrightShinyF.glsl | 78 +--------------------- 1 file changed, 3 insertions(+), 75 deletions(-) (limited to 'indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl index f693323d45..850f7ebb38 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl @@ -22,85 +22,13 @@ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ - -/*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR -out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif - -#ifndef HAS_DIFFUSE_LOOKUP -uniform sampler2D diffuseMap; -#endif - -VARYING vec4 vertex_color; -VARYING vec2 vary_texcoord0; -VARYING vec3 vary_texcoord1; -VARYING vec3 vary_position; - -uniform samplerCube environmentMap; +//debug stub -// render_hud_attachments() -> HUD objects set LLShaderMgr::NO_ATMO; used in LLDrawPoolAlpha::beginRenderPass() -uniform int no_atmo; - -vec3 fullbrightShinyAtmosTransport(vec3 light); -vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten); -vec3 fullbrightScaleSoftClip(vec3 light); - -void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao); - -vec3 linear_to_srgb(vec3 c); -vec3 srgb_to_linear(vec3 c); +out vec4 frag_color; -// See: -// class1\deferred\fullbrightShinyF.glsl -// class1\lighting\lightFullbrightShinyF.glsl void main() { -#ifdef HAS_DIFFUSE_LOOKUP - vec4 color = diffuseLookup(vary_texcoord0.xy); -#else - vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); -#endif - - color.rgb *= vertex_color.rgb; - - // SL-9632 HUDs are affected by Atmosphere - if (no_atmo == 0) - { - vec3 sunlit; - vec3 amblit; - vec3 additive; - vec3 atten; - vec3 pos = vary_position.xyz; - - calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false); - - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - - //color.rgb = srgb_to_linear(color.rgb); - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - color.rgb = fullbrightAtmosTransportFrag(color.rgb, additive, atten); - color.rgb = fullbrightScaleSoftClip(color.rgb); - } - -/* - // NOTE: HUD objects will be full bright. Uncomment if you want "some" environment lighting effecting these HUD objects. - else - { - vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; - float env_intensity = vertex_color.a; - color.rgb = mix(color.rgb, envColor.rgb, env_intensity); - } -*/ - - color.a = 1.0; - - //color.rgb = linear_to_srgb(color.rgb); - - frag_color = color; + frag_color = vec4(0.25, 0.5, 0, 1.0); } -- cgit v1.2.3 From 1c2410b8af62254e96d60b2ae2e411d4756215e4 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 3 Feb 2023 19:45:31 -0600 Subject: SL-19148 Decruft followthrough -- decruft shader tree and some remaining forward rendering code. --- .../shaders/class1/deferred/fullbrightShinyF.glsl | 34 ---------------------- 1 file changed, 34 deletions(-) delete mode 100644 indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl (limited to 'indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl') diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl deleted file mode 100644 index 850f7ebb38..0000000000 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightShinyF.glsl +++ /dev/null @@ -1,34 +0,0 @@ -/** - * @file fullbrightShinyF.glsl - * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2007, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -//debug stub - -out vec4 frag_color; - -void main() -{ - frag_color = vec4(0.25, 0.5, 0, 1.0); -} - -- cgit v1.2.3