[Bf-blender-cvs] [ecc15c55d4e] master: Cycles: Upgraded Embree to version 3.10.0

Stefan Werner noreply at git.blender.org
Wed May 27 10:13:18 CEST 2020


Commit: ecc15c55d4e2004fc2d6347f8437d8c06c5b55b3
Author: Stefan Werner
Date:   Thu Apr 30 11:04:44 2020 +0200
Branches: master
https://developer.blender.org/rBecc15c55d4e2004fc2d6347f8437d8c06c5b55b3

Cycles: Upgraded Embree to version 3.10.0

Enabled round linear hair in Embree.

Differential Revision: https://developer.blender.org/D7623

===================================================================

M	build_files/build_environment/cmake/versions.cmake
M	build_files/build_environment/install_deps.sh
M	intern/cycles/bvh/bvh_embree.cpp

===================================================================

diff --git a/build_files/build_environment/cmake/versions.cmake b/build_files/build_environment/cmake/versions.cmake
index 235620019e3..70c4b0948b3 100644
--- a/build_files/build_environment/cmake/versions.cmake
+++ b/build_files/build_environment/cmake/versions.cmake
@@ -295,9 +295,9 @@ set(SQLITE_VERSION 3.24.0)
 set(SQLITE_URI https://www.sqlite.org/2018/sqlite-src-3240000.zip)
 set(SQLITE_HASH fb558c49ee21a837713c4f1e7e413309aabdd9c7)
 
-set(EMBREE_VERSION 3.8.0)
+set(EMBREE_VERSION 3.10.0)
 set(EMBREE_URI https://github.com/embree/embree/archive/v${EMBREE_VERSION}.zip)
-set(EMBREE_HASH ac504d5426945fe25dec1267e0c39d52)
+set(EMBREE_HASH 4bbe29e7eaa46417efc75fc5f1e8eb87)
 
 set(USD_VERSION 19.11)
 set(USD_URI https://github.com/PixarAnimationStudios/USD/archive/v${USD_VERSION}.tar.gz)
diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index bfefb0e3139..d727ed73878 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -468,7 +468,7 @@ OPENCOLLADA_FORCE_BUILD=false
 OPENCOLLADA_FORCE_REBUILD=false
 OPENCOLLADA_SKIP=false
 
-EMBREE_VERSION="3.8.0"
+EMBREE_VERSION="3.10.0"
 EMBREE_FORCE_BUILD=false
 EMBREE_FORCE_REBUILD=false
 EMBREE_SKIP=false
diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp
index 9356adf3ea5..6735202835b 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -16,11 +16,6 @@
 
 /* This class implements a ray accelerator for Cycles using Intel's Embree library.
  * It supports triangles, curves, object and deformation blur and instancing.
- * Not supported are thick line segments, those have no native equivalent in Embree.
- * They could be implemented using Embree's thick curves, at the expense of wasted memory.
- * User defined intersections for Embree could also be an option, but since Embree only uses
- * aligned BVHs for user geometry, this would come with reduced performance and/or higher memory
- * usage.
  *
  * Since Embree allows object to be either curves or triangles but not both, Cycles object IDs are
  * mapped to Embree IDs by multiplying by two and adding one for curves.
@@ -775,6 +770,21 @@ void BVHEmbree::update_curve_vertex_buffer(RTCGeometry geom_id, const Hair *hair
       }
     }
   }
+#  if RTC_VERSION >= 30900
+  if (!use_curves) {
+    unsigned char *flags = (unsigned char *)rtcSetNewGeometryBuffer(geom_id,
+                                                                    RTC_BUFFER_TYPE_FLAGS,
+                                                                    0,
+                                                                    RTC_FORMAT_UCHAR,
+                                                                    sizeof(unsigned char),
+                                                                    num_keys_embree);
+    flags[0] = RTC_CURVE_FLAG_NEIGHBOR_RIGHT;
+    ::memset(flags + 1,
+             RTC_CURVE_FLAG_NEIGHBOR_RIGHT | RTC_CURVE_FLAG_NEIGHBOR_RIGHT,
+             num_keys_embree - 2);
+    flags[num_keys_embree - 1] = RTC_CURVE_FLAG_NEIGHBOR_LEFT;
+  }
+#  endif
 }
 
 void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
@@ -810,10 +820,18 @@ void BVHEmbree::add_curves(const Object *ob, const Hair *hair, int i)
   size_t prim_tri_index_size = pack.prim_index.size();
   pack.prim_tri_index.resize(prim_tri_index_size + num_segments);
 
+#  if RTC_VERSION >= 30900
+  enum RTCGeometryType type = (!use_curves) ?
+                                  (use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE :
+                                                 RTC_GEOMETRY_TYPE_ROUND_LINEAR_CURVE) :
+                                  (use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE :
+                                                 RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
+#  else
   enum RTCGeometryType type = (!use_curves) ?
                                   RTC_GEOMETRY_TYPE_FLAT_LINEAR_CURVE :
                                   (use_ribbons ? RTC_GEOMETRY_TYPE_FLAT_CATMULL_ROM_CURVE :
                                                  RTC_GEOMETRY_TYPE_ROUND_CATMULL_ROM_CURVE);
+#  endif
 
   RTCGeometry geom_id = rtcNewGeometry(rtc_shared_device, type);
   rtcSetGeometryTessellationRate(geom_id, curve_subdivisions);



More information about the Bf-blender-cvs mailing list