Make bloom trail last for at most one frame
This commit is contained in:
@@ -5,8 +5,8 @@ out vec4 fColor;
|
||||
uniform vec2 winSize;
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
const float hOff = 2.0 / 600;
|
||||
const float vOff = 2.0 / 600;
|
||||
const float hOff = 1.0 / 300;
|
||||
const float vOff = 1.0 / 300;
|
||||
const float frac = 1.0 / 9;
|
||||
const vec2 off[9] = vec2[]
|
||||
( vec2( vOff,hOff )
|
||||
@@ -39,14 +39,20 @@ void main()
|
||||
{
|
||||
sampleTex[i] = vec4(texture(screenTexture, vTexPos + off[i]));
|
||||
}
|
||||
vec4 sampleFive[5];
|
||||
for(int i=0; i<5; i++)
|
||||
{
|
||||
sampleFive[i] = vec4(texture(screenTexture, vTexPos + fiveOff[i]));
|
||||
}
|
||||
vec4 col = vec4(0,0,0,0);
|
||||
for (int i = 0; i < 9; i++)
|
||||
col = combinef(col,sampleTex[i]);
|
||||
//col += sampleTex[i] * frac;
|
||||
float alph = 0.0;
|
||||
for (int i = 0; i < 9; i++)
|
||||
alph += sampleTex[i].a;
|
||||
alph = max(sampleTex[4].a, alph/9.0);
|
||||
//alph += sampleTex[i].a;
|
||||
alph = max(alph, 0.5 * sampleTex[i].a);
|
||||
alph = max(sampleTex[4].a, alph);
|
||||
//
|
||||
//fColor = col;
|
||||
fColor = vec4(col.rgb/col.a,alph);
|
||||
|
||||
Reference in New Issue
Block a user