atteneder / KtxUnity

Load KTX and Basis Universal textures at runtime
Apache License 2.0
218 stars 42 forks source link

KTX2 not supported? #16

Closed hybridherbst closed 3 years ago

hybridherbst commented 4 years ago

I think this is related to #5; I tried loading a file that has etc1s textures created with https://gltf-transform.donmccurdy.com/cli.html (which in turn uses https://github.com/KhronosGroup/KTX-Software/releases) and get errors for failed transcoding:

image

It seems the textures have mime type ktx2 and contain basis. Is there something I'm doing wrong? I verified that the files work with the babylon sandbox, and also that loading basis files generated with basisu works.

I attached a file for reference (tried with multiple): Schreibkugel-etc1s.glb.zip

atteneder commented 3 years ago

Thanks for reporting!

KtxUnity uses quite outdated binaries of KTX2-Software. It could still be an ordinary bug, but I'd like to prepare an updated ktx library first.

atteneder commented 3 years ago

Today I prototyped new native libraries (since a lot changed in the last months, I had to re-think the build and source somewhat).

I can confirm that all outdated KTX files (created in April) cause the updated library to crash (Unity Editor macOS), but using re-encoding versions of the same textures with an up-to-date toktx works!

Since your demo file works now, it's safe to say my assumptions were right:

grafik

Since the KTX extension is about to be ratified I'll try to finish off this fix soon, but it'll take some time to have it working and tested on all platforms.

regards, Andi

hybridherbst commented 3 years ago

That's awesome! Let me know if you'd like help testing; I'm particularily interested in Windows Desktop and Android support, so happy to test drive those once you say it's ready to be tested.

atteneder commented 3 years ago

I'm working on the native libs for all platforms, but macOS, iOS, Windows and Linux should work already. Find the recent builds here:

https://github.com/atteneder/KTX-Software-Unity/actions

I'll close this issue once the updated native libs are pushed in this repo.

If you're eager to try, download the native libs and manually place them in the respective KtxUnity Plugins folders.

hybridherbst commented 3 years ago

Ah, awesome. I'd be especially interested in Windows + Android, can test with Windows first of course! WebGL would also be super interesting but you'd have to say if that's even possible.

DerrickBarra commented 3 years ago

@atteneder Our team is integrating KtxUnity into our WebGL/Android/iOS project, so we'll be happy to test.

atteneder commented 3 years ago

@DerrickBarra Thanks for the offer!

I've been testing WebGL and iOS successfully now and the binaries for those platforms are already built by the CI (see link above).

Currently I'm working with Khronos to land Android support in KTX-Software. Should be done this week.

In case you want to jump ahead, the branch I'm working on is this one: https://github.com/atteneder/KtxUnity/tree/ktx_4.0.0_beta_4

I'll let you know if I make progress.

atteneder commented 3 years ago

Update:

Did some more fixes and added texture orientation support. Pull the ktx_4.0.0_beta_4 branch to test.

Binaries all platforms (including Android, Windows and Linux) can be loaded: https://github.com/atteneder/KTX-Software-Unity/actions/runs/320877243

I've tested Android 32/64 and macOS successfully!

I might wait for a breaking change in KTX-Software coming end of this week before publishing binaries. Other than that (and testing Windows/Linux), it's ready!

DerrickBarra commented 3 years ago

Looking forward to testing with the new binaries, hopefully this fixes some of the reported bugs.

Edit: I pulled down the beta branch, is there something else I need to do in order to ensure I have the latest binaries or does that include them?

atteneder commented 3 years ago

They are not updated! Download them separately from the link above.