How to Get Started with Aspose.3D FOSS for Java
Aspose.3D FOSS for Java is a free, MIT-licensed library for loading, manipulating, and saving 3D files — no native binaries required, pure Java from Maven Central.
Step-by-Step Guide
Step 1: Add the Maven Dependency
Add the following dependency to your pom.xml (Java 21 or later required):
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-3d-foss</artifactId>
<version>26.1.0</version>
</dependency>Verify the install loaded correctly:
import com.aspose.threed.*;
Scene s = new Scene();
System.out.println("Aspose.3D loaded.");Step 2: Import Required Classes
Import the core classes for scene loading and manipulation:
import com.aspose.threed.Scene;
import com.aspose.threed.Node;Step 3: Load a 3D File
Use Scene.fromFile() to load any supported format. The library detects the format
automatically from the file extension:
import com.aspose.threed.Scene;
Scene scene = Scene.fromFile("model.obj");
System.out.println("Loaded scene with root node: " + scene.getRootNode().getName());Or use the open() instance method:
Scene scene = new Scene();
scene.open("model.glb");Step 4: Traverse the Scene Graph
A loaded scene is a tree of Node objects rooted at scene.getRootNode():
import com.aspose.threed.Node;
import com.aspose.threed.Scene;
void walk(Node node, int depth) {
String indent = " ".repeat(depth * 2);
System.out.println(indent + "Node: " + node.getName());
for (Node child : node.getChildNodes()) {
walk(child, depth + 1);
}
}
Scene scene = Scene.fromFile("model.obj");
walk(scene.getRootNode(), 0);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:
import com.aspose.threed.Scene;
Scene scene = Scene.fromFile("model.obj");
scene.save("output.glb");
System.out.println("Saved as GLB.");Common Issues and Fixes
FileNotFoundException when calling Scene.fromFile()
The path you passed does not exist or uses the wrong separator. Use an absolute path or
java.nio.file.Paths.get() to ensure the file path is correct.
Unknown format error
Ensure the file extension matches the actual format. The library detects format by
extension for open() and fromFile(). Pass an explicit format parameter to override.
Empty scene after loading Some binary formats may require specific load options. Try using an explicit overload with load options if the default produces an empty scene.
UnsupportedOperationException for certain methods
Some methods (scene rendering, watermarking) are not available in the FOSS edition.
Check the limitations documentation before using advanced features.
Frequently Asked Questions
Does Aspose.3D FOSS require any native DLLs?
No. The library is pure Java with no native dependencies or external binaries required.
Which Java versions are supported?
Java 21 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, and FBX for both reading and writing.
Use the Scene.save() extension-based API to export to any supported format.
Can I create a 3D scene from scratch?
Yes. Construct a Scene with no arguments, add child nodes to scene.getRootNode(), and
save to the desired format.