Fix #113461: Cycles subsurface artifacts with volume interior

Ignore self for the volume stack update from the the subsurface entry to
the exit point. This was meant for other objects only.
This commit is contained in:
Brecht Van Lommel 2023-10-11 20:46:32 +02:00 • committed by Philipp Oeser
parent 9bc7fcc36e
commit b6f7ebe811

View file

@ -44,6 +44,10 @@ ccl_device void integrator_volume_stack_update_for_subsurface(KernelGlobals kg,
qsort(hits, num_hits, sizeof(Intersection), intersections_compare);
for (uint hit = 0; hit < num_hits; ++hit, ++isect) {
/* Ignore self, SSS itself already enters and exits the object. */
if (isect->object == volume_ray.self.object) {
continue;
}
shader_setup_from_ray(kg, stack_sd, &volume_ray, isect);
volume_stack_enter_exit(kg, state, stack_sd);
}
@ -53,9 +57,11 @@ ccl_device void integrator_volume_stack_update_for_subsurface(KernelGlobals kg,
int step = 0;
while (step < 2 * volume_stack_size &&
scene_intersect_volume(kg, &volume_ray, &isect, visibility)) {
shader_setup_from_ray(kg, stack_sd, &volume_ray, &isect);
volume_stack_enter_exit(kg, state, stack_sd);
/* Ignore self, SSS itself already enters and exits the object. */
if (isect.object != volume_ray.self.object) {
shader_setup_from_ray(kg, stack_sd, &volume_ray, &isect);
volume_stack_enter_exit(kg, state, stack_sd);
}
/* Move ray forward. */
volume_ray.tmin = intersection_t_offset(isect.t);
volume_ray.self.object = isect.object;