Added lighting to SSAO example. small changes and fixes
This commit is contained in:
parent
9212a9e3cb
commit
06369fc72e
11 changed files with 40 additions and 25 deletions
|
|
@ -9,11 +9,10 @@ layout (location = 0) in vec2 inUV;
|
|||
|
||||
layout (location = 0) out float outFragColor;
|
||||
|
||||
const int blurSize = 4;
|
||||
|
||||
void main()
|
||||
{
|
||||
const int blurRange = 2;
|
||||
int n = 0;
|
||||
vec2 texelSize = 1.0 / vec2(textureSize(samplerSSAO, 0));
|
||||
float result = 0.0;
|
||||
for (int x = -blurRange; x < blurRange; x++)
|
||||
|
|
@ -22,7 +21,8 @@ void main()
|
|||
{
|
||||
vec2 offset = vec2(float(x), float(y)) * texelSize;
|
||||
result += texture(samplerSSAO, inUV + offset).r;
|
||||
n++;
|
||||
}
|
||||
}
|
||||
outFragColor = result / (blurRange * blurRange * blurRange * blurRange);
|
||||
outFragColor = result / (float(n));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue