41 releases (6 stable)

1.4.1 May 10, 2024
1.4.0 Dec 17, 2023
1.3.0 Aug 21, 2023
1.2.0 Jun 8, 2023
0.2.1 Nov 17, 2016

#1 in Data formats

Download history 24151/week @ 2024-07-27 19691/week @ 2024-08-03 29529/week @ 2024-08-10 21702/week @ 2024-08-17 26230/week @ 2024-08-24 24304/week @ 2024-08-31 22246/week @ 2024-09-07 20761/week @ 2024-09-14 25933/week @ 2024-09-21 24872/week @ 2024-09-28 23723/week @ 2024-10-05 22615/week @ 2024-10-12 19127/week @ 2024-10-19 19326/week @ 2024-10-26 21495/week @ 2024-11-02 15553/week @ 2024-11-09

78,397 downloads per month
Used in 262 crates (79 directly)

MIT/Apache

415KB
9K SLoC

gltf

crates.io docs.rs


This crate is intended to load glTF 2.0, a file format designed for the efficient transmission of 3D assets.

rustc version 1.61 or above is required.

Reference infographic

infographic

From javagl/gltfOverview

PDF version

Usage

See the crate documentation for example usage.

Features

Extras and names

By default, gltf ignores all extras and names included with glTF assets. You can negate this by enabling the extras and names features, respectively.

[dependencies.gltf]
version = "1.4"
features = ["extras", "names"]

glTF extensions

The following glTF extensions are supported by the crate:

  • KHR_lights_punctual
  • KHR_materials_pbrSpecularGlossiness
  • KHR_materials_unlit
  • KHR_texture_transform
  • KHR_materials_variants
  • KHR_materials_volume
  • KHR_materials_specular
  • KHR_materials_transmission
  • KHR_materials_ior
  • KHR_materials_emissive_strength

To use an extension, list its name in the features section.

[dependencies.gltf]
features = ["KHR_materials_unlit"]

Examples

gltf-display

Demonstrates how the glTF JSON is deserialized.

cargo run --example gltf-display path/to/asset.gltf

gltf-export

Demonstrates how glTF JSON can be built and exported using the gltf-json crate.

cargo run --example gltf-export

gltf-roundtrip

Deserializes and serializes the JSON part of a glTF asset.

cargo run --example gltf-roundtrip path/to/asset.gltf

gltf-tree

Visualises the scene heirarchy of a glTF asset, which is a strict tree of nodes.

cargo run --example gltf-tree path/to/asset.gltf

Tests

Running tests locally requires to clone the glTF-Sample-Models repository first.

git clone https://github.com/KhronosGroup/glTF-Sample-Models.git

Dependencies

~0.8–2.3MB
~48K SLoC