'ThreeJS exportGLTF(scene) | GLB textures broken after export | Collada
I am trying to export a collada scene with threejs using GLTFexporter from the browser, the scene renders perfectly with threejs in collada format but when I try to export a GLB file with GLTFExporter the textures look messed up and I think some maybe even missing.
I am working with a test file from the examples folder...
elf.dae and textures: https://github.com/mrdoob/three.js/tree/38bf5f47a8c01a1d12d16a41b4097dc9ee31daad/examples/models/collada/elf
gltfExporter.parse(
input,
function ( result ) {
if ( result instanceof ArrayBuffer ) {
saveArrayBuffer( result, 'scene.glb' );
} else {
const output = JSON.stringify( result, null, 2 );
console.log( output );
saveString( output, 'scene.gltf' );
}
},
function ( error ) {
console.log( 'An error happened during parsing', error );
},
options
);
My application creates blobs for each file and texture in localStorage by name and then when it asks for the file URLModifier first checks if file exists in localStorage object and then redirects if file exists to the blobs URL.
Everything appears to work fine until I open the GLB file and view the export... You can see here that the file is rendered correctly in collada format...
But if I open the exported file in model-viewer this is the result...
Where am I going wrong? I think maybe I am not setting the correct inputs on gltfExporter, hoping someone can point me in the right direction.
Solution 1:[1]
Have you tried inverting the texture in the y-axis? I think this is set to true by default, but GLTF needs it to be false.
texture.flipY = false;
https://threejs.org/docs/?q=texture#api/en/textures/Texture.flipY
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Marquizzo |