Commit: 2f92f5c4c65cce0b69e0a4e955eac59fc6c4e0c3 Author: Stefan Werner Date: Wed Jun 7 20:21:09 2017 +0200 Branches: cycles_embree https://developer.blender.org/rB2f92f5c4c65cce0b69e0a4e955eac59fc6c4e0c3
Cycles: Added volume support for embree =================================================================== M intern/cycles/bvh/bvh_embree.cpp M intern/cycles/kernel/bvh/bvh.h =================================================================== diff --git a/intern/cycles/bvh/bvh_embree.cpp b/intern/cycles/bvh/bvh_embree.cpp index 37fffc28977..030a4787a42 100644 --- a/intern/cycles/bvh/bvh_embree.cpp +++ b/intern/cycles/bvh/bvh_embree.cpp @@ -115,6 +115,22 @@ void cclFilterFunc(void* userDataPtr, RTCRay& ray_) ray.geomID = RTC_INVALID_GEOMETRY_ID; return; } else if(ray.type == CCLRay::RAY_VOLUME_ALL) { + // append the intersection to the end of the array + if(ray.num_hits < ray.max_hits) { + Intersection *isect = &ray.isect_s[ray.num_hits]; + ray.num_hits++; + ray.isect_to_ccl(isect); + int prim = kernel_tex_fetch(__prim_index, isect->prim); + /* only primitives from volume object */ + uint tri_object = kernel_tex_fetch(__prim_object, isect->prim); + int object_flag = kernel_tex_fetch(__object_flag, tri_object); + if((object_flag & SD_OBJECT_HAS_VOLUME) == 0) { + ray.num_hits--; + } + /* this tells embree to continue tracing */ + ray.geomID = RTC_INVALID_GEOMETRY_ID; + return; + } return; } diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h index 6835819b824..43be3756e08 100644 --- a/intern/cycles/kernel/bvh/bvh.h +++ b/intern/cycles/kernel/bvh/bvh.h @@ -270,7 +270,7 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, rtc_ray.isect_s = isect; rtc_ray.max_hits = max_hits; rtc_ray.num_hits = 0; - rtcIntersect(kernel_data.bvh.scene, rtc_ray); + rtcOccluded(kernel_data.bvh.scene, rtc_ray); if(rtc_ray.num_hits > 0) { *num_hits = rtc_ray.num_hits; return (rtc_ray.geomID != RTC_INVALID_GEOMETRY_ID); @@ -366,6 +366,16 @@ ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg, const uint max_hits, const uint visibility) { +#ifdef __EMBREE__ + if(kernel_data.bvh.scene) { + CCLRay rtc_ray(*ray, kg, visibility, CCLRay::RAY_VOLUME_ALL); + rtc_ray.isect_s = isect; + rtc_ray.max_hits = max_hits; + rtc_ray.num_hits = 0; + rtcOccluded(kernel_data.bvh.scene, rtc_ray); + return rtc_ray.num_hits; + } +#endif # ifdef __OBJECT_MOTION__ if(kernel_data.bvh.have_motion) { return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits, visibility); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs