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.
This commit is contained in:
Hugo Locurcio 2022-02-24 22:55:14 +01:00
parent 4dc8214831
commit b1a295b739
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
14 changed files with 214 additions and 6 deletions

View file

@ -1650,6 +1650,17 @@
Sets the cull mask for this Light3D. Lights only affect objects in the selected layers. Equivalent to [member Light3D.light_cull_mask].
</description>
</method>
<method name="light_set_distance_fade">
<return type="void" />
<argument index="0" name="decal" type="RID" />
<argument index="1" name="enabled" type="bool" />
<argument index="2" name="begin" type="float" />
<argument index="3" name="shadow" type="float" />
<argument index="4" name="length" type="float" />
<description>
Sets the distance fade for this Light3D. This acts as a form of level of detail (LOD) and can be used to improve performance. Equivalent to [member Light3D.distance_fade_enabled], [member Light3D.distance_fade_begin], [member Light3D.distance_fade_shadow], and [member Light3D.distance_fade_length].
</description>
</method>
<method name="light_set_max_sdfgi_cascade">
<return type="void" />
<argument index="0" name="light" type="RID" />