H073.HxGLTF 2.0.0

Prefix Reserved
dotnet add package H073.HxGLTF --version 2.0.0
                    
NuGet\Install-Package H073.HxGLTF -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="H073.HxGLTF" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="H073.HxGLTF" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="H073.HxGLTF" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add H073.HxGLTF --version 2.0.0
                    
#r "nuget: H073.HxGLTF, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package H073.HxGLTF@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=H073.HxGLTF&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=H073.HxGLTF&version=2.0.0
                    
Install as a Cake Tool

HxGLTF — High-Performance GLTF/GLB Loader for .NET

HxGLTF is a fast, memory-efficient library for loading GLTF 2.0 and GLB files into structured C# objects.


Features

  • GLTF & GLB Support — Load both .gltf and binary .glb files
  • Complete GLTF 2.0 — Scenes, nodes, meshes, materials, textures, animations, skins, cameras
  • PBR Materials — Metallic-Roughness and Specular-Glossiness workflows
  • Async LoadingGLTFReader.ReadAsync() with progress and cancellation
  • ArrayPool Integration — Zero-allocation accessor reading
  • 7 Built-in Extensions — KHR_texture_transform, KHR_materials_unlit, KHR_materials_clearcoat, KHR_materials_transmission, KHR_materials_ior, KHR_materials_pbrSpecularGlossiness, KHR_mesh_quantization
  • Custom Extension System — Register your own extension handlers

Installation

dotnet add package H073.HxGLTF
<PackageReference Include="H073.HxGLTF" Version="2.0.0" />

Quick Start

using HxGLTF;
using HxGLTF.Core;

// Load a GLTF/GLB file
var gltf = GLTFReader.Read("model.glb");

// With options
var gltf = GLTFReader.Read("model.glb", new GLTFReadOptions
{
    SkipAnimations = false,
    SkipSkins = false,
    StrictExtensionCheck = true
});

// Async loading with progress
var gltf = await GLTFReader.ReadAsync("model.glb",
    progress: new Progress<GLTFLoadProgress>(p => Console.WriteLine($"{p.Stage}: {p.Percentage:F0}%")),
    cancellationToken: token);

Accessing Data

// Meshes
foreach (var mesh in gltf.Meshes)
{
    foreach (var prim in mesh.Primitives)
    {
        var positions = AccessorReader.ReadData(prim.GetAttribute("POSITION"));
        if (prim.HasIndices)
        {
            var indices = AccessorReader.ReadIndices(prim.Indices);
        }
    }
}

// Materials
foreach (var mat in gltf.Materials)
{
    var baseColor = mat.BaseColorFactor;
    var metallic = mat.MetallicFactor;
    var roughness = mat.RoughnessFactor;
    var emissive = mat.EmissiveFactor;
    var alphaMode = mat.AlphaMode; // "OPAQUE", "MASK", "BLEND"
}

// Animations
foreach (var anim in gltf.Animations)
{
    foreach (var channel in anim.Channels)
    {
        var times = AccessorReader.ReadData(channel.Sampler.Input);
        var values = AccessorReader.ReadData(channel.Sampler.Output);
        var targetPath = channel.Target.Path; // Translation, Rotation, Scale, Weights
    }
}

// Skeletons
foreach (var skin in gltf.Skins)
{
    var joints = skin.Joints;
    var ibm = skin.InverseBindMatrices;
}

High-Performance Reading

// Zero-allocation with pooled arrays
var (array, length) = AccessorReader.ReadDataPooled(accessor);
try
{
    ProcessVertices(array.AsSpan(0, length));
}
finally
{
    AccessorReader.ReturnPooledArray(array);
}

Extensions

Built-in

Extension Description
KHR_texture_transform UV offset, scale, rotation on textures
KHR_materials_unlit Unlit materials (no lighting)
KHR_materials_pbrSpecularGlossiness Legacy Specular-Glossiness workflow
KHR_materials_clearcoat Clear coat layer
KHR_materials_transmission Transparent/translucent materials
KHR_materials_ior Index of refraction
KHR_mesh_quantization Compressed vertex data

Custom Extensions

using HxGLTF.Core.Extensions;

public class MyExtension : GLTFExtensionBase
{
    public override string ExtensionName => "MY_custom_extension";

    public override ExtensionParseResult ParseMaterialExtension(
        JsonElement extensionData, Material material, ExtensionParseContext context)
    {
        float myValue = 0f;
        if (extensionData.TryGetProperty("myValue", out var prop))
            myValue = prop.GetSingle();

        return ExtensionParseResult.Succeeded(new { MyValue = myValue });
    }
}

// Register before loading
GLTFExtensionRegistry.Register(new MyExtension());
var gltf = GLTFReader.Read("model.glb");

// Access after loading
if (mat.Extensions.TryGetValue("MY_custom_extension", out var data))
{
    // data contains what ParseMaterialExtension returned
}

Available parse hooks:

  • ParseRootExtension — document-level
  • ParseMaterialExtension — per-material
  • ParsePrimitiveExtension — per-mesh-primitive
  • ParseNodeExtension — per-node
  • ParseTextureExtension — per-texture

Data Structure

GLTFFile
├── Asset (version, generator, copyright)
├── Scenes[] → Nodes[]
├── Nodes[] → Children[], Mesh, Camera, Skin
├── Meshes[] → Primitives[] → Attributes, Indices, Material
├── Materials[] → Textures, PBR factors, Extensions
├── Textures[] → Image, Sampler
├── Animations[] → Channels[], Samplers[]
├── Skins[] → Joints[], InverseBindMatrices
├── Cameras[] → Perspective/Orthographic
├── Buffers[] / BufferViews[] / Accessors[]
└── ExtensionsUsed[] / ExtensionsRequired[]

Using MonoGame?

Use HxGLTF.MonoGame — loads glTF/GLB directly into a ModelKit Scene with animations, skeletons, PBR materials, and morph targets.


License

MIT

Contact

Discord: sameplayer

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on H073.HxGLTF:

Package Downloads
H073.HxGLTF.MonoGame

MonoGame bridge for HxGLTF – loads glTF/GLB into ModelKit scenes.

H073.HxGLTF.MonoGame.WindowsDX

MonoGame WindowsDX bridge for HxGLTF – loads glTF/GLB into ModelKit scenes.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 152 3/16/2026
1.3.1 120 3/15/2026
1.2.2 267 5/6/2025
1.2.0 396 5/6/2025
1.0.2 309 5/5/2025
1.0.1.3 229 5/4/2025
1.0.1.1 182 5/4/2025
1.0.1 216 9/26/2024