Continuing from this forum post.
I am exploring using Aspose’s 3D SDK for Java to convert various 3D model types to GLB.
I have found that many of the model types supported as inputs in your Aspose.3D documentation are unable to be successfully exported to GLB. Can you provide clarifications and/or more information on these instances, including:
- Autodesk Maya Binary (MB)
- Autodesk DXF
- Siemens (JT) versions 8.0.0, 8.1.0, 9.0.0, 10.3.0
- VRML (WRL)
- Discreet 3D Studio (3DS)
- Point Cloud (XYZ)
Here’s a code snippet for converting models covered by Aspose.3D to GLB:
import com.aspose.threed.FileFormat;
import com.aspose.threed.GltfSaveOptions;
import com.aspose.threed.Scene;
public class ThreeDToGlbRepro {
public static void main(String[] args) throws Throwable {
new com.aspose.threed.License().setLicense(args[1]);
String input = args[0];
String output = args[0] + ".glb";
GltfSaveOptions gltf = new GltfSaveOptions(FileFormat.GLTF2_BINARY);
gltf.setExportTextures(true);
gltf.setEmbedAssets(true);
gltf.setDracoCompression(true);
try {
System.out.println("detected as: " + FileFormat.detect(input));
Scene scene = new Scene();
scene.open(input);
scene.save(output, gltf);
System.out.println("saved GLB: " + output);
} catch (Throwable t) {
System.out.println("throwable class : " + t.getClass().getName());
System.out.println("throwable message: " + t.getMessage());
Throwable cause = t.getCause();
while (cause != null) {
System.out.println(" cause: " + cause.getClass().getName() + " -> " + cause.getMessage());
cause = cause.getCause();
}
t.printStackTrace(System.out);
throw t;
}
}
}
You can run it by passing in a model and an Apose license as arguments.
I have attached sample model files below:
Aspose 3D Samples.zip (3.0 MB)