[Bf-blender-cvs] [3f57714] master: Cycles: Don't perform re-intersection if ray distance is zero

Sergey Sharybin noreply at git.blender.org
Fri Jan 30 21:51:04 CET 2015

Commit: 3f5771475d55ed981bd98ee5810e62b68bccbb38
Author: Sergey Sharybin
Date:   Sat Jan 31 01:19:08 2015 +0500
Branches: master

Cycles: Don't perform re-intersection if ray distance is zero

It is possible that ray distance will be zero which would make intersection
refinement return NaN as the refined position which would later lead to all
sort of mathematical issues.

Don't think there are ways to improve intersection accuracy for such rays
so just return original intersection coordinate.

This should fix T43475.

TODO: Need to look into possible issues in Ashikhmin BSDF which might return
zero-length reflected/transmitted ray?


M	intern/cycles/kernel/geom/geom_triangle_intersect.h


diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index 475ee50..bd5861d 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -309,6 +309,9 @@ ccl_device_inline float3 triangle_refine(KernelGlobals *kg,
 	if(isect->object != OBJECT_NONE) {
+		if(UNLIKELY(t == 0.0f)) {
+			return P;
+		}
 #ifdef __OBJECT_MOTION__
 		Transform tfm = sd->ob_itfm;

More information about the Bf-blender-cvs mailing list