.GLTF GL Transmission Format
.gltf

GL Transmission Format

glTF is the Khronos Group's open standard for 3D scene transmission, using a JSON manifest with separate binary buffers for geometry and texture data.

بنية الصيغة
Header format version
Mesh vertices · faces
Data materials · textures
gltf+json2015مفتوح
بواسطة FileDex
غير قابل للتحويل

3D format conversion requires mesh processing and material translation not available in browser WASM.

أسئلة شائعة

How can I open and inspect a glTF or GLB file?

Use the online glTF Viewer at gltf-viewer.donmccurdy.com or open it in Blender via File > Import > glTF 2.0. VS Code with the glTF Tools extension lets you preview the 3D model and browse the JSON manifest side by side. For programmatic inspection, Three.js Editor in any browser loads GLB files with drag-and-drop.

What is the difference between glTF and GLB?

glTF uses a separate JSON manifest file plus external .bin and image files, while GLB packages everything into a single binary container. The internal data structure is identical in both cases. GLB is preferred for distribution because it avoids missing-file problems, while separate glTF is easier to edit and version-control.

Does glTF support animations and skeletal rigging?

Yes, glTF 2.0 natively supports skeletal animation, morph targets, and keyframe-driven property animation. Animations reference channels that target specific node properties (translation, rotation, scale, or morph weights). Skin objects define joint hierarchies with inverse bind matrices for skeletal deformation.

Why is glTF called the JPEG of 3D?

The name reflects glTF's design goal as a universal transmission format, similar to how JPEG standardized image interchange. Its JSON+binary split allows progressive loading: renderers parse the lightweight scene graph first, then stream heavy geometry and textures on demand. Wide adoption across browsers, game engines, and AR platforms reinforces the analogy.

ما يميز .GLTF

Khronos designed glTF with a JSON manifest that references external .bin files for geometry and textures, allowing browsers to parse the scene graph before heavy binary data arrives — this is why it's called 'the JPEG of 3D'. The format targets real-time rendering pipelines, with a structure that maps directly to GPU API concepts like vertex buffers, index buffers, and texture samplers.

اكتشف التفاصيل التقنية

Manifest Architecture

A glTF JSON file defines a hierarchy of scenes, nodes, meshes, accessors, bufferViews, and buffers. Scenes contain node trees. Nodes carry transformation matrices or decomposed translation/rotation/scale values. Meshes reference primitives, each pointing to accessors that describe typed views into raw binary buffers. Accessors specify component type (float, unsigned short, unsigned int), element type (SCALAR, VEC2, VEC3, VEC4, MAT4), count, and byte offset. This accessor-bufferView-buffer chain means a renderer can allocate GPU memory directly from the binary data without intermediate parsing or type conversion.

GLB Container

The GLB binary container packages the JSON manifest and all binary resources into a single file. It starts with the magic bytes 67 6C 54 46 ("glTF") at offset 0, followed by a version field and total file length. Two chunks follow: chunk 0 holds the JSON manifest (type 0x4E4F534A), and chunk 1 holds the binary buffer (type 0x004E4942). Padding aligns the JSON chunk to 4-byte boundaries using spaces and the binary chunk using null bytes. This eliminates the multi-file dependency problem while preserving the same internal structure.

Materials and Extensions

glTF 2.0 mandates PBR metallic-roughness as the core material model, defining base color, metallic factor, roughness factor, normal map, occlusion map, and emissive properties. Extensions expand capabilities: KHR_draco_mesh_compression reduces geometry size by 90%+, KHR_texture_transform adds UV offset and tiling, and KHR_materials_unlit supports flat-shaded rendering. KHR_mesh_quantization allows vertex attributes to use lower-precision integer types, trading minimal visual difference for significant size reduction. The MIME type for standalone JSON manifests is model/gltf+json, while GLB uses model/gltf-binary.

Adoption Patterns

Web platforms treat glTF as a first-class citizen. Three.js, Babylon.js, and PlayCanvas all ship native loaders. Google's model-viewer web component renders glTF/GLB files as interactive 3D previews with a single HTML tag. AR frameworks on Android (SceneViewer) and iOS (Quick Look via USDZ conversion) accept glTF/GLB for augmented reality object placement. The format's strict spec compliance requirements mean that validators like the Khronos glTF-Validator catch structural errors before they reach production renderers.

المرجع التقني

نوع MIME
model/gltf+json
المطوّر
Khronos Group
سنة التقديم
2015
معيار مفتوح
نعم — عرض المواصفات

البنية الثنائية

GLB files start with a 12-byte header: 4-byte magic (0x46546C67, 'glTF' in ASCII), 4-byte version (currently 2), and 4-byte total length. Following the header are two chunks, each prefixed with a 4-byte chunk length and 4-byte chunk type. Chunk 0 (JSON, type 0x4E4F534A) contains the scene manifest. Chunk 1 (BIN, type 0x004E4942) contains interleaved vertex, index, and image data.

Validate glTF structure with Khronos validator أخرى
npx gltf-validator model.glb --format json

Runs the official Khronos glTF-Validator via npx, outputting a JSON report of errors, warnings, and hints. Catches accessor misalignment, missing buffer references, and extension compatibility issues.

Extract GLB to separate glTF + bin files أخرى
python3 -c "import pygltflib; g=pygltflib.GLTF2().load('model.glb'); g.save('model.gltf')"

Uses the pygltflib Python library to load a GLB container and re-save it as a separate .gltf JSON manifest plus .bin buffer file. Helpful when you need to inspect or edit the JSON manifest directly.

منخفض

نقاط الضعف

  • JSON manifest may contain URIs pointing to external resources, enabling potential data exfiltration if a loader follows arbitrary URLs
  • Embedded base64 data URIs in the manifest can disguise large payloads that exhaust memory during decoding
  • Draco-compressed geometry with crafted parameters can trigger integer overflows in decompression libraries

الحماية: FileDex does not parse, render, or execute 3D model files. Reference page only.