summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-05-25 13:09:03 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-05-25 13:09:03 -0500
commitc12712aa9609325ba3247a67354e91e9342106d6 (patch)
treecbd3f62efcd268b005c88c832cdeda8dfaa96281 /indra
parent64a59928d0c03389bfce4cc95f5c4a565111dcb6 (diff)
DRTVWR-559 Fix for off-color fullbright alpha blinn-phong materials. Scrub some NaNs.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl3
4 files changed, 6 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
index ee425f97fc..c8afacf9bb 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl
@@ -47,6 +47,6 @@ void main()
tc.y -= 0.1; // HACK - nudge exposure sample down a little bit to favor ground over sky
vec3 c = texture(diffuseRect, tc).rgb + texture(emissiveRect, tc).rgb;
float L = lum(c);
- frag_color = vec4(L);
+ frag_color = vec4(max(L, 0.0));
}
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index 689c345b2c..7111a822c8 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -124,7 +124,7 @@ vec3 legacy_adjust(vec3 c)
vec3 legacy_adjust_fullbright(vec3 c)
{
- float exp_scale = texture(exposureMap, vec2(0.5, 0.5)).r;
+ float exp_scale = clamp(texture(exposureMap, vec2(0.5, 0.5)).r, 0.01, 10.0);
return c / exp_scale * 1.34; //magic 1.34 arrived at by binary search for a value that reproduces midpoint grey consistenty
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index 7b7b4a040c..e6aef7abdc 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -258,7 +258,7 @@ void main()
glare = min(glare, 1.0);
a = max(a, glare);
- frag_color = vec4(color.rgb,a);
+ frag_color = max(vec4(color.rgb,a), vec4(0));
}
#else
@@ -311,7 +311,7 @@ void main()
float a = basecolor.a*vertex_color.a;
color += colorEmissive;
color = linear_to_srgb(color);
- frag_color = vec4(color.rgb,a);
+ frag_color = max(vec4(color.rgb,a), vec4(0));
}
#endif
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index 77e3b92385..ba19fe0f19 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -49,6 +49,7 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float
vec3 srgb_to_linear(vec3 cs);
vec3 linear_to_srgb(vec3 cs);
vec3 legacy_adjust(vec3 c);
+vec3 legacy_adjust_fullbright(vec3 c);
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
@@ -396,7 +397,7 @@ void main()
}
#endif
- color = mix(color.rgb, diffcol.rgb, emissive);
+ color = mix(color.rgb, legacy_adjust_fullbright(diffcol.rgb), emissive);
if (env > 0.0)
{ // add environmentmap