[Bf-blender-cvs] [2fb639d] master: Fix T45778: Objects scaled to 0 cause black artifacts with Static BVH
Sergey Sharybin
noreply at git.blender.org
Mon Aug 24 21:26:25 CEST 2015
Commit: 2fb639deedbdb0b0a821eb04ef69a7dd0080ea94
Author: Sergey Sharybin
Date: Mon Aug 24 21:21:30 2015 +0200
Branches: master
https://developer.blender.org/rB2fb639deedbdb0b0a821eb04ef69a7dd0080ea94
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.
===================================================================
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 3ef918d..7ca046f 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -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;
More information about the Bf-blender-cvs
mailing list