This repository has been archived on 2023-10-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
blender-archive/source/blender/draw/modes/shaders/paint_texture_frag.glsl

26 lines
557 B
GLSL
Raw Normal View History

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;
}