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.
This commit is contained in:
Sergey Sharybin 2015-09-04 18:33:50 +05:00
parent 65a80708d4
commit 713ce037ab
1 changed files with 1 additions and 1 deletions

View File

@ -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. */