[Bf-blender-cvs] [083f932a252] master: Workbench: FXAA Artifacts

Jeroen Bakker noreply at git.blender.org
Wed May 22 14:50:43 CEST 2019


Commit: 083f932a252c1a88b85999188ff1aeccc87eab66
Author: Jeroen Bakker
Date:   Wed May 22 14:02:36 2019 +0200
Branches: master
https://developer.blender.org/rB083f932a252c1a88b85999188ff1aeccc87eab66

Workbench: FXAA Artifacts

When using FXAA when rendering to an image the alpha channel was not
correct what lead to visual artifacts.

These artifacts come from the FXAA function that overwrites the alpha
channel with the original Luma of the texel. In the shader this can be
turned on or off. But at the end it always overwrites the alpha with the
luminance.

We didn't use this feature, but the alpha of the resulting pixel still
contained the luma value what lead to render artifacts.
By overwriting the alpha channel with the original alpha we remove these
artifacts.

Reviewed By: fclem

Maniphest Tasks: T64947

Differential Revision: https://developer.blender.org/D4924

===================================================================

M	source/blender/draw/engines/workbench/shaders/workbench_effect_fxaa_frag.glsl

===================================================================

diff --git a/source/blender/draw/engines/workbench/shaders/workbench_effect_fxaa_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_effect_fxaa_frag.glsl
index 46b0361245b..092878e43aa 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_effect_fxaa_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_effect_fxaa_frag.glsl
@@ -8,6 +8,9 @@ uniform vec2 invertedViewportSize;
 
 void main()
 {
+  ivec2 texel = ivec2(gl_FragCoord.xy);
+  float alpha = texelFetch(colorBuffer, texel, 0).a;
   FragColor = FxaaPixelShader(
       uvcoordsvar.st, colorBuffer, invertedViewportSize, 1.0, 0.166, 0.0833);
+  FragColor.a = alpha;
 }



More information about the Bf-blender-cvs mailing list