Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compressing texture with uastc logs KTX error that might be misleading #503

Closed
hybridherbst opened this issue Feb 17, 2022 · 2 comments
Closed
Labels
bug Something isn't working external Problems or limitations traced back to other tools. package:cli
Milestone

Comments

@hybridherbst
Copy link

Describe the bug
The same file as for #502 logs an error "Zstd deflation failed; KTX error: Out of memory" when attempting to compress with uastc.
This seems to be incorrect or misleading, as the file is tiny (or it's a bug in toktx maybe?).

To Reproduce
Steps to reproduce the behavior:

  1. Download https://github.com/donmccurdy/glTF-Transform/files/8090577/TexturedCube.zip
  2. Run gltf-transform uastc TexturedCube.glb TexturedCube.uastc.glb
  3. Observe exception with (I think) misleading error message

Expected behavior
Either better error message or the file should pass and compress properly.

Additional context
image

@hybridherbst hybridherbst added the bug Something isn't working label Feb 17, 2022
@donmccurdy
Copy link
Owner

Verbose output:

gltf-transform uastc ~/Desktop/TexturedCube.glb ~/Desktop/TexturedCube.uastc.glb --verbose
debug: Found KTX-Software v4.0.0.
debug: Texture 1/1 (baseColorTexture)
debug: • toktx --genmipmap --uastc 2 --zcmp 18 /var/folders/n5/m5lw96654zn9mpq7lk351jbh0000gn/T/tmp-38216-8yePbD4FogiF-.ktx2 /var/folders/n5/m5lw96654zn9mpq7lk351jbh0000gn/T/tmp-38216-uuOJFUdUVzRj-.jpg

error: • Texture compression failed:

       toktx: Zstd deflation failed; KTX error: Out of memory.



error: Texture compression failed

I have a hunch the image needs to be resized 8x1 → 8x4 for UASTC compression, but not sure whether toktx should handle that automatically or if it requires glTF Transform to provide the --resize flag. Will investigate, thanks!

@donmccurdy donmccurdy added this to the v2.0 milestone Feb 17, 2022
@donmccurdy donmccurdy added the external Problems or limitations traced back to other tools. label Feb 18, 2022
@donmccurdy
Copy link
Owner

donmccurdy commented Feb 18, 2022

The OOM error for UASTC will be fixed in KTX Software by KhronosGroup/KTX-Software#527. The error reported with ETC1S appears to have a different cause. In the meantime, resizing the texture to 12x12 or larger works around the problem, but that value may be specific to this texture.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working external Problems or limitations traced back to other tools. package:cli
Projects
None yet
Development

No branches or pull requests

2 participants