1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-08 12:40:44 +00:00

Re-implement the PSSM_SPLITS debug option

This uses a render_mode instead of shadow_color to avoid adding a cost to the basic shader
This commit is contained in:
clayjohn
2023-04-28 16:02:10 -07:00
parent 9f12e7b52d
commit ca23d06a31
10 changed files with 114 additions and 6 deletions

View File

@@ -1817,9 +1817,30 @@ void fragment_shader(in SceneData scene_data) {
blur_shadow(shadow);
#ifdef DEBUG_DRAW_PSSM_SPLITS
vec3 tint = vec3(1.0);
if (-vertex.z < directional_lights.data[i].shadow_split_offsets.x) {
tint = vec3(1.0, 0.0, 0.0);
} else if (-vertex.z < directional_lights.data[i].shadow_split_offsets.y) {
tint = vec3(0.0, 1.0, 0.0);
} else if (-vertex.z < directional_lights.data[i].shadow_split_offsets.z) {
tint = vec3(0.0, 0.0, 1.0);
} else {
tint = vec3(1.0, 1.0, 0.0);
}
tint = mix(tint, vec3(1.0), shadow);
shadow = 1.0;
#endif
float size_A = sc_use_light_soft_shadows ? directional_lights.data[i].size : 0.0;
light_compute(normal, directional_lights.data[i].direction, normalize(view), size_A, directional_lights.data[i].color * directional_lights.data[i].energy, true, shadow, f0, orms, 1.0, albedo, alpha,
light_compute(normal, directional_lights.data[i].direction, normalize(view), size_A,
#ifndef DEBUG_DRAW_PSSM_SPLITS
directional_lights.data[i].color * directional_lights.data[i].energy,
#else
directional_lights.data[i].color * directional_lights.data[i].energy * tint,
#endif
true, shadow, f0, orms, 1.0, albedo, alpha,
#ifdef LIGHT_BACKLIGHT_USED
backlight,
#endif