Open azeey opened 2 years ago
This may actually be a different (but related) error.
When cast_shadows
is disabled Forward+ (from now on F+) algorithm is used by the lighting system. Very big lights can cause severe performance degradation; but small lights usually end up cut "abruptly".
Lights theoretically travel through infinity, so any radius that limits is range is going to be arbitrary. Using Light::setAttenuationBasedOnRadius
helps cutting the arbitrariness by providing a minimum luminance threshold (i.e. pretend the light cuts off once % of luminance is reached) but it still gives you less flexibility.
As a hack/workaround, ForwardPlusBase::setFadeAttenuationRange
is enabled by default; which will smoothly attenuate when getting close to the light's radius; regardless of PBR parameters of physical attenuation.
TL;DR The light's attenuation settings are honoured, but an extra (much more aggressive) fade is applied on top unless ForwardPlusBase::setFadeAttenuationRange( false ) is called.
The range is not part of the attenuation equation. but setFadeAttenuationRange( true ) (the default setting) hacks it on top to be considered.
When cast_shadows
is enabled, regular Forward is used (without the +). Because in this case light's size has no direct impact on performance; we don't use the hack; and the light's attenuation settings are honoured without any hacks.
The range is not part of the attenuation equation.
That will depend on the intention. The physically correct solution is to call setFadeAttenuationRange( false ) and either use a very aggressive attenuation or a very large radius to avoid blockiness-like artifacts (light curring suddenly)
Other solutions is to just be aware of this and tweak the attenuation until they both agree.
Expected behavior: Point light attenuation/falloff to work regardless of cast_shadows.
I can confirm that is is not only related to point lights: spot light shows the same behaviour (left with, right without shadow):
Environment
ign-rendering6
, f043b4fcDescription
cast_shadows
.cast_shadow
is enabled, the light does not falloff according to the attenuation parameters. For example, given the following light sourcewith
cast_shadows = true
, I get a sharp circle determined by the range (4m) of the light.with
cast_shadows = false
, the light falls of smoothly, but the box does not have a shadow.Steps to reproduce
ign gazebo
.<cast_shadows>
to true or false.