You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I am trying to convert a gltf2 file into glb2 by adding all the files to the filelist. But the resultant "glb" file still has uri's to texture files.
converted the gltf2 file with the following code.
`assimpjs.then ((ajs) => {
let fileList = new ajs.FileList ();
fileList.AddFile (
'scene.gltf',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/scene.gltf")
);
fileList.AddFile (
'scene.bin',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/scene.bin")
);
fileList.AddFile (
'lambert1_baseColor.png',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/textures/lambert1_baseColor.png")
);
fileList.AddFile (
'lambert1_metallicRoughness.png',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/textures/lambert1_metallicRoughness.png")
);
fileList.AddFile (
'lambert1_normal.png',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/textures/lambert1_normal.png")
);
// convert file list to assimp json
let result = ajs.ConvertFileList (fileList, 'glb2');
// check if the conversion succeeded
if (!result.IsSuccess () || result.FileCount () == 0) {
const errorCode = result.GetErrorCode ()
console.log("errorCode", errorCode)
return
}
// get the result file, and convert to string
let resultFile = result.GetFile (0);
fs.writeFile(`breakfastTestGltf.glb`, resultFile.GetContent(), (e) => {
if (e) {
const errorCode = result.GetErrorCode ()
console.log("error", e, errorCode);
} else {
console.log("success");
}
})
});`
The generated glb file gave the following view. It missed the texture files. 3dViewer mentioned regarding the missing files and glb file still had some urls of texture files.
Is this not the right way to do it?
The text was updated successfully, but these errors were encountered:
I think that's an error in assimp's glb exporter so you should probably report the issue there. Side note: https://3dviewer.net can export to glb, and probably it does a better job.
Hi,
I am trying to convert a gltf2 file into glb2 by adding all the files to the filelist. But the resultant "glb" file still has uri's to texture files.
I used http://3dviewer.net/index.html to visualize the models.
GLTF2 view of model
converted the gltf2 file with the following code.
`assimpjs.then ((ajs) => {
let fileList = new ajs.FileList ();
fileList.AddFile (
'scene.gltf',
fs.readFileSync ("/home/3d-viewer/Microservice-Template/testFiles/breakfast_gltf/scene.gltf")
);
});`
The generated glb file gave the following view. It missed the texture files. 3dViewer mentioned regarding the missing files and glb file still had some urls of texture files.
Is this not the right way to do it?
The text was updated successfully, but these errors were encountered: