We are excited to announce the availability of Aspose.3D FOSS for Java – a free, open-source library for working with 3D file formats in Java applications. Built as a pure Java solution with no native dependencies, the library runs on Java 21 and later, making it accessible to a broad range of projects and environments.
This post walks through what the library offers, how to get started, and where to go from here.
What Is Aspose.3D FOSS for Java?
Aspose.3D FOSS for Java is a lightweight 3D file processing library published under the MIT license. It provides a scene-graph API that lets you load, inspect, transform, and save 3D models across several widely used formats. The library is entirely written in Java and requires no external native binaries or platform-specific configurations.
The source code is available on GitHub: https://github.com/aspose-3d-foss/Aspose.3D-FOSS-for-Java
Key Highlights
- Pure Java – no JNI, no native libraries, no platform restrictions.
- Java 21+ compatible.
- MIT licensed – use it in personal, commercial, or proprietary projects without restrictions.
- Scene-graph architecture – a familiar tree of nodes, meshes, cameras, and materials.
- Multi-format support – read and write OBJ, STL, glTF 2.0, and GLB files; read FBX files.
Quick Start
Maven Installation
Add the following dependency to your pom.xml:
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-3d-foss</artifactId>
<version>26.1.0</version>
</dependency>
Your First Conversion
The simplest use case is loading a 3D file in one format and saving it in another. Here is a two-line conversion from OBJ to STL:
import com.aspose.threed.*;
public class QuickConvert {
public static void main(String[] args) throws Exception {
Scene scene = Scene.fromFile("cube.obj");
scene.save("output.stl");
}
}
The Scene class is the central entry point. Call Scene.fromFile() with a file path to load a model, then call save() with the target path. The library infers the format from the file extension.
Building a Scene from Scratch
You can also construct scenes programmatically:
import com.aspose.threed.*;
public class BuildScene {
public static void main(String[] args) throws Exception {
Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("Box");
Transform t = node.getTransform();
t.setTranslation(1, 2, 3);
scene.save("scene.gltf");
}
}
This creates a new scene, adds a child node named “Box” under the root, positions it at coordinates (1, 2, 3), and exports the result as a glTF file.
Loading with Format-Specific Options
When you need finer control over the loading process, each format provides a dedicated options class. For example, loading an STL file with explicit options:
import com.aspose.threed.*;
public class LoadWithOptions {
public static void main(String[] args) throws Exception {
StlLoadOptions opts = new StlLoadOptions();
Scene scene = Scene.fromFile("part.stl", opts);
// Inspect the loaded scene
System.out.println("Root children: "
+ scene.getRootNode().getChildNodes().size());
// Re-export as OBJ
scene.save("part.obj");
}
}
The Scene.fromFile() static method accepts any of the load option types: ObjLoadOptions, StlLoadOptions, GltfLoadOptions, or FbxLoadOptions.
Traversing the Scene Graph
Once a scene is loaded, you can walk the node tree to inspect or modify its contents:
import com.aspose.threed.*;
public class TraverseScene {
public static void main(String[] args) throws Exception {
Scene scene = Scene.fromFile("model.gltf");
for (Node child : scene.getRootNode().getChildNodes()) {
System.out.println("Node: " + child.getName());
Transform t = child.getTransform();
System.out.println(" Translation: " + t.getTranslation());
Entity entity = child.getEntity();
if (entity instanceof Mesh) {
Mesh mesh = (Mesh) entity;
System.out.println(" Vertices: "
+ mesh.getControlPoints().size());
}
}
}
}
This pattern is useful for debugging, generating reports about model contents, or selectively modifying parts of a scene before re-exporting.
Applying Transforms
Positioning nodes in 3D space is done through the Transform object on each Node:
import com.aspose.threed.*;
public class TransformExample {
public static void main(String[] args) throws Exception {
Scene scene = new Scene();
Node parent = scene.getRootNode().createChildNode("Parent");
parent.getTransform().setTranslation(10, 0, 0);
Node child = parent.createChildNode("Child");
child.getTransform().setTranslation(5, 0, 0);
child.getTransform().setScale(2, 2, 2);
// Child's world position is (15, 0, 0) due to
// parent-child transform inheritance
scene.save("transformed.gltf");
}
}
Transforms follow the standard parent-child inheritance model: a child’s world-space position is the combination of its local transform and all ancestor transforms up to the root.
What’s Included
The library ships with a focused set of capabilities designed around the 3D scene-graph model.
Scene Graph
The scene graph is the backbone of the API. Every 3D file is represented as a tree structure:
| Class | Role |
|---|---|
Scene | Top-level container; the root of the scene graph |
Node | A named position in the tree; holds transforms and child nodes |
Entity | Abstract base for visual objects attached to nodes |
Mesh | Polygonal geometry – vertices, faces, normals |
Camera | Virtual camera definition |
Transform | Local translation, rotation, and scale for a node |
GlobalTransform | Computed world-space transform |
Materials
The library provides a PBR (Physically Based Rendering) material model:
- PbrMaterial – physically based rendering material with albedo, metalness, roughness, emissive color, and transparency. This is the only concrete material class available in the Java edition.
Math Utilities
The com.aspose.threed package includes essential math primitives:
- Vector3 – 3-component vector for positions, directions, and colors.
- Matrix4 – 4x4 transformation matrix.
- Quaternion – rotation representation.
- BoundingBox – axis-aligned bounding box for spatial queries.
Vector3 a = new Vector3(1, 0, 0);
Vector3 b = new Vector3(0, 1, 0);
Vector3 c = Vector3.add(a, b); // (1, 1, 0)
Load and Save Options
Each format has dedicated option classes that let you control import and export behavior:
| Format | Load Options | Save Options |
|---|---|---|
| OBJ | ObjLoadOptions | ObjSaveOptions |
| STL | StlLoadOptions | StlSaveOptions |
| glTF / GLB | GltfLoadOptions | GltfSaveOptions |
| FBX | FbxLoadOptions | – (import only) |
For example, to export glTF with pretty-printed JSON and a flipped coordinate system:
GltfSaveOptions opts = new GltfSaveOptions();
opts.setFlipCoordinateSystem(true);
opts.setPrettyPrint(true);
scene.save("output.gltf", opts);
Supported Formats
The following table summarizes the formats that Aspose.3D FOSS for Java can read and write.
| Format | Extension | Import | Export | Notes |
|---|---|---|---|---|
| OBJ | .obj | Yes | Yes | With MTL materials |
| STL | .stl | Yes | Yes | Binary + ASCII |
| glTF 2.0 | .gltf | Yes | Yes | JSON format |
| GLB | .glb | Yes | Yes | Binary glTF via GltfSaveOptions |
| FBX | .fbx | Yes | No | Import only |
OBJ, STL, glTF, and GLB support both loading and saving. FBX is supported for import only.
Format Selection Guide
Choosing the right format depends on your use case:
OBJ is ideal when you need maximum compatibility across 3D tools. Nearly every modeling application can read and write OBJ. It works well for mesh data exchange but carries only basic material information through companion MTL files.
STL is the format of choice for 3D printing workflows. It stores raw triangulated geometry without materials or scene hierarchy, which is exactly what slicer software expects. If your pipeline ends at a 3D printer, STL is the straightforward choice.
glTF is the modern standard for web and real-time 3D. It supports PBR materials, full scene hierarchies, and is designed for efficient transmission. Use glTF when building web-based viewers, working with three.js or Babylon.js, or targeting any real-time rendering pipeline.
FBX is deeply integrated into game development and digital content creation workflows. It supports rich scene data including hierarchies and materials. Aspose.3D FOSS for Java supports FBX import only – use it to load FBX assets and convert them to other formats.
Known Limitations
It is important to note that Scene.render() is not supported in the FOSS edition. Calling this method will throw an UnsupportedOperationException. The library is designed for file-based 3D processing – loading, manipulating, transforming, and saving models – rather than real-time rendering to a display.
Open Source and Licensing
Aspose.3D FOSS for Java is released under the MIT License. This means you are free to:
- Use the library in commercial and proprietary applications.
- Modify the source code to fit your needs.
- Distribute the library as part of your own software.
There are no royalty fees, no usage limits, and no attribution requirements beyond what the MIT license specifies.
The full source code is hosted on GitHub, and contributions are welcome: https://github.com/aspose-3d-foss/Aspose.3D-FOSS-for-Java
System Requirements
| Requirement | Detail |
|---|---|
| Java version | 21 or later |
| Dependencies | None (pure Java) |
| Platforms | Any platform that runs a JVM |
| Build tool | Maven (recommended) |
Getting Started
Here are the resources to help you get up and running:
- Documentation – comprehensive guides and API walkthroughs are available on the Aspose.3D documentation site.
- Knowledge Base – practical how-to articles and troubleshooting tips in the Aspose.3D KB.
- API Reference – detailed class and method reference at the Aspose.3D API Reference.
- Source Code – browse and contribute on GitHub.
- Maven Central – the package is published as
com.aspose:aspose-3d-fosson Maven Central.
Common Use Cases
Here are some practical scenarios where Aspose.3D FOSS for Java fits well:
Format Conversion Pipelines
Many teams receive 3D assets in one format but need them in another. A design team might work in FBX while the web team needs glTF. The library lets you build automated conversion pipelines:
// Convert all incoming FBX assets to GLB for the web team
Scene scene = Scene.fromFile("asset.fbx");
GltfSaveOptions opts = new GltfSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("asset.glb", opts);
3D Model Inspection and Validation
Before integrating a 3D asset into your application, you may want to validate its contents – checking node counts, verifying geometry, or confirming that expected elements are present:
Scene scene = Scene.fromFile("model.obj");
int nodeCount = scene.getRootNode().getChildNodes().size();
System.out.println("Top-level nodes: " + nodeCount);
for (Node child : scene.getRootNode().getChildNodes()) {
if (child.getEntity() instanceof Mesh) {
Mesh mesh = (Mesh) child.getEntity();
System.out.println(child.getName() + ": "
+ mesh.getControlPoints().size() + " vertices");
}
}
Scene Assembly
You can load multiple models and combine them into a single scene:
Scene scene = new Scene();
Scene part1 = Scene.fromFile("chassis.obj");
Scene part2 = Scene.fromFile("wheels.obj");
// Add nodes from each part into the combined scene
for (Node child : part1.getRootNode().getChildNodes()) {
scene.getRootNode().getChildNodes().add(child);
}
for (Node child : part2.getRootNode().getChildNodes()) {
scene.getRootNode().getChildNodes().add(child);
}
scene.save("assembled.gltf");
What’s Next
In upcoming posts, we will cover:
- A deep dive into the key features of the scene-graph API, materials, and math utilities.
- A practical guide to working with each supported 3D format – OBJ, STL, glTF, and FBX – including load/save options and batch conversion patterns.
Stay tuned, and feel free to explore the library and share your feedback on GitHub.