Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

gltf-viewer status GitHub release Build Status Build status Docker build status Maintenance

Rust glTF 2.0 viewer, written using the gltf crate and plain OpenGL.

Current state: All official sample models can be loaded and are rendered with the reference PBR shader. Example:
Gallery with all sample models:

Some glTF features are not yet implemented, most notably animations. See #3 for details.


Binaries (Win/Linux/macOS)

See Latest Release

From crate (requires Rust)

cargo install gltf-viewer

Latest version (unstable):

cargo install --git


    gltf-viewer [OPTIONS] <FILE>

    -v, --verbose                    Enable verbose logging (log level INFO). Can be repeated up to 3 times to increase
                                     log level to DEBUG/TRACE)
    -s, --screenshot <FILE>          Create screenshot (PNG)
    -w, --width <WIDTH>              Width in pixels [default: 800]
    -h, --height <HEIGHT>            Height in pixels [default: 600]
    -c, --count <COUNT>              Saves N screenshots of size WxH, rotating evenly spaced around the object [default:
        --headless                   Use real headless rendering for screenshots (default is a hidden window)
                                     [EXPERIMENTAL - see README for details]
        --straight                   Position camera in front of model if using default camera (i.e. glTF doesn't
                                     contain a camera or `--cam-index -1` is passed).
        --scene <scene>              Index of the scene to load [default: 0]
        --cam-index <CAM-INDEX>      Use the glTF camera with the given index (starting at 0).
                                     Fallback if there is none: determine 'nice' camera position based on the scene's
                                     bounding box. Can be forced by passing -1.
                                     Note: All other camera options are ignored if this one is given. [default: 0]
        --cam-pos <CAM-POS>          Camera (aka eye) position override as comma-separated Vector3. Example: 1.2,3.4,5.6
        --cam-target <CAM-TARGET>    Camera target (aka center) override as comma-separated Vector3. Example:
        --cam-fovy <CAM-FOVY>        Vertical field of view ('zoom') in degrees. [default: 75]
        --help                       Prints help information
    -V, --version                    Prints version information

    <FILE>    glTF file name

Both .gltf and .glb files are supported. Navigate the scene with the mouse: Rotate with left click + drag, pan with right click + drag, zoom with mouse wheel.


$ curl -O
$ gltf-viewer Box.glb

Headless screenshot generation

Proper headless screenshot generation with the --headless flag currently only works on macOS. To work around that, a Docker setup that uses xvfb is provided. Usage examples:

# Build docker image and run it with the gltf mounted in a volume.
# The image will be saved next to the gltf file.
./ Box.glb
./ ../models/Box.gltf -w 1920 -h 1080 --count 3 -vv
# Use pre-built docker image from Docker Hub
DOCKER_IMAGE=bwasty/gltf-viewer ./ Box.glb

Alternatively, you can also install xvfb and use ./ directly (Linux only).