Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-01-20 21:29:09 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-01-20 21:36:08 +0300
commit335930ab4efffdf0da751cbb90598353cebffb3b (patch)
tree04e1d440d1c4030a8eee942859fb7944e6adff1d /source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl
parent31e2786707049c40b9d8639639fd16a5cc0dce13 (diff)
Overlay: Improve Outline diagonal Antialiasing
I doubt we can do much better. Most of the aliasing comes from the edge detection which does not use a lot of samples. We could use more samples but then the detection becomes way more complex and expensive. The second issue comes from the reconstruction (AA pass) that only bleed adjacent pixels in if their line direction is perpendicular to the offset. This makes corner gaps on certain diagonals.
Diffstat (limited to 'source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl')
-rw-r--r--source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl2
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl
index 4784d420e1d..0d01f67c6ea 100644
--- a/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/antialiasing_frag.glsl
@@ -144,6 +144,8 @@ void main()
vec4 lines = vec4(neightbor_line0.z, neightbor_line1.z, neightbor_line2.z, neightbor_line3.z);
/* Count number of line neighbors. */
float blend = dot(vec4(0.25), step(0.001, lines));
+ /* Only do blend if there is more than 2 neighbor. This avoid loosing too much AA. */
+ blend = clamp(blend * 2.0 - 1.0, 0.0, 1.0);
fragColor = mix(fragColor, fragColor / fragColor.a, blend);
}
#endif