Fix T45778: Objects scaled to 0 cause black artifacts with Static BVH

The issue was caused by some numeric instability in triangle intersection which
was visible on avx2 CPUs and GPUs (at least sm_20 here) but maybe some others
too.

Committing rather a workaround for now to be safe for the release, still need
some investigation.

From tests with grass field from Gooseberry project didn't see measurable
slowdown.
This commit is contained in:
Sergey Sharybin 2015-08-24 21:21:30 +02:00
parent 3633499f4e
commit 2fb639deed
Notes: blender-bot 2023-02-14 11:18:07 +01:00
Referenced by issue #45778, Textured Objects scaled to 0 cause black artefacts with Static BVH
1 changed files with 3 additions and 0 deletions

View File

@ -173,6 +173,9 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility)
#endif
{
if(len_squared(cross(tri_a, tri_b)) < 1e-14f) {
return false;
}
/* Normalize U, V, W, and T. */
const float inv_det = 1.0f / det;
isect->prim = triAddr;