Fix T56992: OpenGL Render Engine ignores Transparent Background

Correct the outline blending for alpha 0 background.
This commit is contained in:
Clément Foucault 2018-10-02 18:20:55 +02:00
parent 36d457e887
commit 34a627f345
Notes: blender-bot 2023-02-14 08:06:33 +01:00
Referenced by issue #56992, OpenGL Render Engine ignores Transparent Background
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}