[Bf-blender-cvs] [713ce03] master: Cycles: Fix wrong check for zero-sized triangles

Sergey Sharybin noreply at git.blender.org
Fri Sep 4 17:06:36 CEST 2015


Commit: 713ce037ab7738535ce05075b8b83ce08c0a9b9c
Author: Sergey Sharybin
Date:   Fri Sep 4 18:33:50 2015 +0500
Branches: master
https://developer.blender.org/rB713ce037ab7738535ce05075b8b83ce08c0a9b9c

Cycles: Fix wrong check for zero-sized triangles

Initial idea was to optimize calculation a bit by skipping calculation of actual
triangle edges and use vector from ray origin to triangles. In practice this
optimization didn't quite work in cases when origin point is too close to the
triangle.

Let's do 2.76 with a bit more complicated calculation, still looking into exact
reasons why watertight intersections fails in certain cases, but actual fix might
bit be ready so soon.

This fixes wrong eyes on the lady from T46013.

===================================================================

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 8803866..c30c71b 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -173,7 +173,7 @@ ccl_device_inline bool triangle_intersect(KernelGlobals *kg,
 	if(kernel_tex_fetch(__prim_visibility, triAddr) & visibility)
 #endif
 	{
-		if(len_squared(cross(A, B)) < 1e-12f) {
+		if(len_squared(cross(tri_b - tri_a, tri_c - tri_a)) < 1e-16f) {
 			return false;
 		}
 		/* Normalize U, V, W, and T. */




More information about the Bf-blender-cvs mailing list