diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-30 23:19:08 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-01-30 23:49:48 +0300 |
commit | 3f5771475d55ed981bd98ee5810e62b68bccbb38 (patch) | |
tree | 138e5741f19486883279e1252356a813120bcccc /intern | |
parent | cb2007906f902e4daeaf773833ef61da4020ea89 (diff) |
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?
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/geom/geom_triangle_intersect.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h index 475ee50f876..bd5861d018e 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, #ifdef __INTERSECTION_REFINE__ if(isect->object != OBJECT_NONE) { + if(UNLIKELY(t == 0.0f)) { + return P; + } #ifdef __OBJECT_MOTION__ Transform tfm = sd->ob_itfm; #else |