Fixed bug with non-manifold face-varying topology causing crash:

- corrected the regular patch assembly in Far::PatchTableFactory
    - updated regression shapes to include the problematic topology
This commit is contained in:
barry 2016-12-15 12:33:36 -08:00 committed by David G Yu
parent e004143a44
commit e80d4bedcf
5 changed files with 103 additions and 26 deletions

View File

@ -61,6 +61,7 @@ static void initShapes() {
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound1", catmark_fvar_bound1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound2", catmark_fvar_bound2, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound3", catmark_fvar_bound3, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_bound4", catmark_fvar_bound4, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_fvar_project0", catmark_fvar_project0, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test1", catmark_gregory_test1, kCatmark ) );
g_defaultShapes.push_back( ShapeDesc("catmark_gregory_test2", catmark_gregory_test2, kCatmark ) );

View File

@ -674,13 +674,23 @@ PatchTableFactory::BuilderContext::GetRegularPatchBoundaryMask(
// patch, and so both of its neighboring corners need to be re-interpreted as
// boundaries.
//
// With the introduction of inf-sharp patches, this may soon change...
// With the introduction of sharp irregular patches, we are now better off
// using irregular patches where appropriate, which will simplify the following
// when this patch was already determined to be regular...
//
if (fTag._nonManifold && (fvcRefiner < 0)) {
if (fTag._nonManifold) {
if (vTags[0]._nonManifold) vBoundaryMask |= (1 << 0) | (vTags[0]._infSharp ? 10 : 0);
if (vTags[1]._nonManifold) vBoundaryMask |= (1 << 1) | (vTags[1]._infSharp ? 5 : 0);
if (vTags[2]._nonManifold) vBoundaryMask |= (1 << 2) | (vTags[2]._infSharp ? 10 : 0);
if (vTags[3]._nonManifold) vBoundaryMask |= (1 << 3) | (vTags[3]._infSharp ? 5 : 0);
// Force adjacent edges as boundaries if only one vertex in the resulting mask
// (which would be an irregular boundary for Catmark, but not Loop):
if ((vBoundaryMask == (1 << 0)) || (vBoundaryMask == (1 << 2))) {
vBoundaryMask |= 10;
} else if ((vBoundaryMask == (1 << 1)) || (vBoundaryMask == (1 << 3))) {
vBoundaryMask |= 5;
}
}
// Convert directly from a vertex- to edge-mask (no need to inspect edges):

View File

@ -49,6 +49,7 @@
#include "catmark_fvar_bound1.h"
#include "catmark_fvar_bound2.h"
#include "catmark_fvar_bound3.h"
#include "catmark_fvar_bound4.h"
#include "catmark_fvar_project0.h"
#include "catmark_gregory_test0.h"
#include "catmark_gregory_test1.h"

View File

@ -1,5 +1,5 @@
//
// Copyright 2013 Pixar
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
@ -25,27 +25,41 @@
static const std::string catmark_fan =
"# This file uses centimeters as units for non-parametric coordinates.\n"
"\n"
"v -1.000000 0.000000 -1.000000\n"
"v -1.000000 0.000000 0.000000\n"
"v 0.000000 0.000000 0.000000\n"
"v 0.000000 0.000000 -1.000000\n"
"v 1.000000 0.000000 0.000000\n"
"v 1.000000 0.000000 -1.000000\n"
"v 0.000000 1.000000 0.000000\n"
"v 0.000000 1.000000 -1.000000\n"
"vt 0.000000 0.000000\n"
"vt 1.000000 0.000000\n"
"vt 1.000000 1.000000\n"
"vt 0.000000 1.000000\n"
"vt 0.000000 0.000000\n"
"vt 1.000000 0.000000\n"
"vt 1.000000 1.000000\n"
"vt 0.000000 1.000000\n"
"vt 0.000000 0.000000\n"
"vt 1.000000 0.000000\n"
"vt 1.000000 1.000000\n"
"vt 0.000000 1.000000\n"
"f 1/1 2/2 3/3 4/4\n"
"f 4/5 3/6 5/7 6/8\n"
"f 4/9 3/10 7/11 8/12\n"
"# This file uses centimeters as units for non-parametric coordinates.\n"
"v 0.0 0 1.0\n"
"v -0.5 0 0.5\n"
"v 0.5 0 0.5\n"
"v -1.0 0 0.0\n"
"v 1.0 0 0.0\n"
"v -1.5 0 -0.5\n"
"v 1.5 0 -0.5\n"
"v -1.0 0 -1.0\n"
"v -0.5 0 -0.5\n"
"v 0.0 0 0.0\n"
"v 0.5 0 -0.5\n"
"v 1.0 0 -1.0\n"
"v -1.0 .5 -1.0\n"
"v -0.5 .5 -0.5\n"
"v 0.0 .5 0.0\n"
"v 0.5 .5 -0.5\n"
"v 1.0 .5 -1.0\n"
"v -1.0 -.5 -1.0\n"
"v -0.5 -.5 -0.5\n"
"v 0.0 -.5 0.0\n"
"v 0.5 -.5 -0.5\n"
"v 1.0 -.5 -1.0\n"
"f 1 2 10 3\n"
"f 2 4 9 10\n"
"f 4 6 8 9\n"
"f 5 3 10 11\n"
"f 7 5 11 12\n"
"f 8 9 14 13\n"
"f 9 10 15 14\n"
"f 10 11 16 15\n"
"f 11 12 17 16\n"
"f 9 8 18 19\n"
"f 10 9 19 20\n"
"f 11 10 20 21\n"
"f 12 11 21 22\n"
"t interpolateboundary 1/0/0 1\n"
"\n";

View File

@ -0,0 +1,51 @@
//
// Copyright 2016 Dreamworks
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
static const std::string catmark_fvar_bound4 =
"v -0.5 0.0 -0.5\n"
"v 0.0 0.0 -0.5\n"
"v 0.5 0.0 -0.5\n"
"v -0.5 0.0 0.0\n"
"v 0.0 -0.5 0.0\n"
"v 0.5 0.0 0.0\n"
"v -0.5 0.0 0.5\n"
"v 0.0 0.0 0.5\n"
"v 0.5 0.0 0.5\n"
"vt 0.1 0.1\n"
"vt 0.5 0.0\n"
"vt 1.0 0.1\n"
"vt 0.0 0.5\n"
"vt 0.6 0.6\n"
"vt 1.0 0.4\n"
"vt 1.0 0.6\n"
"vt 0.1 1.0\n"
"vt 0.4 1.0\n"
"vt 0.6 1.0\n"
"vt 1.0 1.0\n"
"f 1/1 2/2 5/5 4/4\n"
"f 2/2 3/3 6/6 5/5\n"
"f 4/4 5/5 8/9 7/8\n"
"f 5/5 6/7 9/11 8/10\n"
"t interpolateboundary 1/0/0 1\n"
;