[Bf-blender-cvs] [6e1eaa91606] greasepencil-refactor: GPencil: Refactor: Fix Fills texture color mixing
Clément Foucault
noreply at git.blender.org
Thu Dec 12 02:47:54 CET 2019
Commit: 6e1eaa916067f28edf5dd97b5553b843a1aa54d8
Author: Clément Foucault
Date: Thu Dec 12 02:47:49 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB6e1eaa916067f28edf5dd97b5553b843a1aa54d8
GPencil: Refactor: Fix Fills texture color mixing
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_data.c
M source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index d2842d35155..7784a092f3d 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -159,8 +159,8 @@ GPENCIL_MaterialPool *gpencil_material_pool_create(GPENCIL_PrivateData *pd, Obje
gp_style->texture_scale,
gp_style->texture_angle,
mat_data->fill_uv_transform);
- copy_v4_v4(mat_data->fill_color, gp_style->mix_rgba);
- mat_data->fill_texture_mix = 1.0f - gp_style->texture_opacity;
+ copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
+ mat_data->fill_texture_mix = 1.0f - gp_style->mix_factor;
}
else if (gp_style->fill_style == GP_STYLE_FILL_STYLE_TEXTURE) {
/* TODO implement gradient as a texture. */
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
index e9317f8bef7..b4044215fdd 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_vert.glsl
@@ -93,7 +93,7 @@ float stroke_thickness_modulate(float thickness)
return thickness;
}
-void stroke_color_output(vec4 stroke_col, vec4 vert_col, float vert_strength, float mix_tex)
+void color_output(vec4 stroke_col, vec4 vert_col, float vert_strength, float mix_tex)
{
/* Mix stroke with vertex color. */
vec4 mixed_col;
@@ -202,7 +202,7 @@ void stroke_vertex()
vec4 stroke_col = materials[m].stroke_color;
float mix_tex = materials[m].stroke_texture_mix;
- stroke_color_output(stroke_col, vert_col, vert_strength, mix_tex);
+ color_output(stroke_col, vert_col, vert_strength, mix_tex);
matFlag = materials[m].flag & ~GP_FILL_FLAGS;
@@ -226,13 +226,7 @@ void fill_vertex()
vec4 fill_col = materials[m].fill_color;
float mix_tex = materials[m].fill_texture_mix;
- /* We add the mixed color. This is 100% mix (no texture visible). */
- finalColorMul = vec4(fill_col.aaa, fill_col.a);
- finalColorAdd = vec4(fill_col.rgb * fill_col.a, 0.0);
- /* Then we blend according to the texture mix factor.
- * Note that we keep the alpha modulation. */
- finalColorMul.rgb *= mix_tex;
- finalColorAdd.rgb *= 1.0 - mix_tex;
+ color_output(fill_col, vec4(0.0), 1.0, mix_tex);
matFlag = materials[m].flag & GP_FILL_FLAGS;
More information about the Bf-blender-cvs
mailing list