Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions apps/image_to_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
## ***EmbodiedGen***: Image-to-3D Asset
**🔖 Version**: {VERSION}
<p style="display: flex; gap: 10px; flex-wrap: nowrap;">
<a href="https://horizonrobotics.github.io/robot_lab/embodied_gen/index.html">
<img alt="🌐 Project Page" src="https://img.shields.io/badge/🌐-Project_Page-blue">
<a href="https://horizonrobotics.github.io/EmbodiedGen">
<img alt="📖 Documentation" src="https://img.shields.io/badge/📖-Documentation-blue">
</a>
<a href="https://arxiv.org/abs/2506.10600">
<img alt="📄 arXiv" src="https://img.shields.io/badge/📄-arXiv-b31b1b">
Expand Down
4 changes: 2 additions & 2 deletions apps/text_to_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
## ***EmbodiedGen***: Text-to-3D Asset
**🔖 Version**: {VERSION}
<p style="display: flex; gap: 10px; flex-wrap: nowrap;">
<a href="https://horizonrobotics.github.io/robot_lab/embodied_gen/index.html">
<img alt="🌐 Project Page" src="https://img.shields.io/badge/🌐-Project_Page-blue">
<a href="https://horizonrobotics.github.io/EmbodiedGen">
<img alt="📖 Documentation" src="https://img.shields.io/badge/📖-Documentation-blue">
</a>
<a href="https://arxiv.org/abs/2506.10600">
<img alt="📄 arXiv" src="https://img.shields.io/badge/📄-arXiv-b31b1b">
Expand Down
4 changes: 2 additions & 2 deletions apps/texture_edit.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def active_btn_by_content(mesh_content: gr.Model3D, text_content: gr.Textbox):
## ***EmbodiedGen***: Texture Generation
**🔖 Version**: {VERSION}
<p style="display: flex; gap: 10px; flex-wrap: nowrap;">
<a href="https://horizonrobotics.github.io/robot_lab/embodied_gen/index.html">
<img alt="🌐 Project Page" src="https://img.shields.io/badge/🌐-Project_Page-blue">
<a href="https://horizonrobotics.github.io/EmbodiedGen">
<img alt="📖 Documentation" src="https://img.shields.io/badge/📖-Documentation-blue">
</a>
<a href="https://arxiv.org/abs/2506.10600">
<img alt="📄 arXiv" src="https://img.shields.io/badge/📄-arXiv-b31b1b">
Expand Down
4 changes: 2 additions & 2 deletions apps/visualize_asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ def end_session(req: gr.Request) -> None:

**🔖 Version**: {VERSION}
<p style="display: flex; gap: 10px; flex-wrap: nowrap;">
<a href="https://horizonrobotics.github.io/robot_lab/embodied_gen/index.html">
<img alt="🌐 Project Page" src="https://img.shields.io/badge/🌐-Project_Page-blue">
<a href="https://horizonrobotics.github.io/EmbodiedGen">
<img alt="📖 Documentation" src="https://img.shields.io/badge/📖-Documentation-blue">
</a>
<a href="https://arxiv.org/abs/2506.10600">
<img alt="📄 arXiv" src="https://img.shields.io/badge/📄-arXiv-b31b1b">
Expand Down
69 changes: 41 additions & 28 deletions embodied_gen/data/asset_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,8 @@ class MeshtoUSDConverter(AssetConverterBase):

DEFAULT_BIND_APIS = [
"MaterialBindingAPI",
# "PhysicsMeshCollisionAPI",
"PhysxDecompositionCollisionAPI",
"PhysicsMeshCollisionAPI",
"PhysxConvexDecompositionCollisionAPI",
"PhysicsCollisionAPI",
"PhysxCollisionAPI",
"PhysicsMassAPI",
Expand All @@ -515,10 +515,10 @@ def __init__(
if simulation_app is not None:
self.simulation_app = simulation_app

if "exit_close" in kwargs:
self.exit_close = kwargs.pop("exit_close")
else:
self.exit_close = True
self.exit_close = kwargs.pop("exit_close", True)
self.physx_max_convex_hulls = kwargs.pop("physx_max_convex_hulls", 32)
self.physx_max_vertices = kwargs.pop("physx_max_vertices", 16)
self.physx_max_voxel_res = kwargs.pop("physx_max_voxel_res", 10000)

self.usd_parms = dict(
force_usd_conversion=force_usd_conversion,
Expand Down Expand Up @@ -548,12 +548,12 @@ def __enter__(self):
def __exit__(self, exc_type, exc_val, exc_tb):
"""Context manager exit, closes simulation app if created."""
# Close the simulation app if it was created here
if hasattr(self, "app_launcher") and self.exit_close:
self.simulation_app.close()

if exc_val is not None:
logger.error(f"Exception occurred: {exc_val}.")

if hasattr(self, "app_launcher") and self.exit_close:
self.simulation_app.close()

return False

def convert(self, urdf_path: str, output_file: str):
Expand Down Expand Up @@ -601,18 +601,25 @@ def convert(self, urdf_path: str, output_file: str):

# Add convex decomposition collision and set ShrinkWrap.
elif prim.GetName() == "mesh":
approx_attr = prim.GetAttribute("physics:approximation")
if not approx_attr:
approx_attr = prim.CreateAttribute(
"physics:approximation", Sdf.ValueTypeNames.Token
)
approx_attr = prim.CreateAttribute(
"physics:approximation", Sdf.ValueTypeNames.Token
)
approx_attr.Set("convexDecomposition")

physx_conv_api = (
PhysxSchema.PhysxConvexDecompositionCollisionAPI.Apply(
prim
)
)
physx_conv_api.GetMaxConvexHullsAttr().Set(
self.physx_max_convex_hulls
)
physx_conv_api.GetHullVertexLimitAttr().Set(
self.physx_max_vertices
)
physx_conv_api.GetVoxelResolutionAttr().Set(
self.physx_max_voxel_res
)
physx_conv_api.GetShrinkWrapAttr().Set(True)

api_schemas = prim.GetMetadata("apiSchemas")
Expand All @@ -639,8 +646,8 @@ class PhysicsUSDAdder(MeshtoUSDConverter):

DEFAULT_BIND_APIS = [
"MaterialBindingAPI",
# "PhysicsMeshCollisionAPI",
"PhysxDecompositionCollisionAPI",
"PhysicsMeshCollisionAPI",
"PhysxConvexDecompositionCollisionAPI",
"PhysicsCollisionAPI",
"PhysxCollisionAPI",
"PhysicsRigidBodyAPI",
Expand Down Expand Up @@ -675,18 +682,23 @@ def convert(self, usd_path: str, output_file: str = None):
if "lightfactory" in prim.GetName().lower():
continue

approx_attr = prim.GetAttribute(
"physics:approximation"
approx_attr = prim.CreateAttribute(
"physics:approximation", Sdf.ValueTypeNames.Token
)
if not approx_attr:
approx_attr = prim.CreateAttribute(
"physics:approximation",
Sdf.ValueTypeNames.Token,
)
approx_attr.Set("convexDecomposition")

physx_conv_api = PhysxSchema.PhysxConvexDecompositionCollisionAPI.Apply(
prim
)
physx_conv_api.GetMaxConvexHullsAttr().Set(
self.physx_max_convex_hulls
)
physx_conv_api.GetHullVertexLimitAttr().Set(
self.physx_max_vertices
)
physx_conv_api.GetVoxelResolutionAttr().Set(
self.physx_max_voxel_res
)
physx_conv_api.GetShrinkWrapAttr().Set(True)

rigid_body_api = UsdPhysics.RigidBodyAPI.Apply(prim)
Expand Down Expand Up @@ -790,18 +802,19 @@ def convert(self, urdf_path: str, output_file: str):
with Usd.EditContext(stage, layer):
for prim in stage.Traverse():
if prim.GetName() == "collisions":
approx_attr = prim.GetAttribute("physics:approximation")
if not approx_attr:
approx_attr = prim.CreateAttribute(
"physics:approximation", Sdf.ValueTypeNames.Token
)
approx_attr = prim.CreateAttribute(
"physics:approximation", Sdf.ValueTypeNames.Token
)
approx_attr.Set("convexDecomposition")

physx_conv_api = (
PhysxSchema.PhysxConvexDecompositionCollisionAPI.Apply(
prim
)
)
physx_conv_api.GetMaxConvexHullsAttr().Set(32)
physx_conv_api.GetHullVertexLimitAttr().Set(16)
physx_conv_api.GetVoxelResolutionAttr().Set(10000)
physx_conv_api.GetShrinkWrapAttr().Set(True)

api_schemas = prim.GetMetadata("apiSchemas")
Expand Down