[Bf-blender-cvs] [9df0d209571] master: Cycles: don't allow negative BSDF weights

Brecht Van Lommel noreply at git.blender.org
Tue Sep 20 21:08:43 CEST 2022


Commit: 9df0d209571c71a0077be7bd3103d6f00ae23965
Author: Brecht Van Lommel
Date:   Tue Sep 20 20:58:07 2022 +0200
Branches: master
https://developer.blender.org/rB9df0d209571c71a0077be7bd3103d6f00ae23965

Cycles: don't allow negative BSDF weights

This doesn't work with path guiding, and likely other features.

===================================================================

M	intern/cycles/kernel/closure/alloc.h

===================================================================

diff --git a/intern/cycles/kernel/closure/alloc.h b/intern/cycles/kernel/closure/alloc.h
index 1cf06614f3b..f1af3b12269 100644
--- a/intern/cycles/kernel/closure/alloc.h
+++ b/intern/cycles/kernel/closure/alloc.h
@@ -53,6 +53,9 @@ ccl_device_inline ccl_private ShaderClosure *bsdf_alloc(ccl_private ShaderData *
 {
   kernel_assert(isfinite_safe(weight));
 
+  /* No negative weights allowed. */
+  weight = max(weight, zero_float3());
+
   const float sample_weight = fabsf(average(weight));
 
   /* Use comparison this way to help dealing with non-finite weight: if the average is not finite



More information about the Bf-blender-cvs mailing list