Fix #116695: Cycles light tree crash with certain light visibility settings

Fixes an issue where triangles (and possibly lights) would not be added
to the light tree if the only visibility option it has enabled is volumetric
scattering.

This would lead to an assert during forward sampling because the light
would be treated as if it was in the light tree, and a light index
outside the light tree array would be sampled, which would trigger
the assert.

Pull Request: https://projects.blender.org/blender/blender/pulls/116703
This commit is contained in:
Alaska
2024-01-02 13:53:56 +01:00
committed by Brecht Van Lommel
parent 9f38c6e887
commit f0fcd553df

View File

@@ -390,7 +390,9 @@ bool Object::usable_as_light() const
return false;
}
/* Skip if we are not visible for BSDFs. */
if (!(get_visibility() & (PATH_RAY_DIFFUSE | PATH_RAY_GLOSSY | PATH_RAY_TRANSMIT))) {
if (!(get_visibility() &
(PATH_RAY_DIFFUSE | PATH_RAY_GLOSSY | PATH_RAY_TRANSMIT | PATH_RAY_VOLUME_SCATTER)))
{
return false;
}
/* Skip if we have no emission shaders. */