How to Convert 3D Models in Java

How to Convert 3D Models in Java

Format conversion with aspose-3d-foss is a two-step operation: load the source with scene.open(), then save to the target with scene.save().

Step-by-Step Guide

Step 1: Install the Package

<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-3d-foss</artifactId>
  <version>26.1.0</version>
</dependency>

Step 2: Load and Convert

import com.aspose.threed.Scene;

Scene scene = new Scene();
scene.open("input.fbx");
scene.save("output.glb");

The output format is inferred from the file extension.


Step 3: Use Save Options

import com.aspose.threed.FbxSaveOptions;

FbxSaveOptions opts = new FbxSaveOptions();
opts.setFlipCoordinateSystem(true);
scene.save("output.fbx", opts);

Common Conversion Recipes

SourceTargetNotes
OBJ to GLBBinary glTF for webscene.open("in.obj"); scene.save("out.glb");
FBX to STLTriangulated for 3D printingscene.open("in.fbx"); scene.save("out.stl");
STL to OBJWavefront for modellingscene.open("in.stl"); scene.save("out.obj");

Frequently Asked Questions (FAQ)

Does conversion preserve materials?

Material mapping is best-effort. Not all formats carry the same material properties.

Can I batch-convert files?

Create a new Scene for each file. Each instance is independent.