Import models from the industry-standard glTF model file format.
The xeokit SDK enables the import of 3D models from glTF (GL Transmission Format),
a widely used format for runtime asset delivery of 3D scenes and models.
glTF is a compact and efficient format designed for fast loading and rendering in applications and web browsers. It stores geometry, materials,
textures, animations, and scene hierarchy. Open and royalty-free, it has become the go-to format for 3D content distribution and exchange.
To import a glTF model into xeokit, use the loadGLTF function, which loads the file into
a SceneModel. The function also provides the option to load a basic
data model into a DataModel, to describe the hierarchy of the nodes in the glTF scene.
Installation
Install the xeokit SDK by running:
npminstall@xeokit/sdk
Usage
The following example demonstrates how to create a Viewer with a WebGLRenderer
and a Scene that holds model geometry and materials.
The example also creates a single View to render the model to a canvas element on the page,
and attaches a CameraControl to control the camera using mouse and touch input.
Within the Scene, a SceneModel is created to hold the model. Then, the loadGLTF function
is used to load a binary glTF (GLB) file into the SceneModel.
The SDKError class is used to handle any errors during this process.
xeokit glTF Importer
Import models from the industry-standard glTF model file format.
The xeokit SDK enables the import of 3D models from glTF (GL Transmission Format), a widely used format for runtime asset delivery of 3D scenes and models.
glTF is a compact and efficient format designed for fast loading and rendering in applications and web browsers. It stores geometry, materials, textures, animations, and scene hierarchy. Open and royalty-free, it has become the go-to format for 3D content distribution and exchange.
To import a glTF model into xeokit, use the loadGLTF function, which loads the file into a SceneModel. The function also provides the option to load a basic data model into a DataModel, to describe the hierarchy of the
nodes
in the glTFscene
.Installation
Install the xeokit SDK by running:
Usage
The following example demonstrates how to create a Viewer with a WebGLRenderer and a Scene that holds model geometry and materials.
The example also creates a single View to render the model to a canvas element on the page, and attaches a CameraControl to control the camera using mouse and touch input.
Within the Scene, a SceneModel is created to hold the model. Then, the loadGLTF function is used to load a binary glTF (GLB) file into the SceneModel.
The SDKError class is used to handle any errors during this process.