Skip to main content

A tool for converting Wavefront OBJ files to multiple MuJoCo meshes grouped by material.

Project description

obj2mjcf

PyPI Python Version PyPI version

A tool for converting Wavefront OBJ files to multiple MuJoCo meshes grouped by material.

Currently, MuJoCo does not support OBJ files with groups or objects (i.e., o or g). Furthermore, only 1 material can be assigned per mesh. This tool is designed to split such OBJ files into sub-meshes grouped by material. The resulting sub-meshes can then be used as a drop-in replacement for the original OBJ file. The result is vastly enhanced visuals for your model:

Before After

Installation

The recommended way to install this package is via PyPI:

pip install obj2mjcf

If you additionally install V-HACD 4.0, this tool will create a convex decomposition of the mesh to use as the collision geometry.

Usage

usage: obj2mjcf [-h] --obj-dir STR [--use-vhacd] [--save-mtl] [--save-mjcf] [--verbose] [--vhacd-args.max-output-convex-hulls INT]
                [--vhacd-args.voxel-resolution INT] [--vhacd-args.volume-error-percent FLOAT] [--vhacd-args.max-recursion-depth INT]
                [--vhacd-args.no-shrink-wrap] [--vhacd-args.fill-mode {FLOOD,SURFACE,RAYCAST}] [--vhacd-args.max-hull-vert-count INT]
                [--vhacd-args.no-run-async] [--vhacd-args.min-edge-length INT] [--vhacd-args.split-hull]

obj2mjcf arguments.

required arguments:
  --obj-dir STR         Path to a directory containing obj files.

optional arguments:
  -h, --help            show this help message and exit
  --use-vhacd           Whether to create a convex decomposition for the collision geom.
  --save-mtl            Whether to save the mtl files.
  --save-mjcf           Whether to save an example MJCF file.
  --verbose             Whether to print verbose output.

optional vhacd args arguments:
  Arguments to pass to VHACD.

  --vhacd-args.max-output-convex-hulls INT
                        Maximum number of output convex hulls. (default: 32)
  --vhacd-args.voxel-resolution INT
                        Total number of voxels to use. (default: 100000)
  --vhacd-args.volume-error-percent FLOAT
                        Volume error allowed as a percentage. (default: 1.0)
  --vhacd-args.max-recursion-depth INT
                        Maximum recursion depth. (default: 12)
  --vhacd-args.no-shrink-wrap
                        Whether or not to shrinkwrap output to source mesh.
  --vhacd-args.fill-mode {FLOOD,SURFACE,RAYCAST}
                        Fill mode. (default: FLOOD)
  --vhacd-args.max-hull-vert-count INT
                        Maximum number of vertices in the output convex hull. (default: 64)
  --vhacd-args.no-run-async
                        Whether or not to run asynchronously.
  --vhacd-args.min-edge-length INT
                        Minimum size of a voxel edge. (default: 2)
  --vhacd-args.split-hull
                        If false, splits hulls in the middle. If true, tries to find optimal split plane
                        location.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obj2mjcf-0.0.6.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

obj2mjcf-0.0.6-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file obj2mjcf-0.0.6.tar.gz.

File metadata

  • Download URL: obj2mjcf-0.0.6.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for obj2mjcf-0.0.6.tar.gz
Algorithm Hash digest
SHA256 67421476642aee232f036701f995a2de873e8f9ad9d8f0bb32735ced12d08d87
MD5 c214da98ad1d088c6e692abcd13fabf5
BLAKE2b-256 410ae71db4fb6c00416e6c8a4a5da78503ba5948a82c7193c3d8255ee43b1190

See more details on using hashes here.

File details

Details for the file obj2mjcf-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: obj2mjcf-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for obj2mjcf-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 14deb724c040b2d91c05ab03b3d318e1d345a5b7e867bb820801c3be95ea8a7f
MD5 4e7927c40bc4f67416b3198684215440
BLAKE2b-256 b5eb08d0171207fcac93e6892a3cec77dc452d9b62af41dc9e8a5a646aa4e696

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page