[Bf-blender-cvs] [34a627f3452] blender2.8: Fix T56992: OpenGL Render Engine ignores Transparent Background
Clément Foucault
noreply at git.blender.org
Wed Oct 3 15:44:16 CEST 2018
Commit: 34a627f345218c8a6688eb6e72e1892a4e765508
Author: Clément Foucault
Date: Tue Oct 2 18:20:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB34a627f345218c8a6688eb6e72e1892a4e765508
Fix T56992: OpenGL Render Engine ignores Transparent Background
Correct the outline blending for alpha 0 background.
===================================================================
M source/blender/draw/engines/workbench/shaders/workbench_deferred_composite_frag.glsl
===================================================================
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;
}
More information about the Bf-blender-cvs
mailing list