[Bf-blender-cvs] [fc78a58] blender-v2.77-release: Cycles: Fix wrong camera in volume check when domain is only visible to camera rays

Sergey Sharybin noreply at git.blender.org
Tue Apr 5 10:43:26 CEST 2016


Commit: fc78a58337ab1021cd816737f3bbb496b9b4fe23
Author: Sergey Sharybin
Date:   Mon Apr 4 19:30:38 2016 +0200
Branches: blender-v2.77-release
https://developer.blender.org/rBfc78a58337ab1021cd816737f3bbb496b9b4fe23

Cycles: Fix wrong camera in volume check when domain is only visible to camera rays

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

M	intern/cycles/kernel/geom/geom_bvh.h
M	intern/cycles/kernel/geom/geom_bvh_volume.h
M	intern/cycles/kernel/geom/geom_bvh_volume_all.h
M	intern/cycles/kernel/geom/geom_qbvh_volume.h
M	intern/cycles/kernel/geom/geom_qbvh_volume_all.h
M	intern/cycles/kernel/kernel_volume.h

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

diff --git a/intern/cycles/kernel/geom/geom_bvh.h b/intern/cycles/kernel/geom/geom_bvh.h
index d9f4076..d8e6224 100644
--- a/intern/cycles/kernel/geom/geom_bvh.h
+++ b/intern/cycles/kernel/geom/geom_bvh.h
@@ -371,39 +371,40 @@ ccl_device_intersect bool scene_intersect_shadow_all(KernelGlobals *kg, const Ra
 
 #ifdef __VOLUME__
 ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg,
-                            const Ray *ray,
-                            Intersection *isect)
+                                                 const Ray *ray,
+                                                 Intersection *isect,
+                                                 const uint visibility)
 {
 #ifdef __OBJECT_MOTION__
 	if(kernel_data.bvh.have_motion) {
 #ifdef __HAIR__
 		if(kernel_data.bvh.have_curves)
-			return bvh_intersect_volume_hair_motion(kg, ray, isect);
+			return bvh_intersect_volume_hair_motion(kg, ray, isect, visibility);
 #endif /* __HAIR__ */
 
-		return bvh_intersect_volume_motion(kg, ray, isect);
+		return bvh_intersect_volume_motion(kg, ray, isect, visibility);
 	}
 #endif /* __OBJECT_MOTION__ */
 
 #ifdef __HAIR__
 	if(kernel_data.bvh.have_curves)
-		return bvh_intersect_volume_hair(kg, ray, isect);
+		return bvh_intersect_volume_hair(kg, ray, isect, visibility);
 #endif /* __HAIR__ */
 
 #ifdef __KERNEL_CPU__
 
 #ifdef __INSTANCING__
 	if(kernel_data.bvh.have_instancing)
-		return bvh_intersect_volume_instancing(kg, ray, isect);
+		return bvh_intersect_volume_instancing(kg, ray, isect, visibility);
 #endif /* __INSTANCING__ */
 
-	return bvh_intersect_volume(kg, ray, isect);
+	return bvh_intersect_volume(kg, ray, isect, visibility);
 #else /* __KERNEL_CPU__ */
 
 #ifdef __INSTANCING__
-	return bvh_intersect_volume_instancing(kg, ray, isect);
+	return bvh_intersect_volume_instancing(kg, ray, isect, visibility);
 #else
-	return bvh_intersect_volume(kg, ray, isect);
+	return bvh_intersect_volume(kg, ray, isect, visibility);
 #endif /* __INSTANCING__ */
 
 #endif /* __KERNEL_CPU__ */
@@ -414,30 +415,31 @@ ccl_device_intersect bool scene_intersect_volume(KernelGlobals *kg,
 ccl_device_intersect uint scene_intersect_volume_all(KernelGlobals *kg,
                                                      const Ray *ray,
                                                      Intersection *isect,
-                                                     const uint max_hits)
+                                                     const uint max_hits,
+                                                     const uint visibility)
 {
 #ifdef __OBJECT_MOTION__
 	if(kernel_data.bvh.have_motion) {
 #ifdef __HAIR__
 		if(kernel_data.bvh.have_curves)
-			return bvh_intersect_volume_all_hair_motion(kg, ray, isect, max_hits);
+			return bvh_intersect_volume_all_hair_motion(kg, ray, isect, max_hits, visibility);
 #endif /* __HAIR__ */
 
-		return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits);
+		return bvh_intersect_volume_all_motion(kg, ray, isect, max_hits, visibility);
 	}
 #endif /* __OBJECT_MOTION__ */
 
 #ifdef __HAIR__
 	if(kernel_data.bvh.have_curves)
-		return bvh_intersect_volume_all_hair(kg, ray, isect, max_hits);
+		return bvh_intersect_volume_all_hair(kg, ray, isect, max_hits, visibility);
 #endif /* __HAIR__ */
 
 #ifdef __INSTANCING__
 	if(kernel_data.bvh.have_instancing)
-		return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits);
+		return bvh_intersect_volume_all_instancing(kg, ray, isect, max_hits, visibility);
 #endif /* __INSTANCING__ */
 
-	return bvh_intersect_volume_all(kg, ray, isect, max_hits);
+	return bvh_intersect_volume_all(kg, ray, isect, max_hits, visibility);
 }
 #endif
 
diff --git a/intern/cycles/kernel/geom/geom_bvh_volume.h b/intern/cycles/kernel/geom/geom_bvh_volume.h
index 656cd6e..b1b2e2d 100644
--- a/intern/cycles/kernel/geom/geom_bvh_volume.h
+++ b/intern/cycles/kernel/geom/geom_bvh_volume.h
@@ -33,7 +33,8 @@
 
 ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
                                             const Ray *ray,
-                                            Intersection *isect)
+                                            Intersection *isect,
+                                            const uint visibility)
 {
 	/* todo:
 	 * - test if pushing distance on the stack helps (for non shadow rays)
@@ -56,8 +57,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 	float3 idir = bvh_inverse_direction(dir);
 	int object = OBJECT_NONE;
 
-	const uint visibility = PATH_RAY_ALL_VISIBILITY;
-
 #if BVH_FEATURE(BVH_MOTION)
 	Transform ob_itfm;
 #endif
@@ -336,13 +335,15 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 
 ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals *kg,
                                          const Ray *ray,
-                                         Intersection *isect)
+                                         Intersection *isect,
+                                         const uint visibility)
 {
 #ifdef __QBVH__
 	if(kernel_data.bvh.use_qbvh) {
 		return BVH_FUNCTION_FULL_NAME(QBVH)(kg,
 		                                    ray,
-		                                    isect);
+		                                    isect,
+		                                    visibility);
 	}
 	else
 #endif
@@ -350,7 +351,8 @@ ccl_device_inline bool BVH_FUNCTION_NAME(KernelGlobals *kg,
 		kernel_assert(kernel_data.bvh.use_qbvh == false);
 		return BVH_FUNCTION_FULL_NAME(BVH)(kg,
 		                                   ray,
-		                                   isect);
+		                                   isect,
+		                                   visibility);
 	}
 }
 
diff --git a/intern/cycles/kernel/geom/geom_bvh_volume_all.h b/intern/cycles/kernel/geom/geom_bvh_volume_all.h
index 8f7e3ad..426046e 100644
--- a/intern/cycles/kernel/geom/geom_bvh_volume_all.h
+++ b/intern/cycles/kernel/geom/geom_bvh_volume_all.h
@@ -34,7 +34,8 @@
 ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
                                             const Ray *ray,
                                             Intersection *isect_array,
-                                            const uint max_hits)
+                                            const uint max_hits,
+                                            const uint visibility)
 {
 	/* todo:
 	 * - test if pushing distance on the stack helps (for non shadow rays)
@@ -59,8 +60,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 	int object = OBJECT_NONE;
 	float isect_t = tmax;
 
-	const uint visibility = PATH_RAY_ALL_VISIBILITY;
-
 #if BVH_FEATURE(BVH_MOTION)
 	Transform ob_itfm;
 #endif
@@ -430,14 +429,16 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
 ccl_device_inline uint BVH_FUNCTION_NAME(KernelGlobals *kg,
                                          const Ray *ray,
                                          Intersection *isect_array,
-                                         const uint max_hits)
+                                         const uint max_hits,
+                                         const uint visibility)
 {
 #ifdef __QBVH__
 	if(kernel_data.bvh.use_qbvh) {
 		return BVH_FUNCTION_FULL_NAME(QBVH)(kg,
 		                                    ray,
 		                                    isect_array,
-		                                    max_hits);
+		                                    max_hits,
+		                                    visibility);
 	}
 	else
 #endif
@@ -446,7 +447,8 @@ ccl_device_inline uint BVH_FUNCTION_NAME(KernelGlobals *kg,
 		return BVH_FUNCTION_FULL_NAME(BVH)(kg,
 		                                   ray,
 		                                   isect_array,
-		                                   max_hits);
+		                                   max_hits,
+		                                   visibility);
 	}
 }
 
diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume.h b/intern/cycles/kernel/geom/geom_qbvh_volume.h
index 4086447..a4ee569 100644
--- a/intern/cycles/kernel/geom/geom_qbvh_volume.h
+++ b/intern/cycles/kernel/geom/geom_qbvh_volume.h
@@ -29,7 +29,8 @@
 
 ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
                                              const Ray *ray,
-                                             Intersection *isect)
+                                             Intersection *isect,
+                                             const uint visibility)
 {
 	/* TODO(sergey):
 	 * - Test if pushing distance on the stack helps.
@@ -51,8 +52,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
 	float3 idir = bvh_inverse_direction(dir);
 	int object = OBJECT_NONE;
 
-	const uint visibility = PATH_RAY_ALL_VISIBILITY;
-
 #if BVH_FEATURE(BVH_MOTION)
 	Transform ob_itfm;
 #endif
diff --git a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h
index 75e4c4e..38d4dd7 100644
--- a/intern/cycles/kernel/geom/geom_qbvh_volume_all.h
+++ b/intern/cycles/kernel/geom/geom_qbvh_volume_all.h
@@ -30,7 +30,8 @@
 ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
                                              const Ray *ray,
                                              Intersection *isect_array,
-                                             const uint max_hits)
+                                             const uint max_hits,
+                                             const uint visibility)
 {
 	/* TODO(sergey):
 	 * - Test if pushing distance on the stack helps.
@@ -54,8 +55,6 @@ ccl_device uint BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
 	int object = OBJECT_NONE;
 	float isect_t = tmax;
 
-	const uint visibility = PATH_RAY_ALL_VISIBILITY;
-
 #if BVH_FEATURE(BVH_MOTION)
 	Transform ob_itfm;
 #endif
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h
index ef0d4f6..5892c97 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -994,12 +994,14 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
 
 	int stack_index = 0, enclosed_index = 0;
 
+	const uint visibility = PATH_RAY_ALL_VISIBILITY | kernel_data.integrator.layer_flag;
 #ifdef __VOL

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list