summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-09-23 17:48:45 -0500
committerDave Parks <davep@lindenlab.com>2022-09-23 17:48:45 -0500
commitf4d49f887e0a7b8e0230faa22ce5b2efc026c54d (patch)
treeabec7fd517433e15abf0aaffc2032ae9c380e3b0 /indra/newview/app_settings
parent75de4d32768bb1359611dc7cd963c9a12f94423d (diff)
SL-18190 Reduce banding.
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl19
1 files changed, 18 insertions, 1 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index cd37a34e0d..539e28aae6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -41,12 +41,29 @@ uniform float display_gamma;
vec3 linear_to_srgb(vec3 cl);
+//=================================
+// borrowed noise from:
+// <https://www.shadertoy.com/view/4dS3Wd>
+// By Morgan McGuire @morgan3d, http://graphicscodex.com
+//
+float hash(float n) { return fract(sin(n) * 1e4); }
+
+float noise(float x) {
+ float i = floor(x);
+ float f = fract(x);
+ float u = f * f * (3.0 - 2.0 * f);
+ return mix(hash(i), hash(i + 1.0), u);
+}
+//=============================
+
void main()
{
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
- //diff.rgb = pow(diff.rgb, vec3(display_gamma));
diff.rgb = linear_to_srgb(diff.rgb);
+ vec3 seed = diff.rgb*vec3(vary_fragcoord.xy, vary_fragcoord.x+vary_fragcoord.y)*2048;
+ vec3 nz = vec3(noise(seed.r), noise(seed.g), noise(seed.b));
+ diff.rgb += nz*0.008;
frag_color = diff;
}