diff options
author | Dave Parks <davep@lindenlab.com> | 2022-09-23 17:48:45 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-09-23 17:48:45 -0500 |
commit | f4d49f887e0a7b8e0230faa22ce5b2efc026c54d (patch) | |
tree | abec7fd517433e15abf0aaffc2032ae9c380e3b0 /indra | |
parent | 75de4d32768bb1359611dc7cd963c9a12f94423d (diff) |
SL-18190 Reduce banding.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl | 19 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 2 |
2 files changed, 19 insertions, 2 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; } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index b14ceedac8..26989a477a 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7731,7 +7731,7 @@ void LLPipeline::renderFinalize() RenderDepthOfField && !gCubeSnapshot; - bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete(); + bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete() && !gCubeSnapshot; gViewerWindow->setup3DViewport(); |