Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntonioya <blendergit@gmail.com>2019-06-12 17:55:24 +0300
committerAntonioya <blendergit@gmail.com>2019-06-12 17:55:24 +0300
commitdb5c8c0393ba94f7ff523e1079ce4642fee661a8 (patch)
tree6a5872c72a904bbc261a2d529c1b38e33a6c1c3b /source
parentda38558da2bc3e460edf9f72c5e16ebe29815515 (diff)
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.
Diffstat (limited to 'source')
-rw-r--r--source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
index 4a6025fcd24..658c708ee19 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_blend_frag.glsl
@@ -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;
}