GLB files are text files that record what textures, images, and other files are used in a globe, as well as where those files are stored. The GLB formats are optimized for download speed and load time at runtime, which makes them easier to use in mobile- and web-based 3D modeling programs. Apart from this, the glTF is developed to be an efficient, extensible, interoperable format for the transmission and loading of 3D content. The goals of the format include compact file sizes, fast loading, complete 3D scene representation, runtime independence, and extensibility to accompany further development.
Similarly, the FBX format allows creators to share 3D models with each other because of the fact that is efficient and stores models as binary data. Owing to these capabilities, both of these formats are very popular and we may have a requirement of interconversion. In this article, we are going to discuss the following topics in further details
- 3D file processing API
- Installation and Configuration
- GLB to PLY in Node.js
- Convert GLB to FBX using the cURL command
3D file processing API
The processing of 3D files has become quite handy with the help of our Cloud REST APIs. So now you can perform all 3D file processing and conversion operations using Aspose.3D Cloud. In order to facilitate our customers, we have created a Node.js wrapper around the Aspose.3D cloud so that all the capabilities become available within your Node.js project.
Installation and Configuration
In order to use the Cloud SDK, the first step is to install it either from NPM or GitHub. However, the installation through npm is the easiest one. Please execute the following command to perform the installation
npm install aspose3dcloud --save
Please note that Aspose.3D Cloud SDK for Node.js requires Node.js is 4.8.7 or higher.
Once the installation is performed, the next main step is to create an account by visiting Aspose.Cloud dashboard. The reason you need to create an account is that our APIs are only accessible to authorized persons only. So if you have GitHub or Google account, simply Sign Up. Otherwise, click on the Create a new Account button and provide the required information. Now login to the dashboard using credentials and expand the Applications section from the dashboard and scroll down towards the Client Credentials section to see Client ID and Client Secret details.
GLB to PLY in Node.js
- The first step is to create an instance of ThreeDCloudApi while providing Client ID and Client Secret details as arguments
- Secondly, create an object of postConvertByFormatRequest class
- Define input GLB file name using name property of postConvertByFormatRequest class
- In order to specify the resultant format, please use newformat property
- Now in order to define the resultant file name, please use newfilename property of postConvertByFormatRequest
- Finally, call the postConvertByFormat(..) method of ThreeDCloudApi while passing postConvertByFormatRequest instance as an argument to initiate the conversion operation
The sample files used in the above example are available for testing purposes on the following links
Convert GLB to FBX using the cURL command
Aspose.3D Cloud is so amazing that you can perform the conversion of GLB or another format to any other supported formats including FBX with single cURL command. As mentioned in the above section, you can use the same code and perform the conversion by simply changing the output file format extension and the API will do the remaining job. However, before accessing the APIs on the command line terminal, please note that we need to first generate a JWT access token based on Client ID and Client Secret details because the APIs are only accessed by authorized persons.
curl -v "https://api.aspose.cloud/connect/token" \ -X POST \ -d "grant_type=client_credentials&client_id=718e4235-8866-4ebe-bff4-f5a14a4b6466&client_secret=388e864b819d8b067a8b1cb625a2ea8e" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "Accept: application/json"
curl -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=Wolf-Blender-2.82a.glb&newformat=fbx&newfilename=ConvertedFile.fbx&IsOverwrite=true" \ -H "accept: application/json" \ -H "authorization: Bearer <JWT Token>"
This article has explained the concepts related to popular 3D file formats to other supported formats using Aspose.3D Cloud API. In this article, we have discussed the steps for file conversion using Node.js code snippet as well as the cURL command. Other than the formats discussed above, the API is capable of loading and saving the output in other 3D file formats and their related details can be found over Supported Document Formats.
Please note that under a free account subscription, you can perform 150 document processing requests and once you are satisfied with the API, you may consider purchasing a license subscription which can be as low as $0.005/ API Call. For more details, please visit the Pricing page. In case you encounter any issues while using the API or you have any related queries, please feel free to contact us through the Free Product support forum.
We also recommend visiting the following links to explore more features on