https://github.com/gltf-rs/gltf
A crate for loading glTF 2.0
https://github.com/gltf-rs/gltf
3d gltf opengl pbr
Last synced: 13 days ago
JSON representation
A crate for loading glTF 2.0
- Host: GitHub
- URL: https://github.com/gltf-rs/gltf
- Owner: gltf-rs
- License: apache-2.0
- Created: 2016-11-13T09:55:26.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2025-01-20T12:11:34.000Z (3 months ago)
- Last Synced: 2025-04-03T09:32:39.912Z (20 days ago)
- Topics: 3d, gltf, opengl, pbr
- Language: Rust
- Homepage:
- Size: 1.12 MB
- Stars: 565
- Watchers: 16
- Forks: 133
- Open Issues: 73
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
gltf
---
This crate is intended to load [glTF 2.0](https://www.khronos.org/gltf), a file format designed for the efficient transmission of 3D assets.
`rustc` version 1.61 or above is required.
### Reference infographic

From javagl/gltfOverview
### Usage
See the [crate documentation](https://docs.rs/gltf) 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.
```toml
[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 `
- `EXT_texture_webp`To use an extension, list its name in the `features` section.
```toml
[dependencies.gltf]
features = ["KHR_materials_unlit"]
```### Examples
#### gltf-display
Demonstrates how the glTF JSON is deserialized.
```sh
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.
```sh
cargo run --example gltf-export
```#### gltf-roundtrip
Deserializes and serializes the JSON part of a glTF asset.
```sh
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.
```sh
cargo run --example gltf-tree path/to/asset.gltf
```### Tests
Running tests locally requires to clone the [`glTF-Sample-Models`](https://github.com/KhronosGroup/glTF-Sample-Models) repository first.
```sh
git clone https://github.com/KhronosGroup/glTF-Sample-Models.git
```