| # Convex Decomposition Storage Specification |
|
|
| Convex decomposition outputs are derived assets. They must not overwrite raw meshes or upstream XML files. |
|
|
| ## Path layout |
|
|
| Store convex decomposition results under: |
|
|
| ```text |
| assets/<source>/derived/convex_decompositions/<category>/<asset_id>/ |
| ``` |
|
|
| Example for a RoboCasa dishwasher: |
|
|
| ```text |
| assets/robocasa/derived/convex_decompositions/dishwashers/Dishwasher031_vhacd_v1/ |
| ├── metadata.yaml |
| ├── source_refs.yaml |
| ├── meshes/ |
| │ ├── door/ |
| │ │ ├── part_000.obj |
| │ │ ├── part_001.obj |
| │ │ └── ... |
| │ ├── rack0/ |
| │ └── rack1/ |
| ├── mjcf/ |
| │ ├── convex_assets_include.xml |
| │ ├── convex_geoms_include.xml |
| │ └── convex_collision_include.xml |
| └── logs/ |
| └── decomposition.json |
| ``` |
|
|
| Example for a DISCOVERSE object: |
|
|
| ```text |
| assets/discoverse/derived/convex_decompositions/objects/cup_vhacd_v1/ |
| ├── metadata.yaml |
| ├── source_refs.yaml |
| ├── meshes/ |
| │ └── cup/ |
| │ ├── part_000.obj |
| │ └── part_001.obj |
| ├── mjcf/ |
| │ ├── convex_assets_include.xml |
| │ ├── convex_geoms_include.xml |
| │ └── convex_collision_include.xml |
| └── logs/ |
| └── decomposition.json |
| ``` |
|
|
| ## Required files |
|
|
| ### Scaffold command |
|
|
| Use the helper script to create the derived asset skeleton: |
|
|
| ```bash |
| python scripts/scaffold_convex_decomposition.py assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 |
| ``` |
|
|
| This creates a new directory under `assets/robocasa/derived/convex_decompositions/...` with placeholder metadata, source references, logs, and MJCF include files. Fill in the generated meshes and replace placeholders before adding the asset to `manifest/assets.jsonl`. |
|
|
| ### Run CoACD decomposition |
|
|
| Use `scripts/run_convex_decomposition.py` when you want to actually generate convex parts and MuJoCo include files: |
|
|
| ```bash |
| pip install trimesh coacd |
| |
| python scripts/run_convex_decomposition.py \ |
| assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 \ |
| --mesh visuals/door.obj \ |
| --mesh visuals/rack0.obj \ |
| --variant coacd_v1 \ |
| --register-manifest |
| ``` |
|
|
| If `--mesh` is omitted, the script searches common mesh locations under the raw asset directory: |
|
|
| ```text |
| visuals/*.obj |
| visuals/*.stl |
| meshes/*.obj |
| meshes/*.stl |
| ``` |
|
|
| The script writes generated pieces to `meshes/<mesh_name>/part_000.obj`, records hashes and parameters in `logs/decomposition.json`, and creates MJCF include files under `mjcf/`. |
|
|
| For each generated convex part, the script also records size and complexity statistics in both `logs/decomposition.json` and `logs/parts_summary.csv`: |
|
|
| ```text |
| bbox_extents # x/y/z axis-aligned bounding-box dimensions |
| bbox_center # axis-aligned bounding-box center |
| bbox_volume |
| mesh_volume |
| surface_area |
| num_vertices |
| num_faces |
| ``` |
|
|
| Use `logs/parts_summary.csv` to find parts that are too small, too large, or unexpectedly complex before using them as collision geometry. |
|
|
| ### Decomposition granularity controls |
|
|
| CoACD does not directly support a target physical bbox size such as "each part should be about 5 cm". Part size is controlled indirectly through decomposition granularity parameters: |
|
|
| ```text |
| --threshold Lower value -> stricter convex approximation -> usually more/smaller parts. |
| --max-convex-hull Caps the number of convex hulls. Lower cap -> fewer/larger parts. |
| --no-merge Disables hull merge. Usually keeps more/smaller parts. |
| --mcts-max-depth Higher value allows deeper recursive splitting. |
| --mcts-nodes |
| --mcts-iterations More search can find finer/better splits, with higher runtime. |
| --preprocess-resolution |
| --resolution Higher values preserve more geometric detail before decomposition. |
| --max-ch-vertex Controls complexity of each convex hull, not physical size directly. |
| ``` |
|
|
| Practical presets: |
|
|
| ```bash |
| # Coarser collision: fewer/larger parts, faster simulation |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh <mesh.obj> \ |
| --threshold 0.08 \ |
| --max-convex-hull 8 |
| |
| # Finer collision: more/smaller parts, more accurate but heavier |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh <mesh.obj> \ |
| --threshold 0.02 \ |
| --max-convex-hull 32 \ |
| --no-merge \ |
| --mcts-max-depth 4 |
| ``` |
|
|
| After generation, inspect `logs/parts_summary.csv` to decide whether the resulting part sizes are acceptable for the target task. |
|
|
| ## Full script usage |
|
|
| Print the current CLI help: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py --help |
| ``` |
|
|
| General form: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh <mesh_path_relative_to_raw_asset_dir> \ |
| --variant <variant_name> \ |
| [CoACD options] \ |
| [MJCF options] \ |
| [repository options] |
| ``` |
|
|
| ### Required argument |
|
|
| | Argument | Meaning | |
| | --- | --- | |
| | `raw_asset_dir` | Raw asset directory under `assets/<source>/raw/<asset_type>/<category>/<asset_id>/`. | |
|
|
| ### Input selection |
|
|
| | Option | Default | Meaning | |
| | --- | --- | --- | |
| | `--mesh <path>` | none | Mesh to decompose. Path can be relative to `raw_asset_dir` or absolute. Repeat this option for multiple meshes. | |
| | `--mesh-glob <glob>` | `visuals/*.obj`, `visuals/*.stl`, `meshes/*.obj`, `meshes/*.stl` | Glob used when `--mesh` is omitted. Repeatable. | |
|
|
| Example: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py \ |
| assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 \ |
| --mesh visuals/door.obj \ |
| --mesh visuals/rack0.obj \ |
| --mesh visuals/rack1.obj |
| ``` |
|
|
| ### Repository/output options |
|
|
| | Option | Default | Meaning | |
| | --- | --- | --- | |
| | `--variant <name>` | `coacd_v1` | Output suffix. The derived asset directory becomes `<source_asset_id>_<variant>`. | |
| | `--overwrite` | false | Allow writing into an existing derived output directory. Use cautiously. | |
| | `--register-manifest` | false | Append the generated derived asset to `manifest/assets.jsonl`. Use only for outputs you intend to keep. | |
|
|
| Output path: |
|
|
| ```text |
| assets/<source>/derived/convex_decompositions/<category>/<source_asset_id>_<variant>/ |
| ``` |
|
|
| ### MJCF options |
|
|
| | Option | Default | Meaning | |
| | --- | --- | --- | |
| | `--class-name <name>` | `convex_collision` | `class` attribute for generated `<geom>` entries. Empty string disables it. | |
| | `--rgba "r g b a"` | `0.8 0.2 0.2 0.35` | RGBA for generated collision geoms. | |
| | `--group <int>` | `0` | MuJoCo geom group. Empty string disables it. | |
| | `--contype <int>` | empty | MuJoCo contact type. Empty means use MuJoCo default. | |
| | `--conaffinity <int>` | empty | MuJoCo contact affinity. Empty means use MuJoCo default. | |
|
|
| Generated MJCF files: |
|
|
| ```text |
| mjcf/convex_assets_include.xml # include at MJCF root/top level |
| mjcf/convex_geoms_include.xml # include inside the target body |
| mjcf/convex_collision_include.xml # standalone wrapper for preview/convenience |
| ``` |
|
|
| ### CoACD granularity and quality options |
|
|
| | Option | Default | Effect | |
| | --- | --- | --- | |
| | `--threshold <float>` | `0.05` | Main concavity threshold. Lower values usually create more/smaller and more accurate parts. Higher values create fewer/coarser parts. | |
| | `--max-convex-hull <int>` | `-1` | Maximum hull count. `-1` means CoACD default/unlimited. Lower cap forces fewer/larger parts. | |
| | `--no-merge` | false | Disable CoACD hull merge. Usually preserves more/smaller parts. Useful for wire/rack-like geometry, but may create many parts. | |
| | `--mcts-max-depth <int>` | `3` | Maximum recursive split depth. Higher values can produce finer decomposition and longer runtime. | |
| | `--mcts-nodes <int>` | `20` | Search nodes per MCTS step. Higher values can improve split search and increase runtime. | |
| | `--mcts-iterations <int>` | `150` | MCTS iterations. Higher values can improve split quality and increase runtime. | |
| | `--resolution <int>` | `2000` | CoACD sampling/resolution parameter. Higher values preserve more detail and cost more time. | |
| | `--preprocess-mode {auto,on,off}` | `auto` | Whether CoACD preprocesses the input mesh. | |
| | `--preprocess-resolution <int>` | `50` | Resolution for preprocessing. Higher values may preserve more detail and cost more time. | |
| | `--max-ch-vertex <int>` | `256` | Maximum vertices per convex hull. Controls hull complexity, not physical part size directly. | |
| | `--pca` | false | Enable CoACD PCA mode. Can affect orientation/splitting behavior. | |
| | `--decimate` | false | Enable CoACD decimation. May simplify output. | |
| | `--extrude` | false | Enable CoACD extrusion. | |
| | `--extrude-margin <float>` | `0.01` | Margin used when extrusion is enabled. | |
| | `--apx-mode {ch,box}` | `ch` | Approximation mode: convex hull or box approximation. | |
| | `--real-metric` | false | Enable CoACD `real_metric` option if supported. | |
| | `--seed <int>` | `0` | Random seed for reproducible runs where CoACD supports it. | |
|
|
| ### Practical parameter presets |
|
|
| Block-like assets such as doors, panels, and shells: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh visuals/door.obj \ |
| --variant coacd_v1 \ |
| --threshold 0.05 \ |
| --max-convex-hull 16 |
| ``` |
|
|
| Coarser and faster collision: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh <mesh.obj> \ |
| --variant coacd_coarse_v1 \ |
| --threshold 0.08 \ |
| --max-convex-hull 8 |
| ``` |
|
|
| Finer collision: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh <mesh.obj> \ |
| --variant coacd_fine_v1 \ |
| --threshold 0.02 \ |
| --max-convex-hull 32 \ |
| --no-merge \ |
| --mcts-max-depth 4 |
| ``` |
|
|
| Rack/wire-like assets such as dishwasher racks: |
|
|
| ```bash |
| python scripts/run_convex_decomposition.py <raw_asset_dir> \ |
| --mesh visuals/rack1.obj \ |
| --variant rack1_coacd_trial \ |
| --threshold 0.02 \ |
| --max-convex-hull 128 \ |
| --no-merge \ |
| --resolution 2000 \ |
| --mcts-max-depth 4 |
| ``` |
|
|
| For rack/wire-like assets, inspect `logs/parts_summary.csv` and visualize the result before registering it. A valid result should not have convex hulls that bridge functional slots or gaps. If the decomposition needs hundreds of parts, primitive collision using capsules/boxes is usually a better engineering choice. |
|
|
| ### `metadata.yaml` |
|
|
| Minimum fields: |
|
|
| ```yaml |
| asset_id: robocasa.convex_decompositions.dishwashers.Dishwasher031_vhacd_v1 |
| source: robocasa |
| asset_type: convex_decompositions |
| category: dishwashers |
| source_asset_id: Dishwasher031 |
| format: obj_mjcf_include |
| entry_file: mjcf/convex_collision_include.xml |
| license: CC-BY-4.0 |
| origin_url: https://robocasa.ai |
| path: assets/robocasa/derived/convex_decompositions/dishwashers/Dishwasher031_vhacd_v1 |
| storage_mode: derived |
| derived_from: |
| - assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 |
| derivation_method: convex_decomposition |
| decomposition_tool: vhacd |
| decomposition_version: TBD |
| decomposition_params_file: logs/decomposition.json |
| validation_status: pending |
| tags: |
| - robocasa |
| - convex_decomposition |
| - collision |
| - mujoco |
| ``` |
|
|
| ### `source_refs.yaml` |
| |
| Record exact source files: |
| |
| ```yaml |
| raw_asset: assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 |
| raw_entry_file: assets/robocasa/raw/fixtures/dishwashers/Dishwasher031/model.xml |
| raw_meshes: |
| - assets/robocasa/raw/fixtures/dishwashers/Dishwasher031/visuals/door.obj |
| - assets/robocasa/raw/fixtures/dishwashers/Dishwasher031/visuals/rack0.obj |
| ``` |
| |
| ### `logs/decomposition.json` |
| |
| Record tool parameters and hashes: |
| |
| ```json |
| { |
| "tool": "vhacd", |
| "tool_version": "TBD", |
| "created_at": "YYYY-MM-DD", |
| "params": {}, |
| "inputs": [ |
| { |
| "path": "assets/robocasa/raw/fixtures/dishwashers/Dishwasher031/visuals/door.obj", |
| "sha256": "TBD" |
| } |
| ], |
| "outputs": [ |
| { |
| "path": "meshes/door/part_000.obj", |
| "sha256": "TBD" |
| } |
| ] |
| } |
| ``` |
| |
| ## MJCF integration rule |
|
|
| Do not edit raw `model.xml` in place. If MuJoCo collision integration is needed, write a generated include file under: |
|
|
| ```text |
| mjcf/ |
| ``` |
|
|
| Generated MJCF should be split by include context: |
|
|
| ```text |
| mjcf/convex_assets_include.xml # include at MJCF root/top level |
| mjcf/convex_geoms_include.xml # include inside the target body |
| mjcf/convex_collision_include.xml # standalone wrapper for preview/convenience |
| ``` |
|
|
| Recommended integration pattern: |
|
|
| ```xml |
| <!-- top level --> |
| <include file="path/to/mjcf/convex_assets_include.xml"/> |
| |
| <!-- inside the object body that should receive collision geoms --> |
| <include file="path/to/mjcf/convex_geoms_include.xml"/> |
| ``` |
|
|
| This split avoids mixing root-level `<asset>` declarations with body-level `<geom>` declarations. `convex_collision_include.xml` is provided as a convenience wrapper body and should not be used when replacing collision geometry inside an existing body hierarchy. |
|
|
| ## Manifest rule |
|
|
| Convex decomposition results are real derived assets and must be indexed in: |
|
|
| ```text |
| manifest/assets.jsonl |
| ``` |
|
|
| Link-only plans or empty placeholders should not be listed in the manifest. |
|
|