3D Object OBJ files contain 3D objects information like the texture and coordinates. You can convert an OBJ file to a GLTF or FBX file programmatically in Java. In some scenarios, you might need to convert an OBJ file to different files. In accordance with that, this article covers how to convert an OBJ file to GLTF or FBX file.
- Java API to Convert OBJ to glTF GLB or FBX File
- Convert OBJ to glTF GLB File Programmatically in Java
- Convert OBJ to FBX File in Java
Java API to Convert OBJ to glTF GLB or FBX File
Aspose.3D for Java API supports manipulating 3D Object files like converting them to glTF GLB or FBX files. API. You can install the API by downloading the JAR file from the New Releases section or with the following Maven configurations in pom.xml file of your project:
Repository
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
</repositories>
Dependency
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-3d</artifactId>
<version>21.12</version>
</dependency>
</dependencies>
Convert OBJ to glTF GLB File Programmatically in Java
You can convert an OBJ file to a glTF file in Java by following the steps below:
- Load the input OBJ file with the Scene constructor.
- Initialize a GltfSaveOptions class object.
- Save the output glTF GLB document.
The code snippet below demonstrates how to convert an OBJ file to glTF document in Java:
Convert OBJ to FBX File in Java
You can convert an OBJ file to an FBX file with the following steps:
- Load the input object OBJ file using the Scene class constructor.
- Initialize an object of FbxSaveOptions class.
- Save the output FBX file using the Save method.
The following code snippet shows how to convert an OBJ file to an FBX file programmatically using Java:
Conclusion
In this article, you have learned how to convert an OBJ object file to a glTF GLB or FBX file programmatically in Java. Moreover, you may take visit the API Reference or the documentation to learn other features offered by the API. In case of any concerns, please feel free to contact us at the forum.