diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-05-05 21:33:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-05-05 22:04:21 +0300 |
commit | b2188d631a81972f38548a333757eb21ddd784b0 (patch) | |
tree | 79e85fb3d5bc2ac0d96cecc4ec63d49659dd7d76 /source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl | |
parent | 3b075d0c8d86551e74672866a1a210adb9f24c24 (diff) |
Armature: Outline: Fix outline detection in critical cases.
Outline was not generated because the normal was completely orthogonal to
the view.
Diffstat (limited to 'source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl')
-rw-r--r-- | source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl index 73916163b9a..0d09114579c 100644 --- a/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl +++ b/source/blender/draw/modes/shaders/armature_shape_outline_vert.glsl @@ -45,7 +45,13 @@ void main() * barelly visible at the outline corners. */ ssNor = normalize((NormalMatrix * snor).xy); - vFacing = dot(V, normalize(NormalMatrix * nor)); + vec3 normal = normalize(NormalMatrix * nor); + /* Add a small bias to avoid loosing outline + * on faces orthogonal to the view. + * (test case: octahedral bone without rotation in front view.) */ + normal.z += 1e-6; + + vFacing = dot(V, normal); ssPos = proj(pPos); |