From 09789296d97fec2581c9543012e4cbfae3c423a1 Mon Sep 17 00:00:00 2001 From: barfowl Date: Thu, 18 Sep 2014 19:13:55 -0700 Subject: [PATCH] Modified weighting of sharpness values for Chaikin crease method: - semi-sharp edges prevented from decreasing by averaging with inf-sharp - averaging now includes only semi-sharp edges around the vertex - see regression/shapes/catmark_chaikin2 --- opensubdiv/sdc/crease.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/opensubdiv/sdc/crease.cpp b/opensubdiv/sdc/crease.cpp index 4750e763..6f692d12 100644 --- a/opensubdiv/sdc/crease.cpp +++ b/opensubdiv/sdc/crease.cpp @@ -118,8 +118,10 @@ Crease::SubdivideEdgeSharpnessAtVertex(float edgeSharpness, float sharpSum = 0.0f; int sharpCount = 0; for (int i = 0; i < incEdgeCountAtVertex; ++i) { - sharpCount += IsSharp(incEdgeSharpness[i]); - sharpSum += incEdgeSharpness[i]; + if (IsSemiSharp(incEdgeSharpness[i])) { + sharpCount ++; + sharpSum += incEdgeSharpness[i]; + } } if (sharpCount > 1) { // Chaikin rule is 3/4 original sharpness + 1/4 average of the others @@ -155,8 +157,10 @@ Crease::SubdivideEdgeSharpnessesAroundVertex(int edgeCount, float sharpSum = 0.0f; int sharpCount = 0; for (int i = 0; i < edgeCount; ++i) { - sharpCount += IsSharp(parentSharpness[i]); - sharpSum += parentSharpness[i]; + if (IsSemiSharp(parentSharpness[i])) { + sharpCount ++; + sharpSum += parentSharpness[i]; + } } //