Page MenuHome

GSoC2019: Embree on GPU
Needs ReviewPublic

Authored by MATILLAT Quentin (qmatillat) on Aug 18 2019, 7:11 PM.



Allows blender to let the build step of the BVH tree to embree, but still render on the GPU


  • Instancied mesh
  • Motion Blur
  • Curve (for rendering hair, but the conversion step can be slow)

Add support for:

  • 4D nodes: these are node that have a limited life span, and are only valid for a specific range of time
  • Linear interpolation of bounding box (for motion blur): Bound box for some node can be interpolated at traversal time, leading to smaller bound box

Diff Detail

rB Blender
Build Status
Buildable 4993
Build 4993: arc lint + arc unit

Event Timeline

Remove some debug flags

Remove some debug flags

I am unable to get hair to render - any scene from the benchmark repository ( that contains hair results in a crash.

Update embree to support all kind of curve

Crash was caused because the file used a different curve type (Flat Hermite curve) that the one I tested with (Round Hermite curve). It now support all of Embree supported curves

Can you add the following snipped to make the patch also apply to builds with make deps?

diff --git a/build_files/build_environment/cmake/embree.cmake b/build_files/build_environment/cmake/embree.cmake
index 2dd4261..36fc258 100644
--- a/build_files/build_environment/cmake/embree.cmake
+++ b/build_files/build_environment/cmake/embree.cmake
@@ -41,6 +41,7 @@ ExternalProject_Add(external_embree
   PREFIX ${BUILD_DIR}/embree
+  PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/embree/src/external_embree < ${PATCH_DIR}/embree.diff

I'm seeing crashes in the victor scene when rendering this on a 1080Ti on Centos 7:

#0  0x0000000008a5bcfb in ccl::bvh_shrink (root=0x0) at /home/stefan/blender-build/blender/intern/cycles/bvh/bvh_embree_converter.cpp:112
#1  0x0000000008a5d7c8 in ccl::BVHEmbreeConverter::getBVH2 (this=0x7ffd1dbfce00)
    at /home/stefan/blender-build/blender/intern/cycles/bvh/bvh_embree_converter.cpp:369
#2  0x0000000008a5fe6e in ccl::BVHEmbreeConverter::fillPack (this=0x7ffd1dbfce00, pack=...)
    at /home/stefan/blender-build/blender/intern/cycles/bvh/bvh_embree_converter.cpp:779
#3  0x0000000008a40304 in ccl::BVHEmbree::build (this=0x7ffd1926a100, progress=..., stats_=0x0)
    at /home/stefan/blender-build/blender/intern/cycles/bvh/bvh_embree.cpp:491
#4  0x00000000087137af in ccl::Mesh::compute_bvh (this=0x7ffce5a94300, device=0x7ffead732d00, dscene=0x7ffd3e3be520, params=0x7ffd3e3bff00, 
    progress=0x7ffead7f1820, n=91, total=94) at /home/stefan/blender-build/blender/intern/cycles/render/mesh.cpp:1051

Update CMake to apply the patch to Embree when used from make deps
Allow to build empty tree

Improve convert time from Embree by pre-allocating all buffer to the exact size

That's a rather significant patch to embree, most of the other patches we have in the deps_builder are mostly oneliners to deal with build issues on various platforms, are there any plans to upstream these changes?

It should definitely be included in Embree, but I need to implement every features before proposing change (currently it lacks BVH8 support and motion blur for curves).