Closed seyfeb closed 2 years ago
@seyfeb Thanks for reporting!
I can reproduce the issue. I tried to view this file in two alternative glTF viewers and they also threw errors.
Looking at the KTX file (via ktxinfo
) I can see that it apparently has an incorrect model (KHR_DF_MODEL_RGBSDA
). They were created with gltfpack 0.13, which is rather old. Have you tried re-encoding the original glTF with an up-to-date version of gltfpack ?
Where does this file come from? I presume it's an attachment of an older GH thread, right? Is there a link to its context?
Nevermind, I figured it's from here.
Don't use this asset. It was created during development of KTX-Software and is probably outdated.
Thanks for looking into this. Reconverting this with a current version indeed fixes the error, however the result is somewhat strange:
Before conversion (right), and after conversion (left)
Converted using gltfpack -i Avocado.gltf -o gltfpacked/Avocado.gltf -tc
The textures here in seem okay
Anyway, I would still be worried using KtxUnity if it crashes the editor (and also any app at Runtime?) only because the input was malformed. Is there a way to prevent this from happening?
This is a known Unity issue. Use gltfpack's -noq
parameter to avoid the troublesome quantization.
Good to know it’s a different issue. While having the other one I thought it might be related...
So the only thing that remains here is the question how to avoid the crash at all (even for malformed data)!
Btw, thanks for the work you put into these open-source libraries!
@seyfeb You're right about crashes are not a reasonable reaction to corrupt data. Since the assertion is inside the third party code, I forwarded the request in a discussion. Let's see what their answer is.
@atteneder how come you are using a debug version of libktx in Unity? The encoders, especially ETC1S, are much slower when compiled in debug mode.
@MarkCallow That's a great question! I assumed asserts are active in release builds as well, but that's not true. Turns out my macOS build was misconfigured. After re-building the lib, libktx returns a proper error and does not crash anymore.
Thanks for pointing it out!
When importing a glTF model in Unity using glTFast and the KtxUnity package the Unity editor crashes. This is observed when KtxUnity is added via the file system (either the current main branch or the commit tagged 2.0.1. If I add the package via git URL glTFast claims that the KtxUnity package is not even available (see the issue in the glTFast repo https://github.com/atteneder/glTFast/issues/381).
Expected behavior
The model is imported correctly. Addtitionally, a model import should never crash the editor or a runtime application, even for completely broken models.
OS: macOS Unity editor version: 2021.2.19f1 KtxUnity version: main / 2.0.1 Test model: https://github.com/KhronosGroup/glTF/files/4132437/Avocado.zip
package.json
editor.log