Use shadow blurring in deferred rendering

This commit is contained in:
Nikita Lisitsa 2020-12-19 22:36:58 +03:00
parent bd5622fc3b
commit b0b2975efc

View file

@ -455,7 +455,17 @@ void main()
// color = vec3(float(l & 1), float(l & 2) / 2.0, float(l & 4) / 4.0);
// break;
color *= texture(u_shadow, vec4(tc.x, tc.y, float(cascade), tc.z));
float s = 0.0;
for (int tx = -2; tx <= 2; ++tx)
{
for (int ty = -2; ty <= 2; ++ty)
{
float d = 1.0 / 1024.0 / pow(2.0, float(cascade));
s += texture(u_shadow, vec4(tc.x + float(tx) * d, tc.y + float(ty) * d, float(cascade), tc.z)) / 25.0;
}
}
color *= s;
break;
}
}