Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions lib/hydramoonray/Mesh.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,11 @@ Mesh::syncSubdivScheme(const HdMeshTopology& topology,
// - the refine level is < 1
// - the "forcePolgon" render setting is on, or
// - the subd scheme is "none"
bool disableSubd = _GetReprDesc(reprToken)[0].flatShadingEnabled ||
bool flatShading = _GetReprDesc(reprToken)[0].flatShadingEnabled;
bool forcePolygon = renderDelegate.getForcePolygon();
bool disableSubd = flatShading ||
refineLevel < 1 ||
renderDelegate.getForcePolygon() ||
forcePolygon ||
subdScheme == PxOsdOpenSubdivTokens->none;


Expand All @@ -235,9 +237,16 @@ Mesh::syncSubdivScheme(const HdMeshTopology& topology,
}

if (not isPrimvarUsed(smoothNormalToken)) {
// polygons should not autogenerate smooth normals, per UsdGeomMesh doc
if (disableSubd)
geometry()->set(rdlAttrSmoothNormal, false);
if (disableSubd) {
// Preserve the smooth appearance of Catmull-Clark meshes when
// refinement is zero. Explicit flat shading, forcePolygon, and
// non-subdivision meshes remain flat.
bool smoothNormal = !flatShading &&
!forcePolygon &&
subdScheme != PxOsdOpenSubdivTokens->none &&
rdlScheme == rdlSubdSchemeCatClark;
geometry()->set(rdlAttrSmoothNormal, smoothNormal);
}
}
}

Expand Down