summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-04-11 20:06:33 -0500
committerDave Parks <davep@lindenlab.com>2022-04-11 20:06:33 -0500
commite33f23f58a2caa561dfe4b3b114786f40983d136 (patch)
treebfde276b90a3dfdb004abf96e530dbb7144fe8ea /indra/newview/app_settings/shaders
parentcb6e1ac4a8a9c459202e1fcc27c1067c61d2ce26 (diff)
SL-17194 Impostor quality pass 2 (and fix for fully transparent rigged attachments rendering to depth buffer)
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl29
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl3
2 files changed, 17 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 38afd82c8d..02b2daf0ac 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -56,7 +56,7 @@ VARYING vec3 vary_norm;
VARYING vec4 vertex_color; //vertex color should be treated as sRGB
#endif
-#ifdef FOR_IMPOSTOR
+#ifdef HAS_ALPHA_MASK
uniform float minimum_alpha;
#endif
@@ -195,7 +195,6 @@ void main()
#endif
vec4 diffuse_srgb = diffuse_tap;
- vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
#ifdef FOR_IMPOSTOR
vec4 color;
@@ -204,33 +203,37 @@ void main()
float final_alpha = diffuse_srgb.a * vertex_color.a;
diffuse_srgb.rgb *= vertex_color.rgb;
- diffuse_linear.rgb = srgb_to_linear(diffuse_srgb.rgb);
// Insure we don't pollute depth with invis pixels in impostor rendering
//
- if (final_alpha < minimum_alpha)
+ if (final_alpha < minimum_alpha)
{
discard;
}
color.rgb = diffuse_srgb.rgb;
color.a = final_alpha;
-#else
-
+
+#else // FOR_IMPOSTOR
+
+ vec4 diffuse_linear = vec4(srgb_to_linear(diffuse_srgb.rgb), diffuse_srgb.a);
+
vec3 light_dir = (sun_up_factor == 1) ? sun_dir: moon_dir;
float final_alpha = diffuse_linear.a;
#ifdef USE_VERTEX_COLOR
- if (vertex_color.a <= 0.0)
+ final_alpha *= vertex_color.a;
+
+ if (final_alpha < minimum_alpha)
{ // TODO: figure out how to get invisible faces out of
// render batches without breaking glow
discard;
}
- final_alpha *= vertex_color.a;
+
diffuse_srgb.rgb *= vertex_color.rgb;
diffuse_linear.rgb = srgb_to_linear(diffuse_srgb.rgb);
-#endif
+#endif // USE_VERTEX_COLOR
vec3 sunlit;
vec3 amblit;
@@ -262,13 +265,13 @@ void main()
#if !defined(AMBIENT_KILL)
color.rgb = amblit;
color.rgb *= ambient;
-#endif
+#endif // !defined(AMBIENT_KILL)
vec3 post_ambient = color.rgb;
#if !defined(SUNLIGHT_KILL)
color.rgb += sun_contrib;
-#endif
+#endif // !defined(SUNLIGHT_KILL)
vec3 post_sunlight = color.rgb;
@@ -300,7 +303,7 @@ vec3 post_atmo = color.rgb;
// sum local light contrib in linear colorspace
#if !defined(LOCAL_LIGHT_KILL)
color.rgb += light.rgb;
-#endif
+#endif // !defined(LOCAL_LIGHT_KILL)
// back to sRGB as we're going directly to the final RT post-deferred gamma correction
color.rgb = linear_to_srgb(color.rgb);
@@ -319,7 +322,7 @@ vec3 post_atmo = color.rgb;
color = applyWaterFogView(pos.xyz, color);
#endif // WATER_FOG
-#endif
+#endif // #else // FOR_IMPOSTOR
frag_color = color;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
index eb6e56e718..a58cc3d12d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl
@@ -54,8 +54,7 @@ void main()
vec4 norm = texture2D(normalMap, vary_texcoord0.xy);
vec4 spec = texture2D(specularMap, vary_texcoord0.xy);
- col.rgb = linear_to_srgb(col.rgb);
frag_data[0] = vec4(col.rgb, 0.0);
frag_data[1] = spec;
- frag_data[2] = vec4(norm.xy,0,0);
+ frag_data[2] = norm;
}