I am using Aspose.3D with php with the intention of converting files to gltf and then display them using model-viewer.js. I can upload, convert to GLTF and then download the given files. However the converted GLTF files appear to be invalid as they do not display in the model-viewer tags nor do they work in an online GLTF editor. https://www.gltfeditor.com/
I have tried with several different source files and formats, yet none of the resultant gltf files are valid.
I have also tried to convert the files to GLB format however get an error message “The file format is not co (truncated…)” despite the documentation stating glb is s supported write format.
Can you please confirm the validity of the converted GLTF file formats using the Aspose 3D service and whether GLB files can be written too?
I have tested the GLTF conversion with sample files and noticed it is not displaying in the online GLTF editor. So I have logged a ticket THREEDCLOUD-53 for further investigation and rectification. However, we will appreciate it if you please your sample input files and output GLTF files. We will double check the scenario with our files as well.
I can convert GLB files using the following sample code. Please try the conversion again using the following sample code. If the issue persists then share your input files here. We will look into it and will guide you accordingly.
curl -X POST "https://api.aspose.cloud/v3.0/3d/saveas/newformat?name=Cube3d_stl.3ds&newformat=gltf_binary&newfilename=Cube3d.glb&folder=Temp&IsOverwrite=false"
-H "accept: application/json"
-H "authorization: Bearer [Access_Token]"
-H "x-aspose-client: Containerize.Swagger"
Thank you for your reply. I have attached a DAE file and the converted GLTF file. I noticed if I try and view it using https://gltf-viewer.donmccurdy.com/ it presents and error saying “THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.” Does the Aspose converter create GLTF v2 files?
Wood_Table.zip (24.1 KB)
I also notice if I include a texture file in a zip such as this one, then there is no reference to the texture file in the converted gltf file. photomodel.zip (771.2 KB)
In regards to the GLB conversion - I am afraid I am not proficient in python/terminal commands, so I am using the PHP solution with the following code based on the test code provided in github:
$testObject = new ThreeDCloudApiTest();
$testObject → testPostConvertByFormat($model);
public function testPostConvertByFormat()
$threedApi = TestBase::getThreeDApi();
$name = ‘Wood_Table.dae’;
$newformat = ‘glb’;
$newfilename = ‘Wood_Table.glb’;
$folder = “3DTestPHP”;
$isOverwrite = “true”;
$storage = “AR_Display”;
$result = $threedApi->postConvertByFormat($name, $newformat, $newfilename, $folder, $isOverwrite, $storage);
For GLB file format you need o use gltf_binary value for newformat.
Using gltf_binary the converted file returns an error “THREE.GLTFLoader: Legacy binary file detected.” when trying to view it in an online viewer. https://gltf-viewer.donmccurdy.com/
Original and converted files are here - Wood_Table GLB.zip (40.1 KB)
For Version 2.0, you can use “gltf2” newformat value for GLTF and “gltf2_binary” for GLB. Hopefully, it will help you to accomplish the task.
About the missing texture issue, we have logged a ticket THREEDCLOUD-54 for investigation. We will share our findings with you soon.
Thank you. The conversions appear to be working now. I would greatly appreciate an update on the texture file issue when you find out more.
Will you be offering conversion support to write files into USDZ format?
We are investigating the issue and we will update you as soon as we made some significant progress towards issue resolution.
I am afraid currently USDZ format is not supported. We have logged a new feature request (THREEDCLOUD-55) in our issue tracking system. We will notify you as soon as the feature is implemented.