--- name: asset-scale description: Scale 3D assets including meshes (OBJ, GLB, collision), Gaussian splats, and URDF metadata. Maintains directory structure and processes all related files atomically. Use when resizing assets for simulation compatibility, real-world scale adjustment, or batch asset processing. --- # Asset Scaling ## Overview Scale 3D assets from URDF files, automatically processing all related mesh formats (OBJ, GLB, collision meshes) and Gaussian splatting models. The tool maintains the original directory structure and updates URDF metadata (min_height, max_height, real_height) consistently. **When to use**: Use this skill when you need to resize 3D assets for different environments, adjust real-world scale, or prepare assets for simulation with specific size requirements. --- ## Core Convention: Input/Output Structure The skill expects URDF files at `/result/.urdf` and outputs to `//` maintaining the same structure. | Mode | Input URDF Path | Output Structure | |------|-----------------|------------------| | **Normal** | `path/to/asset/result/asset.urdf` | `/asset/result/asset.urdf` | | **Inplace** | `path/to/asset/result/asset.urdf` | `path/to/asset/result/asset.urdf` (modified) | **Key behaviors**: - **Normal mode**: Entire asset directory is copied to output location before scaling - **Inplace mode**: Files are modified directly without copying - All mesh files (OBJ, GLB, collision, Gaussian splat) are scaled consistently - URDF metadata heights are scaled to match new dimensions --- ## CLI Examples ### Example 1: Scale Asset to Output Directory Scale a red box asset to 80% of its original size and save to a new location. ```bash python -m embodied_gen.skills.asset-scale.asset_scale \ --urdf-path outputs/assets/red_box/result/red_box.urdf \ --scale-factor 0.8 \ --output-dir outputs/scaled ``` **Output**: `outputs/scaled/red_box/result/red_box.urdf` --- ### Example 2: Scale Asset Inplace Modify the asset files directly without creating a copy (useful for batch processing). ```bash python -m embodied_gen.skills.asset-scale.asset_scale \ --urdf-path outputs/assets/red_box/result/red_box.urdf \ --scale-factor 0.8 \ --inplace ``` **Output**: `outputs/assets/red_box/result/red_box.urdf` (modified inplace) **Warning**: Inplace mode modifies the original files. Make sure to backup important assets before using this mode. --- ## What Gets Scaled | File Type | Scaling Method | Location | |-----------|---------------|----------| | **OBJ Mesh** | Vertex coordinates multiplied by scale factor | `mesh/.obj` | | **GLB Mesh** | All geometry vertices scaled | `mesh/.glb` | | **Collision Mesh** | Multi-object OBJ parsed and scaled | `mesh/_collision.obj` | | **Gaussian Splat** | Position and scale parameters updated | `mesh/_gs.ply` | | **URDF Metadata** | `min_height`, `max_height`, `real_height` scaled | `.urdf` | **Note**: Material files (textures, MTL) are copied unchanged in normal mode. --- ## Common Parameters | Parameter | Type | Default | Meaning | |-----------|------|---------|---------| | `urdf_path` | `str \| Path` | Required | Path to input URDF file | | `scale_factor` | `float` | Required | Scaling multiplier (must be positive). E.g., 0.8 = 80%, 1.5 = 150% | | `inplace` | `bool` | `False` | If True, modify files inplace. `output_dir` is not required | | `output_dir` | `str \| Path \| None` | `None` | Root output directory. Required when `inplace=False`, ignored when `inplace=True` | --- ## Next Steps - For complete API details and internal methods, see the source code at `embodied_gen/skills/asset-scale/asset_scale.py`