Paint Overlay: Fix blending of the brush overlay
This commit is contained in:
parent
07d0f2eb01
commit
477b4559ec
|
@ -685,6 +685,7 @@ static void paint_draw_tex_overlay(
|
|||
immUniformColor4f(1.0f, 1.0f, 1.0f, overlay_alpha * 0.01f);
|
||||
}
|
||||
else {
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_ALPHA_COLOR);
|
||||
immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, overlay_alpha * 0.01f);
|
||||
}
|
||||
|
@ -704,6 +705,7 @@ static void paint_draw_tex_overlay(
|
|||
immEnd();
|
||||
|
||||
immUnbindProgram();
|
||||
GPU_blend_set_func(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_VIEW)) {
|
||||
GPU_matrix_pop();
|
||||
|
@ -764,7 +766,8 @@ static void paint_draw_cursor_overlay(
|
|||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR);
|
||||
GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_ALPHA_COLOR);
|
||||
|
||||
immUniformColor3fvAlpha(U.sculpt_paint_overlay_col, brush->cursor_overlay_alpha * 0.01f);
|
||||
|
||||
|
@ -786,6 +789,8 @@ static void paint_draw_cursor_overlay(
|
|||
|
||||
immUnbindProgram();
|
||||
|
||||
GPU_blend_set_func(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (do_pop)
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
|
|
|
@ -7,5 +7,8 @@ uniform sampler2D image;
|
|||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(image, texCoord_interp).r * color;
|
||||
fragColor = texture(image, texCoord_interp).r * color.rgba;
|
||||
/* Premul by alpha (not texture alpha)
|
||||
* Use blending function GPU_blend_set_func(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); */
|
||||
fragColor.rgb *= color.a;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue