summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-02-07 18:25:22 -0600
committerDave Parks <davep@lindenlab.com>2023-02-07 18:25:22 -0600
commita2647e953aeee26ef99e62e0146adcd37c8afca1 (patch)
treeafb8c28e3ca63eb0f3c5773e3230aa24fe9ff77d /indra/newview/app_settings/shaders
parentbe9e4f186db1b3612a26e27a0294114ca66c539c (diff)
SL-18229 Fix for PBR materials on HUDs misbehaving. Incidental decruft.
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl61
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl49
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl45
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl59
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl54
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl63
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl50
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl57
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl48
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl57
-rw-r--r--indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl48
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl33
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl65
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl58
14 files changed, 195 insertions, 552 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
index a2ad1b70fb..597ab22f42 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbralphaV.glsl
@@ -23,10 +23,10 @@
* $/LicenseInfo$
*/
-#define DIFFUSE_ALPHA_MODE_IGNORE 0
-#define DIFFUSE_ALPHA_MODE_BLEND 1
-#define DIFFUSE_ALPHA_MODE_MASK 2
-#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
+
+#ifndef IS_HUD
+
+// default alpha implementation
#ifdef HAS_SKIN
uniform mat4 modelview_matrix;
@@ -38,13 +38,12 @@ uniform mat4 modelview_projection_matrix;
#endif
uniform mat4 texture_matrix0;
-#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
- #if !defined(HAS_SKIN)
- uniform mat4 modelview_matrix;
- #endif
- VARYING vec3 vary_position;
+#if !defined(HAS_SKIN)
+uniform mat4 modelview_matrix;
#endif
+out vec3 vary_position;
+
uniform mat3 texture_basecolor_matrix;
uniform mat3 texture_normal_matrix;
uniform mat3 texture_metallic_roughness_matrix;
@@ -79,9 +78,7 @@ void main()
mat4 mat = getObjectSkinnedTransform();
mat = modelview_matrix * mat;
vec3 pos = (mat*vec4(position.xyz,1.0)).xyz;
-#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
vary_position = pos;
-#endif
vec4 vert = projection_matrix * vec4(pos,1.0);
#else
//transform vertex
@@ -112,9 +109,45 @@ void main()
vertex_color = diffuse_color;
-#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
- #if !defined(HAS_SKIN)
+#if !defined(HAS_SKIN)
vary_position = (modelview_matrix*vec4(position.xyz, 1.0)).xyz;
- #endif
#endif
}
+
+#else
+
+// fullbright HUD alpha implementation
+
+uniform mat4 modelview_projection_matrix;
+
+uniform mat4 texture_matrix0;
+
+uniform mat4 modelview_matrix;
+
+out vec3 vary_position;
+
+uniform mat3 texture_basecolor_matrix;
+uniform mat3 texture_emissive_matrix;
+
+in vec3 position;
+in vec4 diffuse_color;
+in vec2 texcoord0;
+
+out vec2 basecolor_texcoord;
+out vec2 emissive_texcoord;
+
+out vec4 vertex_color;
+
+void main()
+{
+ //transform vertex
+ vec4 vert = modelview_projection_matrix * vec4(position.xyz, 1.0);
+ gl_Position = vert;
+
+ basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy;
+ emissive_texcoord = (texture_matrix0 * vec4(texture_emissive_matrix * vec3(texcoord0,1), 1)).xy;
+
+ vertex_color = diffuse_color;
+}
+
+#endif
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
index 39419e9d78..483ce4c3d0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueF.glsl
@@ -25,6 +25,11 @@
/*[EXTRA_CODE_HERE]*/
+
+#ifndef IS_HUD
+
+// deferred opaque implementation
+
uniform sampler2D diffuseMap; //always in sRGB space
uniform float metallicFactor;
@@ -101,3 +106,47 @@ void main()
frag_data[2] = vec4(encode_normal(tnorm), vertex_color.a, GBUFFER_FLAG_HAS_PBR); // normal, environment intensity, flags
frag_data[3] = vec4(emissive,0); // PBR sRGB Emissive
}
+
+#else
+
+// forward fullbright implementation for HUDs
+
+uniform sampler2D diffuseMap; //always in sRGB space
+
+uniform vec3 emissiveColor;
+uniform sampler2D emissiveMap;
+
+out vec4 frag_color;
+
+in vec3 vary_position;
+in vec4 vertex_color;
+
+in vec2 basecolor_texcoord;
+in vec2 emissive_texcoord;
+
+uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff()
+
+vec3 linear_to_srgb(vec3 c);
+vec3 srgb_to_linear(vec3 c);
+
+void main()
+{
+ vec4 basecolor = texture2D(diffuseMap, basecolor_texcoord.xy).rgba;
+ if (basecolor.a < minimum_alpha)
+ {
+ discard;
+ }
+
+ vec3 col = vertex_color.rgb * srgb_to_linear(basecolor.rgb);
+
+ vec3 emissive = emissiveColor;
+ emissive *= srgb_to_linear(texture2D(emissiveMap, emissive_texcoord.xy).rgb);
+
+ col += emissive;
+
+ // HUDs are rendered after gamma correction, output in sRGB space
+ frag_color.rgb = linear_to_srgb(col);
+ frag_color.a = 0.0;
+}
+
+#endif \ No newline at end of file
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
index 5a69da641a..8320640e42 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pbropaqueV.glsl
@@ -23,10 +23,10 @@
* $/LicenseInfo$
*/
-#define DIFFUSE_ALPHA_MODE_IGNORE 0
-#define DIFFUSE_ALPHA_MODE_BLEND 1
-#define DIFFUSE_ALPHA_MODE_MASK 2
-#define DIFFUSE_ALPHA_MODE_EMISSIVE 3
+
+#ifndef IS_HUD
+
+//deferred opaque implementation
#ifdef HAS_SKIN
uniform mat4 modelview_matrix;
@@ -95,3 +95,40 @@ void main()
vertex_color = diffuse_color;
}
+
+#else
+
+// fullbright HUD implementation
+
+uniform mat4 modelview_projection_matrix;
+
+uniform mat4 texture_matrix0;
+
+uniform mat3 texture_basecolor_matrix;
+uniform mat3 texture_normal_matrix;
+uniform mat3 texture_metallic_roughness_matrix;
+uniform mat3 texture_emissive_matrix;
+
+in vec3 position;
+in vec4 diffuse_color;
+in vec2 texcoord0;
+
+out vec2 basecolor_texcoord;
+out vec2 emissive_texcoord;
+
+out vec4 vertex_color;
+
+void main()
+{
+ //transform vertex
+ gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
+
+ basecolor_texcoord = (texture_matrix0 * vec4(texture_basecolor_matrix * vec3(texcoord0,1), 1)).xy;
+ emissive_texcoord = (texture_matrix0 * vec4(texture_emissive_matrix * vec3(texcoord0,1), 1)).xy;
+
+ vertex_color = diffuse_color;
+}
+
+#endif
+
+
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
deleted file mode 100644
index 00749213db..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightAlphaMaskF.glsl
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightAlphaMaskF.glsl
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform float minimum_alpha;
-uniform float texture_gamma; // either 1.0 or 2.2; see: "::TEXTURE_GAMMA"
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-void fullbright_lighting()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color *= vertex_color;
-
- color.rgb = pow(color.rgb, vec3(texture_gamma));
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
- color.rgb = fullbrightScaleSoftClip(color.rgb);
-
- frag_color = color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
deleted file mode 100644
index b9dc332043..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightF.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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-uniform float texture_gamma;
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
-void fullbright_lighting()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- color.rgb = pow(color.rgb, vec3(texture_gamma));
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
- color.rgb = fullbrightScaleSoftClip(color.rgb);
-
- color.rgb = pow(color.rgb, vec3(1.0/texture_gamma));
-
- frag_color = color;
-
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
deleted file mode 100644
index e8e71beb44..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightNonIndexedAlphaMaskF.glsl
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform float minimum_alpha;
-uniform float texture_gamma;
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
-uniform sampler2D diffuseMap;
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-void fullbright_lighting()
-{
- vec4 color = texture2D(diffuseMap,vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color.rgb *= vertex_color.rgb;
-
- color.rgb = pow(color.rgb, vec3(texture_gamma));
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- color.rgb = fullbrightScaleSoftClip(color.rgb);
-
- color.rgb = pow(color.rgb, vec3(1.0/texture_gamma));
-
- frag_color = color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl
deleted file mode 100644
index 11a0919086..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightNonIndexedF.glsl
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightF.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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec3 fullbrightScaleSoftClip(vec3 light);
-
-uniform sampler2D diffuseMap;
-
-void fullbright_lighting()
-{
- vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- color.rgb = fullbrightScaleSoftClip(color.rgb);
-
- frag_color = color;
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
deleted file mode 100644
index 37cac5f437..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightWaterAlphaMaskF.glsl
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform float minimum_alpha;
-
-/* vec4 diffuseLookup(vec2 texcoord); */
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-void fullbright_lighting_water()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color.rgb *= vertex_color.rgb;
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- frag_color = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
deleted file mode 100644
index 27880b720c..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightWaterF.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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-/* vec4 diffuseLookup(vec2 texcoord); */
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void fullbright_lighting_water()
-{
- vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color;
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- frag_color = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
deleted file mode 100644
index c98db4795c..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightWaterNonIndexedAlphaMaskF.glsl
- *
- * $LicenseInfo:firstyear=2011&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2011, 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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-uniform float minimum_alpha;
-
-uniform sampler2D diffuseMap;
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-void fullbright_lighting_water()
-{
- vec4 color = texture2D(diffuseMap, vary_texcoord0.xy);
-
- if (color.a < minimum_alpha)
- {
- discard;
- }
-
- color.rgb *= vertex_color.rgb;
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- frag_color = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl
deleted file mode 100644
index e9fd8ac820..0000000000
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterNonIndexedF.glsl
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * @file class1\lighting\lightFullbrightWaterF.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$
- */
-
-#ifdef DEFINE_GL_FRAGCOLOR
-out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-uniform sampler2D diffuseMap;
-
-vec3 fullbrightAtmosTransport(vec3 light);
-vec4 applyWaterFog(vec4 color);
-
-void fullbright_lighting_water()
-{
- vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color;
-
- color.rgb = fullbrightAtmosTransport(color.rgb);
-
- frag_color = applyWaterFog(color);
-}
-
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
deleted file mode 100644
index 31a262f1db..0000000000
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightF.glsl
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * @file objects/fullbrightF.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$F
- */
-
-
-
-void fullbright_lighting();
-
-void main()
-{
- fullbright_lighting();
-}
diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
deleted file mode 100644
index 5af42f1fcf..0000000000
--- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * @file fullbrightV.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$
- */
-
-uniform mat4 texture_matrix0;
-uniform mat4 modelview_matrix;
-uniform mat4 modelview_projection_matrix;
-
-ATTRIBUTE vec3 position;
-void passTextureIndex();
-ATTRIBUTE vec2 texcoord0;
-ATTRIBUTE vec3 normal;
-ATTRIBUTE vec4 diffuse_color;
-
-void calcAtmospherics(vec3 inPositionEye);
-
-VARYING vec4 vertex_color;
-VARYING vec2 vary_texcoord0;
-
-#ifdef HAS_SKIN
-mat4 getObjectSkinnedTransform();
-uniform mat4 projection_matrix;
-#endif
-
-void main()
-{
- //transform vertex
- vec4 vert = vec4(position.xyz,1.0);
- passTextureIndex();
-#ifdef HAS_SKIN
- mat4 mat = getObjectSkinnedTransform();
- mat = modelview_matrix * mat;
- vec4 pos = mat * vert;
- gl_Position = projection_matrix * pos;
-#else
- vec4 pos = (modelview_matrix * vert);
- gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
-#endif
- vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-
- calcAtmospherics(pos.xyz);
-
- vertex_color = diffuse_color;
-}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 35e22ef3a2..35ccc65a8e 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -25,6 +25,8 @@
/*[EXTRA_CODE_HERE]*/
+#ifndef IS_HUD
+
uniform sampler2D diffuseMap; //always in sRGB space
uniform sampler2D bumpMap;
uniform sampler2D emissiveMap;
@@ -249,3 +251,59 @@ void main()
a += f;
frag_color = vec4(color.rgb,a);
}
+
+#else
+
+uniform sampler2D diffuseMap; //always in sRGB space
+uniform sampler2D emissiveMap;
+
+uniform vec3 emissiveColor;
+
+out vec4 frag_color;
+
+in vec3 vary_position;
+
+in vec2 basecolor_texcoord;
+in vec2 emissive_texcoord;
+
+in vec4 vertex_color;
+
+#ifdef HAS_ALPHA_MASK
+uniform float minimum_alpha; // PBR alphaMode: MASK, See: mAlphaCutoff, setAlphaCutoff()
+#endif
+
+vec3 srgb_to_linear(vec3 c);
+vec3 linear_to_srgb(vec3 c);
+
+
+void main()
+{
+ vec3 color = vec3(0,0,0);
+
+ vec3 pos = vary_position;
+
+ vec4 basecolor = texture(diffuseMap, basecolor_texcoord.xy).rgba;
+ basecolor.rgb = srgb_to_linear(basecolor.rgb);
+#ifdef HAS_ALPHA_MASK
+ if (basecolor.a < minimum_alpha)
+ {
+ discard;
+ }
+#endif
+
+ color = vertex_color.rgb * basecolor.rgb;
+
+ // emissiveColor is the emissive color factor from GLTF and is already in linear space
+ vec3 colorEmissive = emissiveColor;
+ // emissiveMap here is a vanilla RGB texture encoded as sRGB, manually convert to linear
+ colorEmissive *= srgb_to_linear(texture2D(emissiveMap, emissive_texcoord.xy).rgb);
+
+
+ float a = basecolor.a*vertex_color.a;
+ a = 1.0;
+ color += colorEmissive;
+ color = linear_to_srgb(color);
+ frag_color = vec4(color.rgb,a);
+}
+
+#endif