Vertex Paint: multiply vertex paint overlay

Fixes the first part of T56999.

Reviewer: brecht

Differential Revision: https://developer.blender.org/D3768
This commit is contained in:
Jacques Lucke 2018-10-05 14:03:22 +02:00
parent 23e9b35bf4
commit 7c443ded1e
2 changed files with 6 additions and 5 deletions

View File

@ -115,10 +115,10 @@ static void PAINT_VERTEX_cache_init(void *vedata)
/* Create a pass */
psl->vcolor_faces = DRW_pass_create(
"Vert Color Pass",
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND);
DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_MULTIPLY);
stl->g_data->fvcolor_shgrp = DRW_shgroup_create(e_data.vcolor_face_shader, psl->vcolor_faces);
DRW_shgroup_uniform_float(stl->g_data->fvcolor_shgrp, "alpha", &v3d->overlay.vertex_paint_mode_opacity, 1);
DRW_shgroup_uniform_float_copy(stl->g_data->fvcolor_shgrp, "white_factor", 1.0f - v3d->overlay.vertex_paint_mode_opacity);
}
{

View File

@ -2,7 +2,8 @@
in vec3 finalColor;
out vec4 fragColor;
uniform float alpha = 1.0;
uniform float white_factor = 1.0;
vec3 linear_to_srgb_attrib(vec3 c) {
c = max(c, vec3(0.0));
vec3 c1 = c * 12.92;
@ -12,6 +13,6 @@ vec3 linear_to_srgb_attrib(vec3 c) {
void main()
{
fragColor.rgb = linear_to_srgb_attrib(finalColor);
fragColor.a = alpha;
fragColor.rgb = mix(linear_to_srgb_attrib(finalColor), vec3(1.0), white_factor);
fragColor.a = 1.0;
}