diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-18 13:19:53 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-10-18 13:19:53 +0300 |
commit | 01a0649354a4052e3f826663c50753833a257d1f (patch) | |
tree | 2bcb0f0d79d0d08256392f6903a2f5cb14c00af0 /intern/cycles/render/mesh.cpp | |
parent | ab7ebf2b10f67b002447fb0e2cb352c2c178e128 (diff) |
Cycles: Fix wrong shading when some mesh triangle has non-finite coordinate
This is fully unpredictable for artists when one damaged object makes the whole
scene to render incorrectly. This involves two main changes:
- It is not enough to check triangle bounds to be valid when building BVH.
This is because triangle might have some finite vertices and some non-finite.
- We shouldn't add non-finite triangle area to the overall area for MIS.
Diffstat (limited to 'intern/cycles/render/mesh.cpp')
-rw-r--r-- | intern/cycles/render/mesh.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/intern/cycles/render/mesh.cpp b/intern/cycles/render/mesh.cpp index c5eb3a0d3a8..6470b3b1075 100644 --- a/intern/cycles/render/mesh.cpp +++ b/intern/cycles/render/mesh.cpp @@ -120,6 +120,13 @@ float3 Mesh::Triangle::compute_normal(const float3 *verts) const return norm / normlen; } +bool Mesh::Triangle::valid(const float3 *verts) const +{ + return isfinite3_safe(verts[v[0]]) && + isfinite3_safe(verts[v[1]]) && + isfinite3_safe(verts[v[2]]); +} + /* Curve */ void Mesh::Curve::bounds_grow(const int k, const float3 *curve_keys, const float *curve_radius, BoundBox& bounds) const |