Welcome to mirror list, hosted at ThFree Co, Russian Federation.

paint_texture_frag.glsl « shaders « modes « draw « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: edd7c2af0017f7e9c0be8d2e2465b96c37ae7cfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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;
}