USDZ Exporter Issue - alphaTest does not work correctly

Hi, I’ve noticed that when using the PBRMaterial.PBRMATERIAL_ALPHATEST mode, the material on the exported USDZ model is not transparent.

I tested exporting to GLB, and transparency works correctly there. Exporting to USDZ works correctly with PBRMATERIAL_ALPHABLEND, but not with PBRMATERIAL_ALPHATEST.

I have prepared the playground to reproduce this issue:

Btw. I needed to add setTimeout to avoid this error in Tools.Download function:
“OffscreenCanvas.convertToBlob: Cannot get blob from empty canvas. ToBlob tools.ts:895 p dumpTools.ts:200”

Mabye you use offscreen canvas to transform textures and it is not ready to be downloaded, or the size is empty, because the texture is not loaded yet. I am not sure.

cc @alexchuber

Will take a look today :slight_smile:

Btw. I needed to add setTimeout to avoid this error in Tools.Download function:
“OffscreenCanvas.convertToBlob: Cannot get blob from empty canvas. ToBlob tools.ts:895 p dumpTools.ts:200”

It’s probably that the texture hasn’t finished loading yet, and the exporter doesn’t check (or wait) for it. Sounds like we should change that.

Alpha fix:

Texture-not-being-ready fix coming shortly :slight_smile:

1 Like

Great work, thank you! I’ve also tested it on my models, and it works perfectly.

Glad to hear, and thanks for all your testing of the USDZ exporter!

Nested in this PR is a fix for the texture timing problem (though I know you already found a workaround :slight_smile: )

1 Like