Zig library for the glTF 2.0 standard.
Goal: full Core glTF 2.0 feature coverage.
NOTE: This example project was created with the help of Claude Code.
zgltf-vulkan glTF 2.0 viewer in Zig + Vulkan using this library. Demonstrates .gltf / .glb loading, PBR metallic-roughness, skinning, animations, and KHR extensions (materials_specular, sheen, iridescence, anisotropy, transmission, volume, lights_punctual).
-
.gltf(JSON) -
.glb(binary container) - External buffer / image files
- Embedded base64 data URIs
-
version -
minVersion -
generator -
copyright
- Scenes
- Default scene
- Node hierarchy
- Node transforms — matrix
- Node transforms — TRS (translation / rotation / scale)
- Buffers
- Buffer views (with
byteStride) - Accessors — all component types (
BYTE,UNSIGNED_BYTE,SHORT,UNSIGNED_SHORT,UNSIGNED_INT,FLOAT) - Accessors — all element types (
SCALAR,VEC2,VEC3,VEC4,MAT2,MAT3,MAT4) - Accessors —
normalized - Accessors —
min/max - Sparse accessors
- Mesh primitives
- Attribute
POSITION - Attribute
NORMAL - Attribute
TANGENT - Attribute
TEXCOORD_0/TEXCOORD_1 - Attribute
COLOR_0 - Attribute
JOINTS_0 - Attribute
WEIGHTS_0 - Indexed primitives
- Primitive mode
POINTS - Primitive mode
LINES - Primitive mode
LINE_LOOP - Primitive mode
LINE_STRIP - Primitive mode
TRIANGLES - Primitive mode
TRIANGLE_STRIP - Primitive mode
TRIANGLE_FAN - Morph targets
- Morph target weights
-
baseColorFactor -
baseColorTexture -
metallicFactor/roughnessFactor -
metallicRoughnessTexture -
normalTexture(withscale) -
occlusionTexture(withstrength) -
emissiveFactor -
emissiveTexture - Alpha mode
OPAQUE - Alpha mode
MASK(withalphaCutoff) - Alpha mode
BLEND -
doubleSided
- Textures
- Samplers — mag / min filter
- Samplers — wrap S / T
- Images — URI
- Images — buffer view +
mimeType - PNG decode (via pluggable
ImageDecoder; reference backend inexamples/image_stb) - JPEG decode (via pluggable
ImageDecoder; reference backend inexamples/image_stb)
- Perspective
- Orthographic
- Skins (joints,
inverseBindMatrices) - Animation channels
- Animation samplers
- Interpolation
LINEAR - Interpolation
STEP - Interpolation
CUBICSPLINE - Target path
translation - Target path
rotation - Target path
scale - Target path
weights
-
extensionsUsed -
extensionsRequired -
extensionspassthrough -
extraspassthrough - Typed extension access via
getTypedExtension(comptime T, ...) - Optional
zgltf_khrsubmodule with typed structs for all Khronos-ratified extensions:KHR_lights_punctual,KHR_materials_unlit/clearcoat/emissive_strength/ior/transmission/volume/specular/sheen/anisotropy/iridescence/dispersion/variants,KHR_texture_transform/basisu,KHR_draco_mesh_compression,KHR_mesh_quantization,KHR_xmp_json_ld,KHR_animation_pointer
- JSON schema conformance (required fields, non-empty arrays, camera-block match, min/max length)
- Reference resolution checks
- Accessor bounds checks