From b1a295b739eb056557e9f2fe47ac80be6cc6d79d Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 24 Feb 2022 22:55:14 +0100 Subject: Implement distance fade properties in OmniLight3D and SpotLight3D This can be used to fade lights and their shadows in the distance, similar to Decal nodes. This can bring significant performance improvements, especially for lights with shadows enabled and when using higher-than-default shadow quality settings. While lights can be smoothly faded out over distance, shadows are currently "all or nothing" since per-light shadow color is no longer customizable in the Vulkan renderer. This may result in noticeable pop-in when leaving the shadow cutoff distance, but depending on the scene, it may not always be that noticeable. --- drivers/gles3/rasterizer_storage_gles3.cpp | 3 +++ drivers/gles3/rasterizer_storage_gles3.h | 1 + 2 files changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index abbba13ee6..8e0b7bc9b8 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2267,6 +2267,9 @@ void RasterizerStorageGLES3::light_set_negative(RID p_light, bool p_enable) { void RasterizerStorageGLES3::light_set_cull_mask(RID p_light, uint32_t p_mask) { } +void RasterizerStorageGLES3::light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) { +} + void RasterizerStorageGLES3::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) { } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index b6a5c0e73e..462c6af89f 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -902,6 +902,7 @@ public: void light_set_projector(RID p_light, RID p_texture) override; void light_set_negative(RID p_light, bool p_enable) override; void light_set_cull_mask(RID p_light, uint32_t p_mask) override; + void light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) override; void light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) override; void light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mode) override; void light_set_max_sdfgi_cascade(RID p_light, uint32_t p_cascade) override; -- cgit v1.2.3