diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-04-22 15:28:10 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2020-04-22 15:28:10 +0300 |
commit | e5052e8bde17b5d6d10c02b21c78acf7c8a96e67 (patch) | |
tree | e9b1155b1b75fdbb7e4ed1391a0143f09a44b86a /intern | |
parent | c69a047b908cd2898d5904dc64cb43a4ebd4f22b (diff) | |
parent | 9aeb475e99b0b469bb6ce657da6480f971112a45 (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'intern')
-rw-r--r-- | intern/opensubdiv/internal/opensubdiv_converter_factory.cc | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc index d5902918663..ab93b5ce952 100644 --- a/intern/opensubdiv/internal/opensubdiv_converter_factory.cc +++ b/intern/opensubdiv/internal/opensubdiv_converter_factory.cc @@ -173,18 +173,27 @@ inline bool TopologyRefinerFactory<TopologyRefinerData>::assignComponentTags( setBaseVertexSharpness(refiner, vertex_index, Crease::SHARPNESS_INFINITE); continue; } + + // Get sharpness provided by the converter. + float sharpness = 0.0f; if (converter->getVertexSharpness != NULL) { - float sharpness = converter->getVertexSharpness(converter, vertex_index); - if (vertex_edges.size() == 2) { - const int edge0 = vertex_edges[0], edge1 = vertex_edges[1]; - const float sharpness0 = refiner._levels[0]->getEdgeSharpness(edge0); - const float sharpness1 = refiner._levels[0]->getEdgeSharpness(edge1); - // TODO(sergey): Find a better mixing between edge and vertex sharpness. - sharpness += min(sharpness0, sharpness1); - sharpness = min(sharpness, 10.0f); - } - setBaseVertexSharpness(refiner, vertex_index, sharpness); + sharpness = converter->getVertexSharpness(converter, vertex_index); } + + // If it's vertex where 2 non-manifold edges meet adjust vertex sharpness to + // the edges. + // This way having a plane with all 4 edges set to be sharp produces sharp + // corners in the subdivided result. + if (vertex_edges.size() == 2) { + const int edge0 = vertex_edges[0], edge1 = vertex_edges[1]; + const float sharpness0 = refiner._levels[0]->getEdgeSharpness(edge0); + const float sharpness1 = refiner._levels[0]->getEdgeSharpness(edge1); + // TODO(sergey): Find a better mixing between edge and vertex sharpness. + sharpness += min(sharpness0, sharpness1); + sharpness = min(sharpness, 10.0f); + } + + setBaseVertexSharpness(refiner, vertex_index, sharpness); } return true; } |