Cast.NET 1.0.0-alpha

This is a prerelease version of Cast.NET.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Cast.NET --version 1.0.0-alpha
                    
NuGet\Install-Package Cast.NET -Version 1.0.0-alpha
                    
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="Cast.NET" Version="1.0.0-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cast.NET" Version="1.0.0-alpha" />
                    
Directory.Packages.props
<PackageReference Include="Cast.NET" />
                    
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 Cast.NET --version 1.0.0-alpha
                    
#r "nuget: Cast.NET, 1.0.0-alpha"
                    
#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 Cast.NET@1.0.0-alpha
                    
#: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=Cast.NET&version=1.0.0-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Cast.NET&version=1.0.0-alpha&prerelease
                    
Install as a Cake Tool

Cast.NET

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 provides you with the ability the read and write these files in an easy and efficient way in .NET. It provides high level access to cast files while also allowing you to work with them in any way you want.

Requirements

Cast.NET requires .NET 6.0 and has been tested on both Windows and Linux.

Documentation

Documentation is available here: https://scobalula.github.io/Cast.NET/. Documentation for Cast.NET is constantly evolving, if you want to help out, please feel free to file a PR!

Quick Usage Examples

A quick example of loading a model and printing its materials:

var cast = CastReader.Load("your_cast_file.cast");
var root = cast.RootNodes[0];

foreach (var model in root.EnumerateChildrenOfType<ModelNode>())
{
    if(model.Skeleton is not null)
    {
        foreach (var bone in model.Skeleton.EnumerateBones())
        {
            Console.WriteLine(bone.Name);
        }
    }

    foreach (var material in model.EnumerateChildrenOfType<MaterialNode>())
    {
        Console.WriteLine(material.Name);

        Console.WriteLine($"\tAlbedoFile: {material.AlbedoFile?.Path}");
        Console.WriteLine($"\tDiffuseFile: {material.DiffuseFile?.Path}");
        Console.WriteLine($"\tNormalFile: {material.NormalFile?.Path}");
        Console.WriteLine($"\tSpecularFile: {material.SpecularFile?.Path}");
        Console.WriteLine($"\tEmissiveFile: {material.EmissiveFile?.Path}");
        Console.WriteLine($"\tGlossFile: {material.GlossFile?.Path}");
        Console.WriteLine($"\tRoughnessFile: {material.RoughnessFile?.Path}");
        Console.WriteLine($"\tAmbientOcclusionFile: {material.AmbientOcclusionFile?.Path}");
        Console.WriteLine($"\tCavityFile: {material.CavityFile?.Path}");
    }
}

A quick example of building a simple skeleton only model:

using System.Numerics;

var root = new CastNode(CastNodeIdentifier.Root);
var model = root.AddNode<ModelNode>();
var skeleton = model.AddNode<SkeletonNode>();

for (int i = 0; i < 16; i++)
{
    var bone = skeleton.AddNode<BoneNode>();

    bone.AddString("n", $"bone_{i}");
    bone.AddValue("p", (uint)(i - 1));
    bone.AddValue("lp", new Vector3(0, 0, i));
    bone.AddValue("lr", new Vector4(0, 0, 0, 1));
}

CastWriter.Save("your_cast_file.cast", root);

In-depth Examples

More in-depth examples are included in the source code, these include a basic Gltf to cast converter and a simple project that dumps all information in the cast file to a text file. The examples are constantly evolving with more being added as time goes on. If you're interested in helping out, feel free to file a PR with an example to help other learn how to use the library.

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.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.
  • net8.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

Initial alpha release.