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.disable-shrink-wrap] [--vhacd-args.fill-mode {FLOOD,SURFACE,RAYCAST}] [--vhacd-args.max-hull-vert-count INT]
                [--vhacd-args.disable-async] [--vhacd-args.min-edge-length INT] [--vhacd-args.split-hull]

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

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

optional vhacd args arguments:
  arguments to pass to V-HACD

  --vhacd-args.max-output-convex-hulls INT
                        maximum number of output convex hulls (default: 64)
  --vhacd-args.voxel-resolution INT
                        total number of voxels to use (default: 400000)
  --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: 14)
  --vhacd-args.disable-shrink-wrap
                        do not shrink wrap 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.disable-async
                        do not run asynchronously
  --vhacd-args.min-edge-length INT
                        minimum size of a voxel edge (default: 2)
  --vhacd-args.split-hull
                        try 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.7.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

obj2mjcf-0.0.7-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: obj2mjcf-0.0.7.tar.gz
  • Upload date:
  • Size: 8.0 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.7.tar.gz
Algorithm Hash digest
SHA256 795ce8759077544bbe948bb930af9c40e2ea0a07cfbbc2a6df890068724dcd15
MD5 d19fd89579678224b679ce847f007b75
BLAKE2b-256 07406d50bb1c5bf7bdd297fa2592e33c0a3c2f7c095052007591a729fbde3c52

See more details on using hashes here.

File details

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

File metadata

  • Download URL: obj2mjcf-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 8.2 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3fe17ae1feb55b3dcc6504855f3b2b50694d62d0ff523d57bf283476adcad4de
MD5 cf34da2ad1b3d35767527b47a3386925
BLAKE2b-256 6788c16e2f4b91f095d6e36794452cc9e0c31af1efceb62d793c4c7b8764043d

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