mirror of
https://github.com/SangeloDev/SangeFault.git
synced 2024-11-13 00:52:43 +00:00
a50683c84e
basically starting over... this is gonna be fun!
23 lines
900 B
GLSL
23 lines
900 B
GLSL
#version 150
|
|
|
|
uniform sampler2D DiffuseSampler;
|
|
|
|
in vec2 texCoord;
|
|
in vec2 oneTexel;
|
|
|
|
out vec4 fragColor;
|
|
|
|
void main(){
|
|
vec4 center = texture(DiffuseSampler, texCoord);
|
|
vec4 left = texture(DiffuseSampler, texCoord - vec2(oneTexel.x, 0.0));
|
|
vec4 right = texture(DiffuseSampler, texCoord + vec2(oneTexel.x, 0.0));
|
|
vec4 up = texture(DiffuseSampler, texCoord - vec2(0.0, oneTexel.y));
|
|
vec4 down = texture(DiffuseSampler, texCoord + vec2(0.0, oneTexel.y));
|
|
float leftDiff = abs(center.a - left.a);
|
|
float rightDiff = abs(center.a - right.a);
|
|
float upDiff = abs(center.a - up.a);
|
|
float downDiff = abs(center.a - down.a);
|
|
float total = clamp(leftDiff + rightDiff + upDiff + downDiff, 0.0, 1.0);
|
|
vec3 outColor = center.rgb * center.a + left.rgb * left.a + right.rgb * right.a + up.rgb * up.a + down.rgb * down.a;
|
|
fragColor = vec4(outColor * 0.2, total);
|
|
}
|