diff options
author | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-04-30 12:04:44 +0300 |
---|---|---|
committer | Stefan Werner <stefan.werner@tangent-animation.com> | 2020-05-27 11:10:18 +0300 |
commit | ecc15c55d4e2004fc2d6347f8437d8c06c5b55b3 (patch) | |
tree | d8167dc13f1dbc50355c4b03c515c6efeae56592 /intern/cycles/bvh | |
parent | 783624206593899c52b0744519a1991ae0133243 (diff) |
Cycles: Upgraded Embree to version 3.10.0
Enabled round linear hair in Embree.
Differential Revision: https://developer.blender.org/D7623
Diffstat (limited to 'intern/cycles/bvh')
-rw-r--r-- | intern/cycles/bvh/bvh_embree.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
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); |