GPencil: Fix clamp alpha problems when using Regular blend

The problem was the alpha was not premult and the opacity factor was applied two times.
This commit is contained in:
Antonio Vazquez 2019-06-12 16:55:24 +02:00
parent da38558da2
commit db5c8c0393
1 changed files with 5 additions and 1 deletions

View File

@ -115,7 +115,11 @@ void main()
if (mode == MODE_REGULAR) {
if (stroke_color.a > 0) {
if (mix_color.a > 0) {
FragColor = vec4(mix(stroke_color.rgb, mix_color.rgb, mix_color.a * blend_opacity),
/* premult */
stroke_color = vec4(vec3(stroke_color.rgb / stroke_color.a), stroke_color.a);
mix_color = vec4(vec3(mix_color.rgb / mix_color.a), mix_color.a);
FragColor = vec4(mix(stroke_color.rgb, mix_color.rgb, mix_color.a),
stroke_color.a);
gl_FragDepth = mix_depth;
}