Commit: 1ea0a14fd1565140efbf9a9c5bb483b6a975625e Author: Brecht Van Lommel Date: Mon Jul 19 17:09:29 2021 +0200 Branches: cycles-x https://developer.blender.org/rB1ea0a14fd1565140efbf9a9c5bb483b6a975625e
Fix wrong MIS weight with transparent surfaces and volumes, leading to noise =================================================================== M intern/cycles/kernel/integrator/integrator_shade_surface.h M intern/cycles/kernel/integrator/integrator_state_template.h =================================================================== diff --git a/intern/cycles/kernel/integrator/integrator_shade_surface.h b/intern/cycles/kernel/integrator/integrator_shade_surface.h index aafb6f3a072..f0607138db7 100644 --- a/intern/cycles/kernel/integrator/integrator_shade_surface.h +++ b/intern/cycles/kernel/integrator/integrator_shade_surface.h @@ -259,7 +259,10 @@ ccl_device_forceinline int integrate_surface_bsdf_bssrdf_bounce(INTEGRATOR_STATE } /* Update path state */ - if (!(label & LABEL_TRANSPARENT)) { + if (label & LABEL_TRANSPARENT) { + INTEGRATOR_STATE_WRITE(path, mis_ray_t) += sd->ray_length; + } + else { INTEGRATOR_STATE_WRITE(path, mis_ray_pdf) = bsdf_pdf; INTEGRATOR_STATE_WRITE(path, mis_ray_t) = 0.0f; INTEGRATOR_STATE_WRITE(path, min_ray_pdf) = fminf(bsdf_pdf, @@ -288,6 +291,8 @@ ccl_device_forceinline bool integrate_surface_volume_only_bounce(INTEGRATOR_STAT INTEGRATOR_STATE_WRITE(ray, dP) = differential_make_compact(sd->dP); # endif + INTEGRATOR_STATE_WRITE(path, mis_ray_t) += sd->ray_length; + return LABEL_TRANSMIT | LABEL_TRANSPARENT; } #endif diff --git a/intern/cycles/kernel/integrator/integrator_state_template.h b/intern/cycles/kernel/integrator/integrator_state_template.h index 13f565b29de..e3b0d893290 100644 --- a/intern/cycles/kernel/integrator/integrator_state_template.h +++ b/intern/cycles/kernel/integrator/integrator_state_template.h @@ -49,7 +49,10 @@ KERNEL_STRUCT_MEMBER(path, uint32_t, rng_hash, KERNEL_FEATURE_PATH_TRACING) KERNEL_STRUCT_MEMBER(path, uint32_t, rng_offset, KERNEL_FEATURE_PATH_TRACING) /* enum PathRayFlag */ KERNEL_STRUCT_MEMBER(path, uint32_t, flag, KERNEL_FEATURE_PATH_TRACING) -/* Multiple importance sampling. */ +/* Multiple importance sampling + * The PDF of BSDF sampling at the last scatter point, and distance to the + * last scatter point minus the last ray segment. This distance lets us + * compute the complete distance through transparent surfaces and volumes. */ KERNEL_STRUCT_MEMBER(path, float, mis_ray_pdf, KERNEL_FEATURE_PATH_TRACING) KERNEL_STRUCT_MEMBER(path, float, mis_ray_t, KERNEL_FEATURE_PATH_TRACING) /* Filter glossy. */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs