Cycles: build specialized light trees for light linking #107561

Merged

1 Commits

Author SHA1 Message Date
Brecht Van Lommel 411d308d5c Cycles: build specialized light trees for light linking
This starts by building a light tree for all lights in the scene as usual.

Then for every unique light set, a specialized light tree is created. Each
light tree node has a mask with the light sets it is a member of, and for
each specialized light tree only the matching subset of nodes is used.

Subtrees with identical bitmasks are shared between light trees to reduce
memory usage.

Light tree sampling works the same as before, the only difference is that a
different root node is used depending on the receiver object.

Computing the light tree pdf needed a change as the bit trails are not the
same for the specialized light tree. Each light tree node now includes a
bit shift value, to skip nodes that were left out of the specialized light
tree.
2023-05-09 13:26:38 +02:00