How to Get Started with Aspose.3D FOSS for .NET

How to Get Started with Aspose.3D FOSS for .NET

Aspose.3D FOSS for .NET is a free, MIT-licensed library for loading, manipulating, and saving 3D files — no native binaries required, pure C# from NuGet.

Step-by-Step Guide

Step 1: Install the Package

Install from NuGet (.NET 10.0 or later required):

dotnet add package Aspose.3D --version 26.1.0

Verify the install loaded correctly:

using Aspose.ThreeD;
Console.WriteLine("Aspose.3D loaded.");

Step 2: Import Required Namespaces

Import the namespaces for the scene and format classes:

using Aspose.ThreeD;
using Aspose.ThreeD.Formats;

Step 3: Load a 3D File

Use Scene.Open() to load any supported format. The library detects the format automatically from the file extension:

using Aspose.ThreeD;

var scene = new Scene();
scene.Open("model.obj");
Console.WriteLine($"Loaded scene with root node: {scene.RootNode.Name}");

Or use the static factory method:

var scene = Scene.FromFile("model.glb");

Step 4: Traverse the Scene Graph

A loaded scene is a tree of Node objects rooted at scene.RootNode:

using Aspose.ThreeD;

void Walk(Node node, int depth = 0)
{
    var indent = new string(' ', depth * 2);
    Console.WriteLine($"{indent}Node: {node.Name}");
    foreach (var child in node.ChildNodes)
        Walk(child, depth + 1);
}

var scene = Scene.FromFile("model.obj");
Walk(scene.RootNode);

Step 5: Save to a Different Format

Use Scene.Save() to export to any supported output format. The library detects the output format from the file extension:

using Aspose.ThreeD;

var scene = Scene.FromFile("model.obj");
scene.Save("output.glb");
Console.WriteLine("Saved as GLB.");

Common Issues and Fixes

FileNotFoundException when calling Scene.Open() The path you passed does not exist or uses the wrong separator. Use an absolute path or Path.Combine() to ensure the file path is correct.

UnsupportedOperationException for certain methods Some methods (scene rendering, watermarking) are not available in the FOSS edition. Check the limitations documentation before using advanced features.

Unknown format error Ensure the file extension matches the actual format. The library detects format by extension for Scene.Open() and Scene.FromFile(). Pass an explicit FileFormat parameter to override detection.

Empty scene after loading Some binary formats may require specific load options. Try using the explicit overload with ObjLoadOptions or GltfLoadOptions if the default load produces an empty scene.

Frequently Asked Questions

Does Aspose.3D FOSS require Microsoft Office or any native DLLs?

No. The library is pure C# with no native dependencies or external binaries required.

Which .NET versions are supported?

.NET 10.0 or later. The library runs on Windows, macOS, Linux, and Docker containers.

Is the library free for commercial use?

Yes. It is released under the MIT License. You may use, modify, and redistribute it for any purpose, including commercial applications.

Which 3D formats can I read and write?

The library supports OBJ, STL, glTF 2.0 / GLB, FBX, COLLADA, PLY, and 3MF for both reading and writing. Use FileFormat.GetFormatByExtension() to query supported formats at runtime.

Can I create a 3D scene from scratch?

Yes. Construct a Scene with no arguments, add child nodes to scene.RootNode, and save to the desired format.

See Also