Fix T49078: Cycles tries to render volume from another render layer when camera is in volume
This commit is contained in:
parent
3c533be77e
commit
29c733e6f2
Notes:
blender-bot
2023-02-14 07:42:01 +01:00
Referenced by issue #49078, When rendering fire in cycles, odd duplicates appear when the camera is located inside the domain
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue