Exports a scene (or a list of meshes) to the glTF 2.0 format, either as a
JSON document with an external binary buffer (.gltf + .bin)
or as a single self-contained binary file (.glb). The resulting
file can be viewed in any glTF-capable viewer (e.g. a browser using
three.js) and includes per-mesh placement transforms, vertex colors, and
optionally a camera.
Usage
write_gltf(meshes, path, camera = NULL, format = c("gltf", "glb"))Arguments
- meshes
Either a
scimesh_sceneobject (seescene()), a list of mesh descriptors, or a list of scene nodes — the same inputs accepted byrender_scene().- path
Output file path. For
format = "gltf"the binary buffer is written next to it as<stem>.bin.- camera
Optional camera list from
camera()orcamera_auto(). When provided, a glTF perspective camera node is included.- format
Output format:
"gltf"(default, JSON +.bin) or"glb"(single binary file).