diff options
author | Brecht Van Lommel <brecht@blender.org> | 2021-11-03 19:28:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2021-11-05 22:50:19 +0300 |
commit | d1a9425a2fde32b6786b333ab55661da507e818b (patch) | |
tree | 42f5068d3c6377a4c20be579766af361b2d1c360 /intern/cycles/kernel/integrator/shade_background.h | |
parent | 4b56eed0f786562dfe961e23091f4f20c16a9e90 (diff) |
Fix T91733, T92486: Cycles wrong shadow catcher with volumes
Changes:
* After hitting a shadow catcher, re-initialize the volume stack taking
into account shadow catcher ray visibility. This ensures that volume objects
are included in the stack only if they are shadow catchers.
* If there is a volume to be shaded in front of the shadow catcher, the split
is now performed in the shade_volume kernel after volume shading is done.
* Previously the background pass behind a shadow catcher was done as part of
the regular path, now it is done as part of the shadow catcher path.
For a shadow catcher path with volumes and visible background, operations are
done in this order now:
* intersect_closest
* shade_volume
* shadow catcher split
* intersect_volume_stack
* shade_background
* shade_surface
The world volume is currently assumed to be CG, that is it does not exist in
the footage. We may consider adding an option to control this, or change the
default. With a volume object this control is already possible.
This includes refactoring to centralize the logic for next kernel scheduling
in intersect_closest.h.
Differential Revision: https://developer.blender.org/D13093
Diffstat (limited to 'intern/cycles/kernel/integrator/shade_background.h')
-rw-r--r-- | intern/cycles/kernel/integrator/shade_background.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/intern/cycles/kernel/integrator/shade_background.h b/intern/cycles/kernel/integrator/shade_background.h index 71a590749bd..24482e85b05 100644 --- a/intern/cycles/kernel/integrator/shade_background.h +++ b/intern/cycles/kernel/integrator/shade_background.h @@ -192,23 +192,11 @@ ccl_device void integrator_shade_background(KernelGlobals kg, #ifdef __SHADOW_CATCHER__ if (INTEGRATOR_STATE(state, path, flag) & PATH_RAY_SHADOW_CATCHER_BACKGROUND) { + /* Special case for shadow catcher where we want to fill the background pass + * behind the shadow catcher but also continue tracing the path. */ INTEGRATOR_STATE_WRITE(state, path, flag) &= ~PATH_RAY_SHADOW_CATCHER_BACKGROUND; - - const int isect_prim = INTEGRATOR_STATE(state, isect, prim); - const int isect_type = INTEGRATOR_STATE(state, isect, type); - const int shader = intersection_get_shader_from_isect_prim(kg, isect_prim, isect_type); - const int shader_flags = kernel_tex_fetch(__shaders, shader).flags; - - if (shader_flags & SD_HAS_RAYTRACE) { - INTEGRATOR_PATH_NEXT_SORTED(DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND, - DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE_RAYTRACE, - shader); - } - else { - INTEGRATOR_PATH_NEXT_SORTED(DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND, - DEVICE_KERNEL_INTEGRATOR_SHADE_SURFACE, - shader); - } + integrator_intersect_next_kernel_after_shadow_catcher_background< + DEVICE_KERNEL_INTEGRATOR_SHADE_BACKGROUND>(kg, state); return; } #endif |