Skip to content

GLTF

What is glTF?

glTF(GL Transmission Format) is a specification released by khronos that enables efficient transmission and loading of 3D scenes. It is the JPEG format of the 3D field. Its features cover traditional model formats such as FBX and OBJ, and it basically supports all the features in a 3D scene. Its plugin mechanism also allows users to flexibly customize and implement the desired functions. glTF is currently the preferred 3D scene transmission format recommended by Orillusion. Orillusion provides excellent support for the core features and plugins of glTF.

Loading glTF

Use engine.res.loadGltf to load a gltf model. This method optimizes the handling of gltf/glb files and allows for direct addition of objects:

ts
let scene = new Scene3D();
// Load the gltf file
let data = await engine.res.loadGltf('sample.gltf');
// Add to the scene
scene.addChild(data);

Plugin Support

Currently, the following glTF plugins are supported. If the glTF file contains the corresponding plugins, the corresponding features will be loaded automatically:

PluginFeature
KHRdracomesh_compressionSupports Draco compression, which can effectively reduce model size
KHRlightspunctualSupports combinations of multiple light sources, which will be parsed into the engine's light sources. See the Lighting Tutorial for details
KHRmaterialspbrSpecularGlossinessSupports the PBR specular-glossiness workflow
KHRmaterialsunlitSupports Unlit materials
KHRmaterialsvariantsAllows the renderer to have multiple materials, then switch materials through the setMaterial interface
KHRmeshquantizationSupports vertex data compression to save video memory. For example, vertex data is generally floating-point numbers, and this plugin allows them to be stored as integers
KHRtexturetransformSupports scaling and displacement transformation of textures
KHR_lights_punctualSupports extended lights, including direction light, point light, and spot light

Released under the MIT License