GLTFexporter textures lose alpha [solved]

How I solved the problem:

// traverse the loaded data before adding to scene…

gltf.scene.traverse(function(node){
    if (node.material !== undefined) {
	 if ( node.material.alphaTest > 0 ) {
			node.material.map.format = 1023;  // was reporting as 1022 (no alpha)
			node.material.needsUpdate=true;
					}
				}
			} );

I am trying to get this working.

In the 3D world I am creating. I have a mix of content that I exported from Blender. They came from two different sources. I load both, one after the other as GLTF files, and they work fine. The alphas show correctly.

I am trying to use the GLTFexporter in Three.js to export the entire scene combined.

When I load the combined scene, the alpha channel is missing from all of the embedded images. (they are PNG)

I have tried iterating through the loaded scene, and making sure the alphaTest and transparency values are correct. I believe the exporter is just dropping the alpha channel in the image, when it re-embeds them.

I am wondering if there is an option that I am missing in GLTFExport? Or an updateMatrix() needs to be done somewhere, before I export maybe?

tjs_withAlpha tjs_withoutAlpha

Edited: Hmmm… I just checked my exported file in Blender. The alpha is actually there. I am looking at GTLFLoader now… Weird. :confused:

And sorry if I am being a pest on this forum lately. I’m learning :slight_smile:

I watching this