improve ssao
This commit is contained in:
parent
96a94aa33c
commit
a9652327f1
@ -1,11 +1,15 @@
|
||||
vec4 effect() {
|
||||
float ssao = 0.0;
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
float z = texture(u_position, v_uv).z;
|
||||
for (int y = -2; y <= 2; y++) {
|
||||
for (int x = -2; x <= 2; x++) {
|
||||
vec2 offset = vec2(x, y) / u_screenSize;
|
||||
ssao += texture(u_ssao, v_uv + offset * 2.0).r;
|
||||
if (abs(z - texture(u_position, v_uv + offset * 2.0).z) > 0.05)
|
||||
ssao += 1.0;
|
||||
else
|
||||
ssao += texture(u_ssao, v_uv + offset * 2.0).r;
|
||||
}
|
||||
}
|
||||
ssao /= 9.0;
|
||||
ssao /= 24.0;
|
||||
return vec4(texture(u_screen, v_uv).rgb * mix(1.0, ssao, 1.0), 1.0);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user