109 lines
3.8 KiB
Text
109 lines
3.8 KiB
Text
|
|
#version 460
|
||
|
|
layout(location = 0) out vec4 FragColor;
|
||
|
|
|
||
|
|
in vec2 TexCoord;
|
||
|
|
|
||
|
|
uniform sampler2D Tex;
|
||
|
|
|
||
|
|
float pixel = 1.0f/1600.0f;
|
||
|
|
|
||
|
|
vec3 accentColor = vec3(0.8f,0.533f,0.6f);
|
||
|
|
//vec3(0,1,1);
|
||
|
|
|
||
|
|
|
||
|
|
vec2 SampleCircle[22] = vec2[22](
|
||
|
|
vec2(0.0f*pixel,1.0f*pixel),
|
||
|
|
vec2(0.28173255684142967f*pixel,0.9594929736144974f*pixel),
|
||
|
|
vec2(0.5406408174555976f*pixel,0.8412535328311812f*pixel),
|
||
|
|
vec2(0.7557495743542583f*pixel,0.6548607339452851f*pixel),
|
||
|
|
vec2(0.9096319953545183f*pixel,0.41541501300188644f*pixel),
|
||
|
|
vec2(0.9898214418809327f*pixel,0.14231483827328512f*pixel),
|
||
|
|
vec2(0.9898214418809328f*pixel,-0.142314838273285f*pixel),
|
||
|
|
vec2(0.9096319953545184f*pixel,-0.4154150130018863f*pixel),
|
||
|
|
vec2(0.7557495743542583f*pixel,-0.654860733945285f*pixel),
|
||
|
|
vec2(0.5406408174555978f*pixel,-0.8412535328311811f*pixel),
|
||
|
|
vec2(0.28173255684142967f*pixel,-0.9594929736144974f*pixel),
|
||
|
|
vec2(0.00000000000000012246467991473532f*pixel,-1.0f*pixel),
|
||
|
|
vec2(-0.2817325568414294f*pixel,-0.9594929736144975f*pixel),
|
||
|
|
vec2(-0.5406408174555976f*pixel,-0.8412535328311812f*pixel),
|
||
|
|
vec2(-0.7557495743542582f*pixel,-0.6548607339452852f*pixel),
|
||
|
|
vec2(-0.9096319953545184f*pixel,-0.4154150130018864f*pixel),
|
||
|
|
vec2(-0.9898214418809327f*pixel,-0.14231483827328523f*pixel),
|
||
|
|
vec2(-0.9898214418809328f*pixel,0.14231483827328487f*pixel),
|
||
|
|
vec2(-0.9096319953545186f*pixel,0.41541501300188605f*pixel),
|
||
|
|
vec2(-0.7557495743542582f*pixel,0.6548607339452853f*pixel),
|
||
|
|
vec2(-0.5406408174555974f*pixel,0.8412535328311812f*pixel),
|
||
|
|
vec2(-0.2817325568414298f*pixel,0.9594929736144974f*pixel)
|
||
|
|
);
|
||
|
|
|
||
|
|
vec2 SampleCircleSmol[16] = vec2[16](
|
||
|
|
vec2(0.0f*pixel,1.0f*pixel),
|
||
|
|
vec2(0.3826834323650898f*pixel,0.9238795325112867f*pixel),
|
||
|
|
vec2(0.7071067811865475f*pixel,0.7071067811865476f*pixel),
|
||
|
|
vec2(0.9238795325112867f*pixel,0.38268343236508984f*pixel),
|
||
|
|
vec2(1.0f*pixel,0.00000000000000006123233995736766f*pixel),
|
||
|
|
vec2(0.9238795325112867f*pixel,-0.3826834323650897f*pixel),
|
||
|
|
vec2(0.7071067811865476f*pixel,-0.7071067811865475f*pixel),
|
||
|
|
vec2(0.3826834323650899f*pixel,-0.9238795325112867f*pixel),
|
||
|
|
vec2(0.00000000000000012246467991473532f*pixel,-1.0f*pixel),
|
||
|
|
vec2(-0.38268343236508967f*pixel,-0.9238795325112868f*pixel),
|
||
|
|
vec2(-0.7071067811865475f*pixel,-0.7071067811865477f*pixel),
|
||
|
|
vec2(-0.9238795325112865f*pixel,-0.38268343236509034f*pixel),
|
||
|
|
vec2(-1.0f*pixel,-0.00000000000000018369701987210297f*pixel),
|
||
|
|
vec2(-0.9238795325112866f*pixel,0.38268343236509f*pixel),
|
||
|
|
vec2(-0.7071067811865477f*pixel,0.7071067811865474f*pixel),
|
||
|
|
vec2(-0.3826834323650904f*pixel,0.9238795325112865f*pixel)
|
||
|
|
);
|
||
|
|
|
||
|
|
vec2 SampleDirs[4] = vec2[4](vec2(-pixel,0.0f),
|
||
|
|
vec2(0.0f,-pixel),
|
||
|
|
vec2(0.0f,pixel),
|
||
|
|
vec2(pixel,0.0f));
|
||
|
|
|
||
|
|
float euler = 2.71828182845904523536f;
|
||
|
|
|
||
|
|
float distribution = 7.5f;
|
||
|
|
|
||
|
|
float maxinc = 0.5f;
|
||
|
|
|
||
|
|
float gaussian(float x){
|
||
|
|
return maxinc * pow(euler,
|
||
|
|
-(pow(x,2.0f)
|
||
|
|
/
|
||
|
|
pow(2.0f*distribution,2.0f)));
|
||
|
|
}
|
||
|
|
|
||
|
|
void main(){
|
||
|
|
vec4 color = texture(Tex,TexCoord.xy);
|
||
|
|
|
||
|
|
FragColor = color;
|
||
|
|
|
||
|
|
if(color.a != 1){
|
||
|
|
for(int j = 1; j <= 2; j++){
|
||
|
|
for(int i = 0; i < 16; i++){
|
||
|
|
float Test = texture(Tex, vec2(TexCoord.xy + (SampleCircleSmol[i].xy * j))).a;
|
||
|
|
|
||
|
|
if(Test != 0)
|
||
|
|
FragColor = vec4(accentColor,1);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if(color.a > 0){
|
||
|
|
bool finished = false;
|
||
|
|
for(float i = 1.0f; i < 64.0f; i += 2.0f){
|
||
|
|
for(int j = 0; j < 22; j++){
|
||
|
|
float Test = texture(Tex, vec2(TexCoord.xy + (SampleCircle[j].xy * i))).a;
|
||
|
|
|
||
|
|
if(Test == 0 && !finished){
|
||
|
|
float val = gaussian(i);
|
||
|
|
|
||
|
|
FragColor = vec4((accentColor * val * 2.0f ) + (color.xyz * 1.0f - val ),1.0f);
|
||
|
|
finished = true;
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|