Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-04-04 20:30:38 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-04-04 20:30:38 +0300
commit65f279b7705a14ffdbd79f1835504344af40c283 (patch)
tree9d010f9558ba99e7e47c6d2e607147e641964d4e /intern/cycles
parentac8f4ba5301852c13f165c9d85dbc98f599d5195 (diff)
Cycles: Fix wrong camera in volume check when domain is only visible to camera rays
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/kernel/geom/geom_bvh.h30
-rw-r--r--intern/cycles/kernel/geom/geom_bvh_volume.h14
-rw-r--r--intern/cycles/kernel/geom/geom_bvh_volume_all.h14
-rw-r--r--intern/cycles/kernel/geom/geom_qbvh_volume.h5
-rw-r--r--intern/cycles/kernel/geom/geom_qbvh_volume_all.h5
-rw-r--r--intern/cycles/kernel/kernel_volume.h14
6 files changed, 46 insertions, 36 deletions
diff --git a/intern/cycles/kernel/geom/geom_bvh.h b/intern/cycles/kernel/geom/geom_bvh.h
index e5cd7b76ded..f480af68c37 100644
--- a/intern/cycles/kernel/geom/geom_bvh.h
+++ b/intern/cycles/kernel/geom/geom_bvh.h
@@ -299,38 +299,39 @@ 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)
+ 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__ */
@@ -341,30 +342,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 /* __VOLUME_RECORD_ALL__ */
diff --git a/intern/cycles/kernel/geom/geom_bvh_volume.h b/intern/cycles/kernel/geom/geom_bvh_volume.h
index 937a5d4aaec..14ab6e6891a 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 6b0b20138da..b16eb3906e8 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 696a48a7b3e..36648fdd244 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 2cef0dcb1dc..2cf78f2f00e 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 1dc2c5f8fbb..86a3adbf93a 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 __VOLUME_RECORD_ALL__
Intersection hits[2*VOLUME_STACK_SIZE];
uint num_hits = scene_intersect_volume_all(kg,
&volume_ray,
hits,
- 2*VOLUME_STACK_SIZE);
+ 2*VOLUME_STACK_SIZE,
+ visibility);
if(num_hits > 0) {
int enclosed_volumes[VOLUME_STACK_SIZE];
Intersection *isect = hits;
@@ -1048,7 +1050,7 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
step < 2 * VOLUME_STACK_SIZE)
{
Intersection isect;
- if(!scene_intersect_volume(kg, &volume_ray, &isect)) {
+ if(!scene_intersect_volume(kg, &volume_ray, &isect, visibility)) {
break;
}
@@ -1159,7 +1161,8 @@ ccl_device void kernel_volume_stack_update_for_subsurface(KernelGlobals *kg,
uint num_hits = scene_intersect_volume_all(kg,
&volume_ray,
hits,
- 2*VOLUME_STACK_SIZE);
+ 2*VOLUME_STACK_SIZE,
+ PATH_RAY_ALL_VISIBILITY);
if(num_hits > 0) {
Intersection *isect = hits;
@@ -1175,7 +1178,10 @@ ccl_device void kernel_volume_stack_update_for_subsurface(KernelGlobals *kg,
Intersection isect;
int step = 0;
while(step < 2 * VOLUME_STACK_SIZE &&
- scene_intersect_volume(kg, &volume_ray, &isect))
+ scene_intersect_volume(kg,
+ &volume_ray,
+ &isect,
+ PATH_RAY_ALL_VISIBILITY))
{
ShaderData sd;
shader_setup_from_ray(kg, &sd, &isect, &volume_ray);