Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Stockner <lukas.stockner@freenet.de>2016-02-18 03:13:07 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2016-02-18 03:23:38 +0300
commita8fe3a1ceef31ca39a455fee25bc1e361e1048ff (patch)
tree4b7c86d0b086b5530aa854a6696063ea8d41c224 /intern/cycles/kernel/kernel_accumulate.h
parentd40a24a037eae679ac2bdfc5151625ba485ef375 (diff)
Fix T47461: Different results on CPU and GPU when using Branched Path Tracing
The issue here was actually somewhere else - the attached scene from the report used a light falloff node in a sunlamp (aka distant light). However, since distant lamps set the ray length to FLT_MAX and the light falloff node squares this value, it overflows and produces a NaN weight, which propagates and leads to a NaN intensity, which is then clamped to zero and produces the black pixels. To fix that issue, the smoothing part of the light falloff is just ignored if the smoothing term isn't finite (which makes sense since the term should converge to 1 as the distance increases). The reason for the different results on CPUs and GPUs is not perfectly clear, but probably can be explained with different handling of Inf/NaN edge cases. Also, to notice issues like these faster in the future, kernel_asserts were added that evaluate as false as soon as a non-finite intensity is produced.
Diffstat (limited to 'intern/cycles/kernel/kernel_accumulate.h')
-rw-r--r--intern/cycles/kernel/kernel_accumulate.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/intern/cycles/kernel/kernel_accumulate.h b/intern/cycles/kernel/kernel_accumulate.h
index 29eca865384..5f5a3609ded 100644
--- a/intern/cycles/kernel/kernel_accumulate.h
+++ b/intern/cycles/kernel/kernel_accumulate.h
@@ -378,6 +378,7 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg, PathRadi
/* Reject invalid value */
if(!isfinite(sum)) {
+ kernel_assert(!"Non-finite sum in path_radiance_clamp_and_sum!");
L_sum = make_float3(0.0f, 0.0f, 0.0f);
L->direct_diffuse = make_float3(0.0f, 0.0f, 0.0f);
@@ -445,8 +446,10 @@ ccl_device_inline float3 path_radiance_clamp_and_sum(KernelGlobals *kg, PathRadi
/* Reject invalid value */
float sum = fabsf((L_sum).x) + fabsf((L_sum).y) + fabsf((L_sum).z);
- if(!isfinite(sum))
+ if(!isfinite(sum)) {
+ kernel_assert(!"Non-finite final sum in path_radiance_clamp_and_sum!");
L_sum = make_float3(0.0f, 0.0f, 0.0f);
+ }
return L_sum;
}