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?
This commit is contained in:
Sergey Sharybin 2015-01-31 01:19:08 +05:00
parent cb2007906f
commit 3f5771475d
Notes: blender-bot 2023-10-12 12:49:04 +02:00
Referenced by issue #43510, bake animation wrong result
Referenced by issue #43498, Wrong creation in rotated curve objects
Referenced by issue #43475, Rendered Viewport Crash with Ashikhmin-Shirley Glossy BSDF
1 changed files with 3 additions and 0 deletions

View File

@ -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