Skip to documentation
DocumentationAll documentsEnglish

GLTF-G(1)

NAME

gltf-g - convert a glTF model to a BRL-CAD database

On this page

SYNOPSIS

gltf-g [-h] [-v] [-E] [-o _output_file.g_] _input_file_ [_output_file.g_]

DESCRIPTION

gltf-g converts a glTF (GL Transmission Format) model into a BRL-CAD geometry database. Each glTF mesh is read and written as a Bag of Triangles (BoT) primitive in the output .g file. A BoT whose trimesh is found to be a closed, manifold solid is stored as a solid BoT; otherwise it is stored as a surface BoT.

The input format is selected from the input_file extension: a file ending in .glb is read as binary glTF, while any other extension (such as .gltf) is read as ASCII glTF. Triangle index data may be stored as signed or unsigned 16- or 32-bit integers, and vertex positions may be single- or double-precision floating point; other component types are skipped with a warning.

The output database may be named either positionally as the second argument or with the -o option, but not both.

OPTIONS

-h, --help

Print a usage message and exit. The -? flag is accepted as a synonym.

-v, --verbosity

Increase the verbosity level. May be given more than once; a single -v reports per-mesh vertex and face counts and any parse warnings, while repeating it additionally dumps the individual vertex and face data.

-o output_file.g, --output output_file.g

Set the name of the output BRL-CAD database. Mutually exclusive with giving the output file as a positional argument.

-E, --extensions

Preserve the original JSON for glTF extras and extensions while parsing.

EXAMPLES

Example 1. Convert a binary glTF model and inspect the result
gltf-g -v model.glb model.g
mged model.g tops

Imports the binary glTF file model.glb into model.g, printing the mesh, vertex, and face counts as it works, then lists the top-level BoT objects of the new database with mged(1).

Example 2. Convert an ASCII glTF model using the output flag
gltf-g -E -o scene.g scene.gltf

Reads the ASCII glTF file scene.gltf, retaining the original JSON for any extras and extensions, and writes the geometry to scene.g.

SEE ALSO

brlcad(1), mged(1), obj-g(1), stl-g(1), g-obj(1)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org