Cycles: add instancing support in light tree #106683

Closed
Weizhen Huang wants to merge 10 commits from weizhen:light_tree_instance into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

10 Commits

Author SHA1 Message Date
Weizhen Huang 49ede3338d Merge branch 'main' into light_tree_instance 2023-04-14 18:48:44 +02:00
Weizhen Huang c10023b8e3 Add `#include <variant>`
buildbot/vexp-code-patch-coordinator Build done. Details
2023-04-14 16:59:37 +02:00
Weizhen Huang a8e5aa4bcc Merge remote-tracking branch 'origin' into light_tree_instance
buildbot/vexp-code-patch-coordinator Build done. Details
2023-04-14 16:36:24 +02:00
Weizhen Huang 490f41856b Change light tree node type from `union` to `variant` 2023-04-14 16:33:27 +02:00
Weizhen Huang f69d27edae Fix variable used without initialization 2023-04-14 14:54:41 +02:00
Weizhen Huang 13a876dff7 Fix transform zero vector in volume
buildbot/vexp-code-patch-coordinator Build done. Details
2023-04-14 00:24:32 +02:00
Weizhen Huang a56f7e1244 Parallelize iterating over mesh lights and building subtrees 2023-04-14 00:24:09 +02:00
Weizhen Huang e5b9a1050f Merge branch 'main' into light_tree_instance 2023-04-13 23:23:28 +02:00
Weizhen Huang 8f9a92e3d7 Readability improvement based on reviews
`lamp` -> `light`
`mesh_to_tree` -> `object_to_tree`
Explicit naming of union structs (`leaf`, `inner`, `instance`,
`triangle`, `light`, `mesh`)
`enum LightTreeNodeType` -> `enum LightTreeNodeType : uint8_t`
2023-04-13 23:15:04 +02:00
Weizhen Huang dec90cfcf9 Cycles: speed up light tree build with many instanced mesh lights
buildbot/vexp-code-patch-coordinator Build done. Details
by building a subtree for each unique mesh light.
The top-level light tree contains two types of emitters: lamps (local or distant) and mesh lights (emissive objects). Each unique mesh light, regardless of whether it's instanced or not, has a subtree. The leaf node of such subtrees only contain triangles. During traversal, we first traverse the top-level tree until we pick an emitter. If this emitter is a mesh light, we transform it to its local space and continue traversing its subtree until we pick a triangle.
2023-04-07 18:40:03 +02:00