diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-10-02 19:20:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-03 16:44:12 +0300 |
commit | 34a627f345218c8a6688eb6e72e1892a4e765508 (patch) | |
tree | dbd8806d86c71fefbb3e6de84fd1550577ee7195 | |
parent | 36d457e8872ca9c6a779d671b65999e1706797ed (diff) |
Fix T56992: OpenGL Render Engine ignores Transparent Background
Correct the outline blending for alpha 0 background.
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl index bf856fbb212..a5e81526216 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl @@ -44,7 +44,11 @@ void main() fragColor = vec4(background, world_data.background_alpha); } else { - fragColor = vec4(mix(world_data.object_outline_color.rgb, background, object_outline), clamp(world_data.background_alpha, 1.0, object_outline)); + /* Do correct alpha blending. */ + vec4 background_color = vec4(background, 1.0); + vec4 outline_color = vec4(world_data.object_outline_color.rgb, 1.0) * world_data.background_alpha; + fragColor = mix(outline_color, background_color, object_outline); + fragColor = vec4(fragColor.rgb / max(1e-8, fragColor.a), fragColor.a); } return; } |