Skip to content

rordenlab/glb-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

glb-loader

The glb-loader is a NiiVue plugin that converts glTF (Graphics Library Transmission Format) binary files (.glb) files into mz3 meshes. While glTF enables compact, fast-transferring files, it remains uncommon in neuroimaging. Additionally, supporting glTF introduces dependencies. Specifically, here we use the glTF Transform library installed as a npm package. By offering glTF support as an optional plugin, NiiVue stays lightweight while providing compatibility when needed.

Example glTF mesh of Isopropylamine doi.org/10.60705/3dpx/8721.2

Local Development

To illustrate this library, glb2mz3 is a node.js converter that can be run from the command line:

git clone [email protected]:rordenlab/glb-loader.git
cd glb-loader
npm install
node ./src/glb2mz3.js ./tests/testData/mesh.glb

Local Browser Development

You can also embed this loader into a hot-reloadable NiiVue web page to evaluate integration:

git clone [email protected]:rordenlab/glb-loader.git
cd glb-loader
npm install
npm run dev

Sample datasets

  • NIH 3D provides thousands of GLB meshes. Note the sample meshes included in this repository are from here.

Draco compression

This library also supports glTF .glb files optimized with Draco mesh compression. Note that the vertex reording may disrupt mesh overlays (e.g. statistical maps, gray matter thickness, curvature) and decimation properties. While this dramatically reduces file size, be warned that these compressed not compatible with all glTF viewers. For these reasons, most glTF files (including sample data from NIH 3D) are not compressed this way. You can compress glTF meshes to use Draco from the command line:

npm install --global @gltf-transform/cli
gltf-transform optimize water-bas-color-print_NIH3D.glb water.glb --compress draco --texture-compress webp

About

GLTF glb loader plugin for NiiVue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published