habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Compositor "scripts" for the batch renderer

Open mosra opened this issue 2 years ago • 0 comments

Motivation and Context

For creating the ReplicaCAD, YCB and Fetch composite files I posted on Slack. Pushing as a PR so the code is available but with no intention to ever merge this.

How to use

All three executables create a glTF file as an output, with the meshes joined together and referenced via a placeholder MAGNUMX_mesh_views extension, a material for every such mesh view and an uncompressed 2D array KTX texture, because that's the fastest. You can also use *.glb instead of *.gltf for the output file, which makes it self-contained, but that makes any introspection / debugging or further texture operations from below rather painful to perform.

The KTX texture, if you don't want to use it directly, can then be further processed either with Basis (which will likely be annoyingly slow, memory-hungry and time-consuming):

# Pass -c <options> to tune the compression quality
magnum-imageconverter -D3 --in-place -C BasisKtxImageConverter <file>.0.ktx2

Or, for a faster turnaround times, a cheap & quick block-compressed DXT texture:

magnum-imageconverter -D3 --in-place -C StbDxtImageConverter -c highQuality <file>.0.ktx2

Eventually I'll add more compression alternatives, such as BC7 and ASTC.

Easiest is to take the magnum-imageconverter executable either from Homebrew on macOS or from the prebuilt Linux binaries: https://github.com/mosra/magnum-ci/actions/workflows/magnum-tools.yml

ReplicaCAD compositor

Expects a folder named ReplicaCAD_dataset_v1.5 in the path/to/datasets directory. I.e., it does not use the directory structure used by the dataset_download.py script to avoid accidental version mismatches.

./compositor-replicacad path/to/datasets path/to/composite-replica.gltf

YCB compositor

Expects a folder named hab_ycb_v1.2 in the path/to/datasets directory.

./compositor-ycb path/to/datasets path/to/composite-ycb.gltf

Fetch compositor

Expects a folder named hab_fetch_v1.0 in the path/to/datasets directory.

./compositor-fetch path/to/datasets path/to/composite-fetch.gltf

How Has This Been Tested

Works On My Machine™

mosra avatar Dec 16 '22 21:12 mosra