diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-10-04 16:04:51 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-10-04 16:04:51 +0300 |
commit | 71bb98ca97617a4d2102b6f08198015f66e835ad (patch) | |
tree | 6263662aa2e7b871946f8333f4dd6b983df094e4 /source/blender/gpu/shaders | |
parent | 633dd0c47c80cfd1b6b33deaf1648826e38fbb07 (diff) |
Initial blending mode.
Diffstat (limited to 'source/blender/gpu/shaders')
-rw-r--r-- | source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl | 5 | ||||
-rw-r--r-- | source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_lib.glsl | 11 |
2 files changed, 15 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl index 2d64d9f2699..4fea3dd353d 100644 --- a/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl +++ b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_comp.glsl @@ -49,7 +49,10 @@ void main() // TODO: blend with color... float factor = SCULPT_hardness_factor(distance, step_data.hardness, step_data.radius); float curve_factor = SCULPT_curve_strength(factor, BRUSH_CURVE_PRESET); - color = max(color, paint_brush_buf.color * curve_factor); + vec4 final_paint_color = SCULPT_blend_color( + color, paint_brush_buf.color * curve_factor * step_data.strength); + final_paint_color *= paint_brush_buf.alpha; + color = SCULPT_blend_color(color, final_paint_color); } } if (color_read) { diff --git a/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_lib.glsl b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_lib.glsl index 8ea29f4bbae..68ec47d7fd3 100644 --- a/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_lib.glsl +++ b/source/blender/gpu/shaders/sculpt_paint/sculpt_paint_image_lib.glsl @@ -3,6 +3,17 @@ /** \name Brush testing * \{ */ +vec4 SCULPT_blend_color(vec4 src1, vec4 src2) +{ + return src1 * (1.0 - src2.a) + src2; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Brush testing + * \{ */ + float SCULPT_curve_strength(float factor, int curve_type) { if (factor > 1.0) { |