Commit: 0960d523a261b53aa6e842f2e3320c7a4afa381b
Author: Mai Lavelle
Date:   Wed Sep 14 19:34:43 2016 -0400
Branches: blender-v2.78-release
https://developer.blender.org/rB0960d523a261b53aa6e842f2e3320c7a4afa381b

Fix T49179: Parts of mesh disappear with adaptive subdivision

Problem was zero length normal caused by a precision issue in patch evaluation.
This is somewhat of a quick fix, but is better than allowing possible NaNs to
occur and cause problems elsewhere.

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

M       intern/cycles/render/mesh_subdivision.cpp

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

diff --git a/intern/cycles/render/mesh_subdivision.cpp 
b/intern/cycles/render/mesh_subdivision.cpp
index c8cc3ab..3b4841f 100644
--- a/intern/cycles/render/mesh_subdivision.cpp
+++ b/intern/cycles/render/mesh_subdivision.cpp
@@ -284,7 +284,12 @@ struct OsdPatch : Patch {
 
                if(dPdu) *dPdu = du;
                if(dPdv) *dPdv = dv;
-               if(N) *N = normalize(cross(du, dv));
+               if(N) {
+                       *N = cross(du, dv);
+
+                       float t = len(*N);
+                       *N = (t != 0.0f) ? *N/t : make_float3(0.0f, 0.0f, 1.0f);
+               }
        }
 
        BoundBox bound() { return BoundBox::empty; }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to