Cast.NET
2026.9.26.1
dotnet add package Cast.NET --version 2026.9.26.1
NuGet\Install-Package Cast.NET -Version 2026.9.26.1
<PackageReference Include="Cast.NET" Version="2026.9.26.1" />
<PackageVersion Include="Cast.NET" Version="2026.9.26.1" />
<PackageReference Include="Cast.NET" />
paket add Cast.NET --version 2026.9.26.1
#r "nuget: Cast.NET, 2026.9.26.1"
#:package Cast.NET@2026.9.26.1
#addin nuget:?package=Cast.NET&version=2026.9.26.1
#tool nuget:?package=Cast.NET&version=2026.9.26.1
Cast.NET
<p align="center"> <img src="img/logo.png" alt="Cast"/> </p>
Cast.NET is a .NET library for reading and writing cast files. Cast is an open source container for models, animations, materials and more designed by DTZxPorter.
Cast.NET gives you fast, typed access to every node in the cast specification while still letting you work with the raw properties of any node.
Requirements
Cast.NET targets .NET 10 and is tested on Windows and Linux.
Installing
dotnet add package Cast.NET
Releases are versioned by date and build number (yyyy.M.d.build). See the changelog for what changed in each release.
Documentation
Documentation is available here: https://scobalula.github.io/Cast.NET/.
Reading
using CastNet;
using CastNet.Nodes;
var cast = CastReader.Load("model.cast");
foreach (var model in cast.Roots[0].EnumerateModels())
{
foreach (var bone in model.Skeleton?.Bones ?? [])
Console.WriteLine($"{bone.Name}: parent {bone.ParentIndex}");
foreach (var mesh in model.EnumerateMeshes())
Console.WriteLine($"{mesh.Name}: {mesh.VertexCount} vertices, {mesh.FaceCount} faces, material {mesh.Material?.Name}");
foreach (var material in model.EnumerateMaterials())
Console.WriteLine($"{material.Name}: {(material.Albedo as FileNode)?.Path}");
}
Writing
using System.Numerics;
using CastNet;
using CastNet.Nodes;
var root = new RootNode();
var model = root.AddNode(new ModelNode { Name = "chain" });
var skeleton = model.AddNode<SkeletonNode>();
for (var i = 0; i < 16; i++)
skeleton.AddNode(new BoneNode { Name = $"bone_{i}", ParentIndex = i - 1, LocalPosition = new Vector3(0, 0, 1), LocalRotation = Quaternion.Identity });
skeleton.CalculateWorldTransforms();
CastWriter.Save("chain.cast", root);
Array Properties
Buffers such as vertex positions, face indices and key frames are stored as a CastArrayProperty, which keeps values in their raw binary form:
AsSpan<T>()gives zero-copy access whenTmatches the stored type, for examplemesh.Positions.AsSpan<Vector3>().GetScalar<T>(index),CopyTo<T>(span)andToArray<T>()convert from any stored numeric type, somesh.Faces.ToArray<int>()works whether the file stores bytes, shorts or integers.CastArrayProperty.Create<T>(values)builds a property from a span, andCastArrayProperty.CreateIndices(values)picks the narrowest integer type that fits.
Signed integers map to the unsigned type of the same width and Quaternion maps to Vector4.
Examples
The src folder contains a glTF to cast converter, an SEModel and SEAnim to cast converter, and a tool that dumps the contents of a cast file to text.
License/Disclaimers
Cast.NET is licensed under the MIT license. Cast.NET is a third-party library and is not associated with DTZxPorter or anyone who has worked on Cast, any issues with Cast.NET should be directed to this repo. This library comes with no warranty, please refer to the license file for more information.
Attribution
Icons by Smashicons (Modified)
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.9.26.1 | 177 | 9/26/2026 |
| 2.0.0-alpha | 312 | 8/5/2025 |
| 1.0.0-alpha | 204 | 1/9/2024 |