[Bf-blender-cvs] [e7952398d1a] cycles_embree: Cycles: fixed Embree transparent shadow ray intersection to terminate properly when opaque objects are hit

Stefan Werner noreply at git.blender.org
Sun Nov 26 23:11:26 CET 2017


Commit: e7952398d1a377c78ee6e6809c073f4ee7ff67cd
Author: Stefan Werner
Date:   Wed Aug 2 15:37:57 2017 +0200
Branches: cycles_embree
https://developer.blender.org/rBe7952398d1a377c78ee6e6809c073f4ee7ff67cd

Cycles: fixed Embree transparent shadow ray intersection to terminate properly when opaque objects are hit

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

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 e27aea50f6d..76a3d8ee697 100644
--- a/intern/cycles/bvh/bvh_embree.cpp
+++ b/intern/cycles/bvh/bvh_embree.cpp
@@ -82,6 +82,14 @@ void rtc_filter_func(void*, RTCRay& ray_)
 				/* this tells embree to continue tracing */
 				ray.geomID = RTC_INVALID_GEOMETRY_ID;
 			}
+			else {
+				ray.num_hits = ray.max_hits+1;
+			}
+		}
+		else {
+			/* Increase the number of hits beyond ray.max_hits
+			 * so that the caller can detect this as opaque. */
+			ray.num_hits++;
 		}
 		return;
 	}
diff --git a/intern/cycles/kernel/bvh/bvh.h b/intern/cycles/kernel/bvh/bvh.h
index 166b6007c3f..0faebfe6c6d 100644
--- a/intern/cycles/kernel/bvh/bvh.h
+++ b/intern/cycles/kernel/bvh/bvh.h
@@ -272,6 +272,9 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg,
 		rtc_ray.max_hits = max_hits;
 		rtc_ray.num_hits = 0;
 		rtcOccluded(kernel_data.bvh.scene, rtc_ray);
+		if(rtc_ray.num_hits > max_hits) {
+			return true;
+		}
 		if(rtc_ray.num_hits > 0) {
 			*num_hits = rtc_ray.num_hits;
 			return (rtc_ray.geomID != RTC_INVALID_GEOMETRY_ID);



More information about the Bf-blender-cvs mailing list