|
@@ -1860,7 +1860,7 @@ void fragment_shader(in SceneData scene_data) {
|
|
|
|
|
|
pssm_coord /= pssm_coord.w;
|
|
|
|
|
|
- shadow = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor, pssm_coord);
|
|
|
+ shadow = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * (blur_factor + (1.0 - blur_factor) * float(directional_lights.data[i].blend_splits)), pssm_coord);
|
|
|
|
|
|
if (directional_lights.data[i].blend_splits) {
|
|
|
float pssm_blend;
|
|
@@ -1870,21 +1870,21 @@ void fragment_shader(in SceneData scene_data) {
|
|
|
vec4 v = vec4(vertex, 1.0);
|
|
|
BIAS_FUNC(v, 1)
|
|
|
pssm_coord = (directional_lights.data[i].shadow_matrix2 * v);
|
|
|
- pssm_blend = smoothstep(0.0, directional_lights.data[i].shadow_split_offsets.x, depth_z);
|
|
|
+ pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x - directional_lights.data[i].shadow_split_offsets.x * 0.1, directional_lights.data[i].shadow_split_offsets.x, depth_z);
|
|
|
// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
|
|
|
blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.y;
|
|
|
} else if (depth_z < directional_lights.data[i].shadow_split_offsets.y) {
|
|
|
vec4 v = vec4(vertex, 1.0);
|
|
|
BIAS_FUNC(v, 2)
|
|
|
pssm_coord = (directional_lights.data[i].shadow_matrix3 * v);
|
|
|
- pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.x, directional_lights.data[i].shadow_split_offsets.y, depth_z);
|
|
|
+ pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y - directional_lights.data[i].shadow_split_offsets.y * 0.1, directional_lights.data[i].shadow_split_offsets.y, depth_z);
|
|
|
// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
|
|
|
blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.z;
|
|
|
} else if (depth_z < directional_lights.data[i].shadow_split_offsets.z) {
|
|
|
vec4 v = vec4(vertex, 1.0);
|
|
|
BIAS_FUNC(v, 3)
|
|
|
pssm_coord = (directional_lights.data[i].shadow_matrix4 * v);
|
|
|
- pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.y, directional_lights.data[i].shadow_split_offsets.z, depth_z);
|
|
|
+ pssm_blend = smoothstep(directional_lights.data[i].shadow_split_offsets.z - directional_lights.data[i].shadow_split_offsets.z * 0.1, directional_lights.data[i].shadow_split_offsets.z, depth_z);
|
|
|
// Adjust shadow blur with reference to the first split to reduce discrepancy between shadow splits.
|
|
|
blur_factor2 = directional_lights.data[i].shadow_split_offsets.x / directional_lights.data[i].shadow_split_offsets.w;
|
|
|
} else {
|
|
@@ -1894,7 +1894,7 @@ void fragment_shader(in SceneData scene_data) {
|
|
|
|
|
|
pssm_coord /= pssm_coord.w;
|
|
|
|
|
|
- float shadow2 = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * blur_factor2, pssm_coord);
|
|
|
+ float shadow2 = sample_directional_pcf_shadow(directional_shadow_atlas, scene_data.directional_shadow_pixel_size * directional_lights.data[i].soft_shadow_scale * (blur_factor2 + (1.0 - blur_factor2) * float(directional_lights.data[i].blend_splits)), pssm_coord);
|
|
|
shadow = mix(shadow, shadow2, pssm_blend);
|
|
|
}
|
|
|
}
|