Page MenuHome

Cycles: Fix visiblity for volume objects. (#121)
Needs RevisionPublic

Authored by Stefan Werner (swerner) on May 28 2020, 8:57 AM.

Details

Summary

Visibility of volumes is now handled on a shader level, not during
ray traversal. Before, this could lead to inconsistent states.

Diff Detail

Repository
rB Blender
Branch
volume_visibility
Build Status
Buildable 8262
Build 8262: arc lint + arc unit

Event Timeline

Stefan Werner (swerner) requested review of this revision.May 28 2020, 8:57 AM
Stefan Werner (swerner) created this revision.
intern/cycles/kernel/kernel_types.h
1028

This holds only a boolean at the moment. Should we steal a bit from either object or shader?

Detailed description of the issue:
When maintaining the volume stack and tracking volume visibility at intersection level, we see problems when a path enters a volume as one kind of ray and leaves it as the other. It can happen that either an enter or leave event is missed and a volume is mistaken as either missing or infinite.

In this example, the object in the middle is for reference, with all visibility enabled.

The left object is set to be invisible to shadow rays. Note that the ground plane, intersecting the volume, is fully in the shadow because the path registers as being inside the volume via the camera ray intersections, but the following shadow ray never leaves the volume. The volume is also casting a strong shadow onto itself.

The object on the right is the opposite effect - invisible to the camera, visible to all other rays. There the shadow ray from the ground plane inside the volume notices that it leaves the volume, but the camera ray leading to it never registered that it entered the volume.

(before the patch)

With volumes being visible to all intersections and resolving visibility at shading time, this can be fixed. Then segments of a path can correctly account for mixed ray visibility.

(after the patch)

This may look like an esoteric problem - it was very obvious for us though when we started trying to render volumes separately for compositing and wanted to have volumes invisible to the camera, but still wanted their shadows to show up.

As reference, this is what the scene looks like when every volume is visible to all rays. It is obvious that the object on the left, when set invisible to shadow rays, comes out much darker than it should.

  • Cycles: Full consistency between volume and ray visiblity.
Brecht Van Lommel (brecht) requested changes to this revision.Jun 2 2020, 7:25 AM

Logic seems fine.

intern/cycles/kernel/kernel_path_branched.h
86–88

Should this test be removed now?

intern/cycles/kernel/kernel_types.h
1028

For saving GPU memory, would be good yes.

intern/cycles/kernel/kernel_volume.h
20

This needs ccl_device to work on the GPU I think?

This revision now requires changes to proceed.Jun 2 2020, 7:25 AM