When in texture paint mode and in solid mode the object that is being texture painted will be rendered by the workbench engine with textures. All other objects would render the same. For other cases the texture paint draw engine will still draw the texture. The texture mode draw engine now only drawn the masks. The opacity sliders influences the texture mask. This change has been implemented conserably. In the future we need to look into making this better, like adding support that every object can be colored differently. Currently when rendering in the workbench we can have up to 3 different color types active (what the user selected, the fallback in case no materials have been configured and this one, forcing textures) Reviewed By: fclem, brecht Differential Revision: https://developer.blender.org/D5190
26 lines
557 B
GLSL
26 lines
557 B
GLSL
in vec2 masking_uv_interp;
|
|
|
|
out vec4 fragColor;
|
|
|
|
uniform float alpha = 1.0;
|
|
|
|
uniform sampler2D maskingImage;
|
|
uniform bool maskingImagePremultiplied;
|
|
uniform vec3 maskingColor;
|
|
uniform bool maskingInvertStencil;
|
|
|
|
void main()
|
|
{
|
|
|
|
vec4 mask = vec4(
|
|
texture_read_as_srgb(maskingImage, maskingImagePremultiplied, masking_uv_interp).rgb, 1.0);
|
|
if (maskingInvertStencil) {
|
|
mask.rgb = 1.0 - mask.rgb;
|
|
}
|
|
float mask_step = smoothstep(0, 3.0, mask.r + mask.g + mask.b);
|
|
mask.rgb *= maskingColor;
|
|
mask.a = mask_step * alpha;
|
|
|
|
fragColor = mask;
|
|
}
|