mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
update shadows.glsl
This commit is contained in:
parent
ffba11e87f
commit
19a952a3be
1 changed files with 6 additions and 10 deletions
|
|
@ -25,18 +25,14 @@ float calc_shadow(
|
|||
projCoords.z -= 0.00001 / u_shadowsRes + bias;
|
||||
|
||||
float shadow = 0.0;
|
||||
if (dot(realnormal, u_sunDir) < 0.0) {
|
||||
// 3x3 kernel
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec3 offset = vec3(x, y, -(abs(x) + abs(y)) * 0.8) * step * 1.0 * u_shadowsSoftness;
|
||||
shadow += texture(shadowsMap, projCoords + offset);
|
||||
}
|
||||
// 3x3 kernel
|
||||
for (int y = -1; y <= 1; y++) {
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
vec3 offset = vec3(x, y, -(abs(x) + abs(y)) * 0.8) * step * 1.0 * u_shadowsSoftness;
|
||||
shadow += texture(shadowsMap, projCoords + offset);
|
||||
}
|
||||
shadow /= 9.0;
|
||||
} else {
|
||||
shadow = 0.0;
|
||||
}
|
||||
shadow /= 9.0;
|
||||
return shadow;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue