This patch adds Intel's Embree as an option for ray acceleration.
I'm not expecting this patch to be accepted right away, I'm publishing it here because I think it's very useful even when not 100% perfect.
- Will this work with GPUs? No.
- Will this work with AMD CPUs? Yes.
- Benchmark X renders slower than before. Is it broken? No. I don't expect gains for simple scenes. The benefits of this are mostly visible with big and complex scenes with heavy motion blur.
- Will this work with GPUs? Still no.
To use this, a build of Embree 3.2.0 or newer is required with intersection filtering enabled. Note that Embree 3.2.0 has a known bug with ribbon curves that is expected to be fixed in newer releases (currently in alpha). The scripts for building dependencies are not updated to fulfil this dependency yet.
There is room for improvement.
Thick line segments have no native support in Embree. Vertex and index buffers could be shared with the rest of Cycles to reduce the memory footprint. Embree has native support for quad meshes, displacements and subdivisions which is not leveraged by this patch. The CPU split kernel could be modified to call Embree with a batch of rays for intersections.
One could probably implement traversal of Embree's BVH for GPUs. This will be probably be a longer discussion, we could abstract ray intersections in general to allow Cycles to use whatever backend is best for the hardware at hand - Embree on Intel CPUs, RTX on Nvidia GPUs and RadeonRays on AMD GPUs.
Nonetheless, an earlier version of this (based on Embree 2.x) was used by Tangent Animation for Next Gen, so I have faith that this patch is reasonably robust.