1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

Improve performance of shader lighting code in Forward renderers.

- Skip sampling shadows if attenuation is very small.
- Skip computing diffuse and specular light if attenuation and shadow are very small.
This commit is contained in:
Dario
2024-11-12 14:33:32 -03:00
parent bbc54692c0
commit 0ce4c6dac3
3 changed files with 215 additions and 273 deletions

View File

@@ -2369,11 +2369,7 @@ void fragment_shader(in SceneData scene_data) {
continue; // Statically baked light and object uses lightmap, skip
}
float shadow = light_process_omni_shadow(light_index, vertex, normal, scene_data.taa_frame_count);
shadow = blur_shadow(shadow);
light_process_omni(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, shadow, albedo, alpha, screen_uv,
light_process_omni(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, scene_data.taa_frame_count, albedo, alpha, screen_uv,
#ifdef LIGHT_BACKLIGHT_USED
backlight,
#endif
@@ -2441,11 +2437,7 @@ void fragment_shader(in SceneData scene_data) {
continue; // Statically baked light and object uses lightmap, skip
}
float shadow = light_process_spot_shadow(light_index, vertex, normal, scene_data.taa_frame_count);
shadow = blur_shadow(shadow);
light_process_spot(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, shadow, albedo, alpha, screen_uv,
light_process_spot(light_index, vertex, view, normal, vertex_ddx, vertex_ddy, f0, orms, scene_data.taa_frame_count, albedo, alpha, screen_uv,
#ifdef LIGHT_BACKLIGHT_USED
backlight,
#endif