Discard the whole volume stack on the last bounce (but keep
world volume if present).
Volumes are expected to be closed manifol meshes, meaning if
ray entered the volume there should be an intersection event
of ray exisintg the volume. Case when ray hit nothing and
there are still non-world volumes in the stack can happen in
either of cases.
- Mesh is not closed manifold.
Such configurations are not really supported anyway and should
not be used.
Previous code would have consider the infinite length of the
ray to sample across, so render result wasn't really correct
anyway.
- Exit intersection is more far away than the camera far clip distance.
Thi case also will behave differently now, but previously it
wassn't really correct either, so it's not like we're breaking
something which was workign as expected.
- We missed exit event due to intersection precision issues.
This is exact the case which this patch fixes and avoid
fireflies.
- VOlume has Camera only visibility (all the rest visibility
is set to off)
This is what coudl be considered a regression but could be
solved quite easily by checking volume stack's objects flags
and keep entries which doesnt' have Volume Scatter visibility.