Blur behind buttons/sprites should now be working as intended.

This commit is contained in:
Tleety
2016-03-08 11:14:09 +01:00
parent 6b7f598c4d
commit 01f29b6d4e
13 changed files with 6053 additions and 250 deletions
+11 -5
View File
@@ -1,14 +1,15 @@
#version 430
uniform sampler2D Texture0;
uniform sampler2D Texture1;
layout (binding = 0) uniform sampler2D Texture0;
layout (binding = 1)uniform sampler2D Texture1;
in VertexData{
vec2 TextureCoordinate;
}Input;
out vec4 fragmentColor;
out vec4 sceneColor;
out vec4 bloomColor;
void main()
{
@@ -17,9 +18,14 @@ void main()
float texel1_total = (texel1.r + texel1.g + texel1.b) * texel1.a;
texel1_total = ceil(clamp(texel1_total, 0, 1));
vec4 final = texel0 * texel1_total + texel1 * (1 - texel1_total);
vec4 result0 = texel0 * (1.0 - texel1_total);
vec4 result1 = texel1 * texel1_total;
//vec4 final = texel1 * texel1_total + texel0 * (1.0 - texel1_total);
//float res = 1.0 - texel1_total;
//vec4 final = vec4(texel1_total, texel1_total, texel1_total, 1.0);
fragmentColor = final;
sceneColor = result1;
bloomColor = vec4(0.0, 0.0, 0.0, 0.0);
}
+8 -4
View File
@@ -14,11 +14,15 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
vec3 center = texture(Texture, Input.TextureCoordinate).rgb;
vec3 result = center * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
result += texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0)).rgb * weight[i];
vec4 eastFragments = texture(Texture, Input.TextureCoordinate + vec2(tex_offset.x * i, 0.0));
vec4 westFragments = texture(Texture, Input.TextureCoordinate - vec2(tex_offset.x * i, 0.0));
result += eastFragments.rgb * weight[i] * eastFragments.a;
result += westFragments.rgb * weight[i] * westFragments.a;
result += center * weight[i] * (1.0 - westFragments.a);
result += center * weight[i] * (1.0 - eastFragments.a);
}
fragmentColor = vec4(result, 1.0);
}
+8 -4
View File
@@ -14,11 +14,15 @@ uniform float weight[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.01
void main()
{
vec2 tex_offset = 1.0 / textureSize2D(Texture, 0);
vec3 result = texture(Texture, Input.TextureCoordinate).rgb * weight[0];
vec3 center = texture(Texture, Input.TextureCoordinate).rgb;
vec3 result = center * weight[0];
for(int i = 1; i < 5; ++i) {
result += texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i)).rgb * weight[i];
result += texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i)).rgb * weight[i];
vec4 northFragments = texture(Texture, Input.TextureCoordinate + vec2(0.0, tex_offset.y * i));
vec4 southFragments = texture(Texture, Input.TextureCoordinate - vec2(0.0, tex_offset.y * i));
result += northFragments.rgb * weight[i] * northFragments.a;
result += southFragments.rgb * weight[i] * southFragments.a;
result += center * weight[i] * (1.0 - northFragments.a);
result += center * weight[i] * (1.0 - southFragments.a);
}
fragmentColor = vec4(result, 1.0);
}
+2 -1
View File
@@ -35,7 +35,8 @@ void main()
sceneColor = vec4(color_result.xyz, clamp(color_result.a, 0, 1));
//bloomColor = vec4(clamp((glowTexel.xyz*3) - 1.0, 0, 100), 1.0);
bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
bloomColor = vec4(max(color_result.xyz - 1.0, 0.0), clamp(color_result.a, 0, 1));
//bloomColor = vec4(1.0, 1.0, 1.0, 0.0);
}