Subsurf: Better crease which represents sharp edges

Enabled infinite sharp patches for topology refiner and evaluator,
which allows to have sharp edge at first subdivision level.

Also tweaked crease export from Blender to OpenSubdiv to have more
artistic control over the whole 0..1 range.
This commit is contained in:
2018-08-02 12:22:55 +02:00
parent 3a93314753
commit 200212079d
2 changed files with 3 additions and 3 deletions

View File

@@ -713,7 +713,7 @@ OpenSubdiv_EvaluatorInternal* openSubdiv_createEvaluatorInternal(
if (is_adaptive) {
TopologyRefiner::AdaptiveOptions options(level);
options.considerFVarChannels = has_face_varying_data;
options.useInfSharpPatch = false;
options.useInfSharpPatch = true;
refiner->RefineAdaptive(options);
} else {
TopologyRefiner::UniformOptions options(level);
@@ -763,7 +763,7 @@ vector<const StencilTable*> all_face_varying_stencils;
// subsurf code.
PatchTableFactory::Options patch_options(level);
patch_options.SetEndCapType(PatchTableFactory::Options::ENDCAP_BSPLINE_BASIS);
patch_options.useInfSharpPatch = false;
patch_options.useInfSharpPatch = true;
patch_options.generateFVarTables = has_face_varying_data;
patch_options.generateFVarLegacyLinearPatches = false;
const PatchTable* patch_table = PatchTableFactory::Create(

View File

@@ -157,7 +157,7 @@ static float get_edge_sharpness(const OpenSubdiv_Converter *converter,
storage->manifold_edge_index_reverse[manifold_edge_index];
const MEdge *medge = storage->mesh->medge;
const float edge_crease = (float)medge[edge_index].crease / 255.0f;
return edge_crease * storage->settings.level * 10;
return edge_crease * edge_crease * 10.0f;
}