Material loading problem

Hi, I have submitted the bug report via the “Report a bug” menu option but I’d like to give further context via this screenshot.

The scene in question gives an error while trying to load Material 7 of an array that only contains 3 materials. Another funny thing is that the scene in question has only 2 materials. “Lit” is included twice in the material list for some reason.

Exporter 3.9.0-ex Engine 3.9.0-alpha.1

Original Post on Discord

by user 420944948767227905

Updated to Exporter 3.10.1-pre. Engine 3.10.1-beta, still has same problem.

by user 420944948767227905

@marcel :cactus: did you get the bug report?

by user 420944948767227905

Hi @JanG yes received it but didnt get to it yet

Hello @JanG this seems related to using MeshOpt compression. I’m currently looking at the code of the compression library. It doesnt happen with Draco

Hi so the root issue seems to be caused by the GLTF export where the gltf contains the same material multiple times but only the first instance is referenced/actually used leading to all other materials being deduplicated (which is correct) but ultimately causing the issue due to mismatching indices.
I created two issues for those internally

Thanks for the info @marcel :cactus: - we have to use MeshOpt as Draco compression doesn’t work with our assets at all. Tell me when you fix it!

by user 420944948767227905

Hi @JanG can you try doing a clean install and re-compress. It should update the compression pipeline to 1.2.0 which should also fix this issue for you
image.png

How do I do a recompress? Just build or anything special?

by user 420944948767227905

You can either build normally or use the ExportInfo context menu item to compress the exported files in your local server

OK this bug does not seem to be happening for me any more even before I updated!

by user 420944948767227905

Great!

by user 420944948767227905

That’s great but also unexpected :slightly_smiling_face: what exactly did you do? I would guess the compression pipeline did already update when you ran it the first time now (?) and is now on 1.2.0 ? It’s in one of the last logs when you run the Apply Compression menu item

I did nothing! I was working on a different task since I reported this to you. I just opened the project and it worked fine. :confused:

by user 420944948767227905

I didn’t use “Apply compression” or update the installation

by user 420944948767227905

hey! pinging as I think I’ve seen this same error show up in a relatively minimal scene - and only in Production builds (not Development)! so that might explain why @JanG had this seemingly disappear earlier. Going to try updating to the latest everything version and will submit a new bug report if it still persists.

by user 248501710404845568

alright - I took a different approach, but I’ve now reproduced this warning in a Production build of a scene with nothing in it but a camera, a single worldspace Unity canvas, and a single RawImage - all wrapped under a SceneRoot with the MeshCompression component on it with Meshopt selected. Even better, the error disappears when MeshCompression is set to None.

This is all with Exporter 3.10.3-pre and Engine 3.10.3-beta. Will try updating now, but if updates don’t fix it, I guess our path forward will be to just use different compression for certain objects!

by user 248501710404845568

oop, that looks like the latest version, actually. Alright, will submit my package as a bug report and plan on different compression to move forward!

by user 248501710404845568

…unfortunately, upon rebuilding the Needle folder to submit the package, the error disappeared again, despite no scene changes :man_facepalming: I guess I’ll just have to wait til the message appears again to submit the report…

by user 248501710404845568

That’s strange. Let us know if it happens again.

We’re aware that there’s potential (wrong) material deduplication happening with meshopt compression (draco should be fixed upstream already) - there’s still the task on my list to check why materials are duplicated on export in the first place.