Add blurring of lightmap (and refactoring)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#version 430 core
|
||||
in vec2 vTexPos;
|
||||
out vec4 fColor;
|
||||
|
||||
uniform vec2 winSize;
|
||||
uniform sampler2D screenTexture;
|
||||
|
||||
const float hOff = 1.0 / winSize.x;
|
||||
const float vOff = 1.0 / winSize.y;
|
||||
//const float verOff = 1.0 / 600.0;
|
||||
|
||||
//const float kernel[9] = float[](
|
||||
// 0.025,0.05,0.1, 0.2, 0.25, 0.2,0.1, 0.05, 0.025
|
||||
// 0.1,0.1,0.1,0.1,0.2,0.1,0.1,0.1,0.1
|
||||
// );
|
||||
const float kernel[5] = float[](
|
||||
0.175,
|
||||
0.175,0.3,0.175,
|
||||
0.175
|
||||
);
|
||||
const float off[5] = float[](
|
||||
vOff,
|
||||
-hOff,0.0,hOff,
|
||||
-vOff
|
||||
);
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 sampleTex[5];
|
||||
for(int i=0; i<5; i++)
|
||||
{
|
||||
sampleTex[i] = vec4(texture(screenTexture, vTexPos + off[i]));
|
||||
}
|
||||
vec4 col = vec4(0,0,0,0);
|
||||
for (int i = 0; i < 5; i++)
|
||||
col += sampleTex[i] * kernel[i];
|
||||
fColor = col;
|
||||
}
|
||||
Reference in New Issue
Block a user