27 lines
514 B
GLSL
27 lines
514 B
GLSL
#version 150 core
|
|
|
|
uniform sampler2D Texture;
|
|
uniform vec4 Fill;
|
|
|
|
in vec2 TextureCoord;
|
|
|
|
out vec4 FragColor;
|
|
|
|
#define MEDIAN(x, y, z) max(min(x, y), min(max(x, y), z))
|
|
|
|
void main() {
|
|
vec4 msd = texture2D(Texture, TextureCoord);
|
|
|
|
// float sd = MEDIAN(msd.r, msd.g, msd.b);
|
|
// float fw = fwidth(sd);
|
|
// float alpha = smoothstep(0.5 - fw, 0.5 + fw, sd);
|
|
|
|
float sd = msd.a;
|
|
float fw = 6 / 16.0;
|
|
float alpha = smoothstep(0.5 - fw, 0.5 + fw, sd);
|
|
|
|
// float alpha = msd.a;
|
|
|
|
FragColor = Fill * alpha;
|
|
}
|