From 51309cc37485803afb82c044ee42f47633ebb7df Mon Sep 17 00:00:00 2001 From: Steve Peters Date: Thu, 3 Oct 2024 01:23:56 -0700 Subject: [PATCH] sdf2usd: set cylinder refinement parameter (#34) 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 (cherry picked from commit 0b699a615ddf4201003b8fc32e96b9b83f97c225) --- src/sdf_parser/Geometry.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/sdf_parser/Geometry.cc b/src/sdf_parser/Geometry.cc index c8d3b8d..5164d13 100644 --- a/src/sdf_parser/Geometry.cc +++ b/src/sdf_parser/Geometry.cc @@ -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; }