Skip to content

Utility for creating volumetric mesh container files in glTF format.

License

Notifications You must be signed in to change notification settings

cansik/volumesh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Volumesh

Utility for creating volumetric mesh container files in glTF format.

Hypergrid

Hypergrid example (hypergrid.glb) (Source: Justin Jensen)

Installation

pip install volumesh

Draco Compression

To install the Google Draco compression, the DracoPy library is required. As it is still under development, we only include it when the extra draco is specified.

pip install "volumesh[draco]"

Usage

To convert a sequence of OBJ files into a volumesh container use the following command:

volumesh ./data test.glb

First specify the folder where the OBJs are located (data) and then the output file (test.glb). Use the --compressed flag if you have draco extras installed and want to compress the container. The following information is stored in the mesh, if available::

  • vertices
  • triangle indices
  • normals
  • vertex-uvs
  • textures (png / jpeg)

Limitations

When Draco compression is enabled, only vertex and triangle information is stored in the mesh. This is due to the fact that DracoPy only supports these two primitives. At the moment we recommend not to use the internal compression, but to convert the sequence to a glb file and convert it later with the gltf-pipeline. This gives a much better compression and still contains all the information:

gltf-pipeline -i .\sequence.glb -o .\sequence-draco.glb -d

Animation

To use the GLTF animation system to render the meshes in a sequence, it is possible to specify the frame rate (default 24) and set the animation flag. Volumesh will add an animation track that will fade the objects in and out using the GLTF animation tools.

volumesh ./human test.glb --animate --fps 24

Help

usage: volumesh [-h] [--compressed] [--jpeg-textures]
                [--jpeg-quality JPEG_QUALITY] [--animate] [--fps FPS]
                [-tex TEXTURE_SIZE] [--load-safe]
                input output

A utility to create volumesh files.

positional arguments:
  input                 Path to the mesh (*.obj) files (directory).
  output                GLTF output file (.glb).

options:
  -h, --help            show this help message and exit
  --compressed          Compress the mesh data with Draco compression.
  --jpeg-textures       Use JPEG compression for textures instead of PNG.
  --jpeg-quality JPEG_QUALITY
                        JPEG quality parameter.
  --animate             Animate mesh frames with GLTF animation system.
  --fps FPS             Animation frames per second (fps).
  -tex TEXTURE_SIZE, --texture-size TEXTURE_SIZE
                        Limit texture size to the specified width.
  --load-safe           Load meshes slow but save.

About

Copyright (c) 2024 Florian Bruggisser