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-08-25 11:55:16 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-08-25 11:55:59 +0300
commit29c733e6f2dd779153fe49d94b0f3de41c58b030 (patch)
treead9fd7b390d366c2406ff609f817024c8841b79f
parent3c533be77ea8f6c88b188eb870bb46ba972d1372 (diff)
Fix T49078: Cycles tries to render volume from another render layer when camera is in volume
-rw-r--r--intern/cycles/kernel/kernel_path_state.h6
-rw-r--r--intern/cycles/kernel/kernel_volume.h10
2 files changed, 10 insertions, 6 deletions
diff --git a/intern/cycles/kernel/kernel_path_state.h b/intern/cycles/kernel/kernel_path_state.h
index e0e35d792ab..661dc52fb31 100644
--- a/intern/cycles/kernel/kernel_path_state.h
+++ b/intern/cycles/kernel/kernel_path_state.h
@@ -45,9 +45,9 @@ ccl_device_inline void path_state_init(KernelGlobals *kg,
state->volume_bounce = 0;
if(kernel_data.integrator.use_volumes) {
- /* initialize volume stack with volume we are inside of */
- kernel_volume_stack_init(kg, stack_sd, ray, state->volume_stack);
- /* seed RNG for cases where we can't use stratified samples */
+ /* Initialize volume stack with volume we are inside of. */
+ kernel_volume_stack_init(kg, stack_sd, state, ray, state->volume_stack);
+ /* Seed RNG for cases where we can't use stratified samples .*/
state->rng_congruential = lcg_init(*rng + sample*0x51633e2d);
}
else {
diff --git a/intern/cycles/kernel/kernel_volume.h b/intern/cycles/kernel/kernel_volume.h
index 9dafed9afd1..4ab51b81f13 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -1010,7 +1010,8 @@ ccl_device bool kernel_volume_use_decoupled(KernelGlobals *kg, bool heterogeneou
ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
ShaderData *stack_sd,
- Ray *ray,
+ const PathState *state,
+ const Ray *ray,
VolumeStack *stack)
{
/* NULL ray happens in the baker, does it need proper initialization of
@@ -1031,9 +1032,12 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
return;
}
+ kernel_assert(state->flag & PATH_RAY_CAMERA);
+
Ray volume_ray = *ray;
volume_ray.t = FLT_MAX;
+ const uint visibility = (state->flag & PATH_RAY_ALL_VISIBILITY);
int stack_index = 0, enclosed_index = 0;
#ifdef __VOLUME_RECORD_ALL__
@@ -1042,7 +1046,7 @@ ccl_device void kernel_volume_stack_init(KernelGlobals *kg,
&volume_ray,
hits,
2*VOLUME_STACK_SIZE,
- PATH_RAY_ALL_VISIBILITY);
+ visibility);
if(num_hits > 0) {
int enclosed_volumes[VOLUME_STACK_SIZE];
Intersection *isect = hits;
@@ -1091,7 +1095,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, PATH_RAY_ALL_VISIBILITY)) {
+ if(!scene_intersect_volume(kg, &volume_ray, &isect, visibility)) {
break;
}