Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2020-09-24 19:03:51 +0300
committerSebastian Parborg <darkdefende@gmail.com>2020-09-24 19:08:45 +0300
commit119d0cd2ab14ec332b2b6d23b1cf671b56131438 (patch)
treea04ec98d88bf69fe38e7598cfde8af5e13adb459 /source/blender/blenkernel/intern/subdiv_eval.c
parent0d7036b40e68496fe36d7cbc8113b63574dd9d57 (diff)
Fix normal computation in opensubdiv when surface derivates are the same
In very rare occations, the returned derivates would be the same. This would lead to the normal calculation breaking (zero normals). Solution: Add this edge case to the other corner case checks. Reviewed By: Sergey
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_eval.c')
-rw-r--r--source/blender/blenkernel/intern/subdiv_eval.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c
index baee8a80f5a..201d308e096 100644
--- a/source/blender/blenkernel/intern/subdiv_eval.c
+++ b/source/blender/blenkernel/intern/subdiv_eval.c
@@ -184,8 +184,9 @@ void BKE_subdiv_eval_limit_point_and_derivatives(Subdiv *subdiv,
{
subdiv->evaluator->evaluateLimit(subdiv->evaluator, ptex_face_index, u, v, r_P, r_dPdu, r_dPdv);
- /* NOTE: In a very rare occasions derivatives are evaluated to zeros. This happens, for example,
- * in single vertex on Suzannne's nose (where two quads have 2 common edges).
+ /* NOTE: In a very rare occasions derivatives are evaluated to zeros or are exactly equal.
+ * This happens, for example, in single vertex on Suzannne's nose (where two quads have 2 common
+ * edges).
*
* This makes tangent space displacement (such as multires) impossible to be used in those
* vertices, so those needs to be addressed in one way or another.
@@ -195,7 +196,7 @@ void BKE_subdiv_eval_limit_point_and_derivatives(Subdiv *subdiv,
* that giving totally unusable derivatives. */
if (r_dPdu != NULL && r_dPdv != NULL) {
- if (is_zero_v3(r_dPdu) || is_zero_v3(r_dPdv)) {
+ if ((is_zero_v3(r_dPdu) || is_zero_v3(r_dPdv)) || equals_v3v3(r_dPdu, r_dPdv)) {
subdiv->evaluator->evaluateLimit(subdiv->evaluator,
ptex_face_index,
u * 0.999f + 0.0005f,