Upload docs/convex_decomposition_spec.md with huggingface_hub
Browse files
docs/convex_decomposition_spec.md
CHANGED
|
@@ -137,6 +137,151 @@ python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
|
| 137 |
|
| 138 |
After generation, inspect `logs/parts_summary.csv` to decide whether the resulting part sizes are acceptable for the target task.
|
| 139 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
### `metadata.yaml`
|
| 141 |
|
| 142 |
Minimum fields:
|
|
|
|
| 137 |
|
| 138 |
After generation, inspect `logs/parts_summary.csv` to decide whether the resulting part sizes are acceptable for the target task.
|
| 139 |
|
| 140 |
+
## Full script usage
|
| 141 |
+
|
| 142 |
+
Print the current CLI help:
|
| 143 |
+
|
| 144 |
+
```bash
|
| 145 |
+
python scripts/run_convex_decomposition.py --help
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
General form:
|
| 149 |
+
|
| 150 |
+
```bash
|
| 151 |
+
python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
| 152 |
+
--mesh <mesh_path_relative_to_raw_asset_dir> \
|
| 153 |
+
--variant <variant_name> \
|
| 154 |
+
[CoACD options] \
|
| 155 |
+
[MJCF options] \
|
| 156 |
+
[repository options]
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
### Required argument
|
| 160 |
+
|
| 161 |
+
| Argument | Meaning |
|
| 162 |
+
| --- | --- |
|
| 163 |
+
| `raw_asset_dir` | Raw asset directory under `assets/<source>/raw/<asset_type>/<category>/<asset_id>/`. |
|
| 164 |
+
|
| 165 |
+
### Input selection
|
| 166 |
+
|
| 167 |
+
| Option | Default | Meaning |
|
| 168 |
+
| --- | --- | --- |
|
| 169 |
+
| `--mesh <path>` | none | Mesh to decompose. Path can be relative to `raw_asset_dir` or absolute. Repeat this option for multiple meshes. |
|
| 170 |
+
| `--mesh-glob <glob>` | `visuals/*.obj`, `visuals/*.stl`, `meshes/*.obj`, `meshes/*.stl` | Glob used when `--mesh` is omitted. Repeatable. |
|
| 171 |
+
|
| 172 |
+
Example:
|
| 173 |
+
|
| 174 |
+
```bash
|
| 175 |
+
python scripts/run_convex_decomposition.py \
|
| 176 |
+
assets/robocasa/raw/fixtures/dishwashers/Dishwasher031 \
|
| 177 |
+
--mesh visuals/door.obj \
|
| 178 |
+
--mesh visuals/rack0.obj \
|
| 179 |
+
--mesh visuals/rack1.obj
|
| 180 |
+
```
|
| 181 |
+
|
| 182 |
+
### Repository/output options
|
| 183 |
+
|
| 184 |
+
| Option | Default | Meaning |
|
| 185 |
+
| --- | --- | --- |
|
| 186 |
+
| `--variant <name>` | `coacd_v1` | Output suffix. The derived asset directory becomes `<source_asset_id>_<variant>`. |
|
| 187 |
+
| `--overwrite` | false | Allow writing into an existing derived output directory. Use cautiously. |
|
| 188 |
+
| `--register-manifest` | false | Append the generated derived asset to `manifest/assets.jsonl`. Use only for outputs you intend to keep. |
|
| 189 |
+
|
| 190 |
+
Output path:
|
| 191 |
+
|
| 192 |
+
```text
|
| 193 |
+
assets/<source>/derived/convex_decompositions/<category>/<source_asset_id>_<variant>/
|
| 194 |
+
```
|
| 195 |
+
|
| 196 |
+
### MJCF options
|
| 197 |
+
|
| 198 |
+
| Option | Default | Meaning |
|
| 199 |
+
| --- | --- | --- |
|
| 200 |
+
| `--class-name <name>` | `convex_collision` | `class` attribute for generated `<geom>` entries. Empty string disables it. |
|
| 201 |
+
| `--rgba "r g b a"` | `0.8 0.2 0.2 0.35` | RGBA for generated collision geoms. |
|
| 202 |
+
| `--group <int>` | `0` | MuJoCo geom group. Empty string disables it. |
|
| 203 |
+
| `--contype <int>` | empty | MuJoCo contact type. Empty means use MuJoCo default. |
|
| 204 |
+
| `--conaffinity <int>` | empty | MuJoCo contact affinity. Empty means use MuJoCo default. |
|
| 205 |
+
|
| 206 |
+
Generated MJCF files:
|
| 207 |
+
|
| 208 |
+
```text
|
| 209 |
+
mjcf/convex_assets_include.xml # include at MJCF root/top level
|
| 210 |
+
mjcf/convex_geoms_include.xml # include inside the target body
|
| 211 |
+
mjcf/convex_collision_include.xml # standalone wrapper for preview/convenience
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
### CoACD granularity and quality options
|
| 215 |
+
|
| 216 |
+
| Option | Default | Effect |
|
| 217 |
+
| --- | --- | --- |
|
| 218 |
+
| `--threshold <float>` | `0.05` | Main concavity threshold. Lower values usually create more/smaller and more accurate parts. Higher values create fewer/coarser parts. |
|
| 219 |
+
| `--max-convex-hull <int>` | `-1` | Maximum hull count. `-1` means CoACD default/unlimited. Lower cap forces fewer/larger parts. |
|
| 220 |
+
| `--no-merge` | false | Disable CoACD hull merge. Usually preserves more/smaller parts. Useful for wire/rack-like geometry, but may create many parts. |
|
| 221 |
+
| `--mcts-max-depth <int>` | `3` | Maximum recursive split depth. Higher values can produce finer decomposition and longer runtime. |
|
| 222 |
+
| `--mcts-nodes <int>` | `20` | Search nodes per MCTS step. Higher values can improve split search and increase runtime. |
|
| 223 |
+
| `--mcts-iterations <int>` | `150` | MCTS iterations. Higher values can improve split quality and increase runtime. |
|
| 224 |
+
| `--resolution <int>` | `2000` | CoACD sampling/resolution parameter. Higher values preserve more detail and cost more time. |
|
| 225 |
+
| `--preprocess-mode {auto,on,off}` | `auto` | Whether CoACD preprocesses the input mesh. |
|
| 226 |
+
| `--preprocess-resolution <int>` | `50` | Resolution for preprocessing. Higher values may preserve more detail and cost more time. |
|
| 227 |
+
| `--max-ch-vertex <int>` | `256` | Maximum vertices per convex hull. Controls hull complexity, not physical part size directly. |
|
| 228 |
+
| `--pca` | false | Enable CoACD PCA mode. Can affect orientation/splitting behavior. |
|
| 229 |
+
| `--decimate` | false | Enable CoACD decimation. May simplify output. |
|
| 230 |
+
| `--extrude` | false | Enable CoACD extrusion. |
|
| 231 |
+
| `--extrude-margin <float>` | `0.01` | Margin used when extrusion is enabled. |
|
| 232 |
+
| `--apx-mode {ch,box}` | `ch` | Approximation mode: convex hull or box approximation. |
|
| 233 |
+
| `--real-metric` | false | Enable CoACD `real_metric` option if supported. |
|
| 234 |
+
| `--seed <int>` | `0` | Random seed for reproducible runs where CoACD supports it. |
|
| 235 |
+
|
| 236 |
+
### Practical parameter presets
|
| 237 |
+
|
| 238 |
+
Block-like assets such as doors, panels, and shells:
|
| 239 |
+
|
| 240 |
+
```bash
|
| 241 |
+
python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
| 242 |
+
--mesh visuals/door.obj \
|
| 243 |
+
--variant coacd_v1 \
|
| 244 |
+
--threshold 0.05 \
|
| 245 |
+
--max-convex-hull 16
|
| 246 |
+
```
|
| 247 |
+
|
| 248 |
+
Coarser and faster collision:
|
| 249 |
+
|
| 250 |
+
```bash
|
| 251 |
+
python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
| 252 |
+
--mesh <mesh.obj> \
|
| 253 |
+
--variant coacd_coarse_v1 \
|
| 254 |
+
--threshold 0.08 \
|
| 255 |
+
--max-convex-hull 8
|
| 256 |
+
```
|
| 257 |
+
|
| 258 |
+
Finer collision:
|
| 259 |
+
|
| 260 |
+
```bash
|
| 261 |
+
python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
| 262 |
+
--mesh <mesh.obj> \
|
| 263 |
+
--variant coacd_fine_v1 \
|
| 264 |
+
--threshold 0.02 \
|
| 265 |
+
--max-convex-hull 32 \
|
| 266 |
+
--no-merge \
|
| 267 |
+
--mcts-max-depth 4
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
Rack/wire-like assets such as dishwasher racks:
|
| 271 |
+
|
| 272 |
+
```bash
|
| 273 |
+
python scripts/run_convex_decomposition.py <raw_asset_dir> \
|
| 274 |
+
--mesh visuals/rack1.obj \
|
| 275 |
+
--variant rack1_coacd_trial \
|
| 276 |
+
--threshold 0.02 \
|
| 277 |
+
--max-convex-hull 128 \
|
| 278 |
+
--no-merge \
|
| 279 |
+
--resolution 2000 \
|
| 280 |
+
--mcts-max-depth 4
|
| 281 |
+
```
|
| 282 |
+
|
| 283 |
+
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.
|
| 284 |
+
|
| 285 |
### `metadata.yaml`
|
| 286 |
|
| 287 |
Minimum fields:
|