diff options
author | Mai Lavelle <mai.lavelle@gmail.com> | 2016-09-15 02:34:43 +0300 |
---|---|---|
committer | Mai Lavelle <mai.lavelle@gmail.com> | 2016-09-15 02:53:55 +0300 |
commit | fe28e350e96a8b137354e9038c6d25a9145d068d (patch) | |
tree | 6242fe08ae4c703f06730c24aa64c21e5bd3fd3e | |
parent | b9d1852c5ae7a9d488a48668aff974abd6729164 (diff) |
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.
-rw-r--r-- | intern/cycles/render/mesh_subdivision.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/intern/cycles/render/mesh_subdivision.cpp b/intern/cycles/render/mesh_subdivision.cpp index c8cc3abf7d9..3b4841f5b20 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; } |