Fix a stupid bug in bloom

This commit is contained in:
danyalzia 2013-10-31 21:30:24 +05:00
parent af158bf6cc
commit 0bf06010bc

View File

@ -10,7 +10,7 @@ precision mediump int;
uniform sampler2D sampler0;
varying vec2 v_texcoord0;
float amount = 0.75; // suitable range = 0.00 - 1.00
float amount = 0.60; // suitable range = 0.00 - 1.00
float power = 0.5; // suitable range = 0.0 - 1.0
void main()
@ -19,20 +19,20 @@ void main()
vec4 sum = vec4(0);
vec3 bloom;
for(int i= -2 ;i < 2; i++)
for(int i= -3 ;i < 3; i++)
{
sum += texture2D(sampler0, v_texcoord0 + vec2(-1, i)*0.004) * amount;
sum += texture2D(sampler0, v_texcoord0 + vec2(0, i)*0.004) * amount;
sum += texture2D(sampler0, v_texcoord0 + vec2(1, i)*0.004) * amount;
}
if (color.r < 0.3)
if (color.r < 0.3 && color.g < 0.3 && color.b < 0.3)
{
bloom = sum.xyz*sum.xyz*0.012 + color;
}
else
{
if (color.r < 0.5)
if (color.r < 0.5 && color.g < 0.5 && color.b < 0.5)
{
bloom = sum.xyz*sum.xyz*0.009 + color;
}