Skip to content

Commit

Permalink
sdf2usd: set cylinder refinement parameter (#34)
Browse files Browse the repository at this point in the history
The refinement parameter is 0 by default when loaded in
Isaac Sim, which makes cylinders look like extruded
polygons. Setting the refinement parameter to 1 makes
them rounder.

Signed-off-by: Steve Peters <scpeters@openrobotics.org>
(cherry picked from commit 0b699a6)
  • Loading branch information
scpeters authored and mergify[bot] committed Oct 3, 2024
1 parent 71f2ebf commit 03c1c74
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sdf_parser/Geometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ namespace usd
extentBounds.push_back(endPoint);
usdCylinder.CreateExtentAttr().Set(extentBounds);

// Set refinement level for cylinders so that the visual shapes will look
// rounder. It should be ignored for collision shapes.
auto enableRefinementAttr =
usdCylinder.GetPrim().CreateAttribute(
pxr::TfToken("refinementEnableOverride"),
pxr::SdfValueTypeNames->Bool, false);
enableRefinementAttr.Set(true);
auto refinementAttr =
usdCylinder.GetPrim().CreateAttribute(
pxr::TfToken("refinementLevel"),
pxr::SdfValueTypeNames->Int, false);
refinementAttr.Set(1);

return errors;
}

Expand Down

0 comments on commit 03c1c74

Please sign in to comment.