Tweak bloom, remove pistol spread

This commit is contained in:
jgk
2021-08-21 11:32:50 +02:00
parent 778d18276b
commit a730dd66e0
9 changed files with 46 additions and 45 deletions
+18 -25
View File
@@ -1,48 +1,41 @@
#version 430 core
in vec2 vTexPos;
out vec4 fColor;
const vec2 winSize = vec2 (300,300);
const vec2 winSize = vec2 (300.0,300.0);
// note that the above opening bracket should be the first in this file
// this is so that the window size can be extracted and the shader recompiled on
// the fly
uniform sampler2D screenTexture;
const float hOff = 3.0 / winSize.x;
const float vOff = 3.0 / winSize.y;
const float frac = 1.0 / 9;
const vec2 off[9] = vec2[]
const float hOff = 3 / winSize.x;
const float vOff = 3 / winSize.y;
//const vec2 off[9] = vec2[]
// ( vec2( hOff, vOff )
// , vec2( hOff, 0.0 )
// , vec2( hOff,-vOff )
// , vec2( 0.0, vOff )
// , vec2( 0.0, 0.0 )
// , vec2( 0.0,-hOff )
// , vec2(-hOff, vOff )
// , vec2(-hOff, 0.0 )
// , vec2(-hOff,-vOff )
// );
const vec2 fiveOff[5] = vec2[]
( vec2( hOff, vOff )
, vec2( hOff, 0.0 )
, vec2( hOff,-vOff )
, vec2( 0.0, vOff )
, vec2( 0.0, 0.0 )
, vec2( 0.0,-hOff )
, vec2(-hOff, vOff )
, vec2(-hOff, 0.0 )
, vec2(-hOff,-vOff )
);
const vec2 fiveOff[5] = vec2[]
( vec2( vOff, hOff )
, vec2( vOff,-hOff )
, vec2( 0.0, 0.0 )
, vec2(-vOff, hOff )
, vec2(-vOff,-hOff )
);
vec4 combinef (vec4 ac, vec4 bc)
//{ return vec4 (max(ac.x,bc.x),max(ac.y,bc.y),max(ac.z,bc.z),ac.w + bc.w -
// ac.w*bc.w);
//{ return vec4 (max(ac.x,bc.x),max(ac.y,bc.y),max(ac.z,bc.z),ac.w + bc.w);
{ return vec4 (ac.rgb + bc.rgb * bc.a , ac.a + bc.a );
}
void main()
{
vec4 sumFive = vec4 (0,0,0,0);
vec4 sumFive = vec4 (0.0,0.0,0.0,0.0);
for (int i=0; i<5; i++)
{
sumFive += vec4(texture(screenTexture, vTexPos + fiveOff[i]));
}
fColor = vec4 ( max( (sumFive / 10) , texture(screenTexture,vTexPos) ) );
//fColor = max(texture(screenTexture,vTexPos), sumFive / 5);
fColor = vec4 ( (sumFive / 5).rgb, max((sumFive/5).a,texture(screenTexture,vTexPos).a) );
//fColor = vec4 ( (sumFive / 5).rgb, max((sumFive/5.0).a,texture(screenTexture,vTexPos).a) );
// vec4 sampleTex[9];
// for(int i=0; i<9; i++)
// {