Textures upside down on glb export

Please see the original at

Henry 8th Wives

When I export this as a GLB using
BABYLON.GLTF2Export.GLBAsync(this.scene, filename).then((glb) => {

the textures are upside down, on rotatedProcessing: fileName.glb…

looks like a defect
can it be fixed?

adding @bghgary

I am not able to repro it with simple meshes in the playground :-), could you create a repro in the playground ? with let s say only one of your boxes ?

I feel like this is the same issue I dealt with some time ago. Look into this thread, and maybe it helps you figure out what’s going on.

So basically as I understand it’s due to OpenGL vs DirectX conventions I guess (so (0,0) coordinates being left top vs left bottom). So basically, if you are loading texture manually in the code, the solution to above thread should work for you as well (last parameter “false” indicates that you want to flip the texture vertically aka invertY). Now, I am not exactly sure what to do when you export the GLB file with embedded texture. Is there a property like myTexture.invertY = true??. I did a really little bit of research and couldn’t find it. So you can look into that. Alternatively, scaling the texture with negative value could be workaround. So something like

*myTexture.vScale = -1

Here it is in action:

Oh, sorry. I think I missed the idea of what are you doing and trying to achieve. My answer might not be helpful. But I will leave it, just in case.

1 Like

@nogalo yours is mostly this PBRMaterial - dynamically update texture with same image, but different outcome - #2 by Deltakosh :slight_smile: funny it happens the same day :slight_smile:

1 Like