paradowskicreative / ZenCompress

Fine-grain texture compression for glTF 3D assets
MIT License
66 stars 2 forks source link

Producing Invalid Glb files #3

Open paulkluka opened 1 year ago

paulkluka commented 1 year ago

I can't quite pin point why it's happening, but about half of the attempted projects end up in invalid GLB files. Gltf.report in Chrome will call them out as having an "Invalid typed array length: " and some numerical value. In firefox gltf.report gives the error: " attempting to construct out-of-bounds Uint8Array on ArrayBuffer." The file size is fully plausible, but it will not read in any glb / gltf viewer. Sometimes if I rerun the same separated gltf it may succeed in a number of tries, but it can be very inconsistent. This is not limited to a single model, we have been trying to convert our environment library and this is a regular occurrence, though I can provide model examples. Some of the failed attempts will take time converting images and adding them and exporting them without Error. Others will export nearly instantly and those will always be corrupted glb files. The settings are all default. I am using version 1.4.3, Encoding quality 4, Compression level 2, RDO .35. The texture format is ktx2(uastc) Error_02 Error

EthanMichalicek commented 1 year ago

Sorry, misclicked "Close issue" there...

I'll take a look at this. Haven't seen this happen with gltf.report yet on our end. Does this consistently happen with certain models? If so, would you be able to provide any of the models that are not functioning for us to look at?

EthanMichalicek commented 1 year ago

According to this issue, this error can sometimes appear on gltf.report even if the model file still works fine. If you're able to test any of the erroring files in Hubs (assuming that is your use case), you may find that they work. If Hubs is not your use case, I'd be curious to know what platform you're compressing for (or if it's for a custom project instead).

paulkluka commented 1 year ago

The platform we're using is Frame. I've tried to load the models into Frame just in case and it gives me the same type of error: "Invalid typed array length: 1392956" Here's a version of the uncompressed separated Gltf file, I'm not sure if something in our files in general is causing it not to compress properly. This is one that gets the error after compression.

ConventionCenter.zip

InvalidArrayLength

EthanMichalicek commented 1 year ago

With a cursory look at it, I can see there are some extensions included in the file that we don't yet support (like KHR_texture_transform) that might be causing issues. I suspect this is why none of the images show up in the texture list on the right side. We may be able to push an update that effectively ignores any unrecognized extensions.

That being said, I just ran a pass with default settings (the same as you listed above as well) on my machine and it loads in gltf.report perfectly fine. It has some warnings but no fatal errors. image

Can you let me know what platform you're running the compressor on?

paulkluka commented 1 year ago

I'm on Windows 10 Pro. Interesting that KHR_texture_transform isn't an extension that can be easily turned off on Blender's glb export. Even given that it's also interesting that it still produced a viable glb for you. Would it be helpful if I posted my corrupted output file?

gabrieljbaker commented 1 year ago

curious about this ^ Can you post that file in case it's helpful @paulkluka

paulkluka commented 1 year ago

convention_center_lm.zip Here is an example of the corrupted glb files.