The clone tool in the image editor can show a second texture on top of the image. This wasn't ported and now results into alpha and depth issues. This fix adds the clone tool drawing to the overlay engine. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D9352
34 lines
693 B
GLSL
34 lines
693 B
GLSL
#pragma BLENDER_REQUIRE(common_colormanagement_lib.glsl)
|
|
|
|
uniform sampler2D imgTexture;
|
|
uniform bool imgPremultiplied;
|
|
uniform bool imgAlphaBlend;
|
|
uniform vec4 color;
|
|
|
|
in vec2 uvs;
|
|
|
|
out vec4 fragColor;
|
|
|
|
void main()
|
|
{
|
|
vec2 uvs_clamped = clamp(uvs, 0.0, 1.0);
|
|
vec4 tex_color;
|
|
tex_color = texture_read_as_linearrgb(imgTexture, imgPremultiplied, uvs_clamped);
|
|
|
|
fragColor = tex_color * color;
|
|
|
|
if (!imgAlphaBlend) {
|
|
/* Arbitrary discard anything below 5% opacity.
|
|
* Note that this could be exposed to the User. */
|
|
if (tex_color.a < 0.05) {
|
|
discard;
|
|
}
|
|
else {
|
|
fragColor.a = 1.0;
|
|
}
|
|
}
|
|
|
|
/* Pre-multiplied blending. */
|
|
fragColor.rgb *= fragColor.a;
|
|
}
|