Hi,
we encountered the following issue when using KTX2 textures on iOS. If the texture has certain dimensions and mipmaps are used, it seems that some mip levels are not transcoded properly as they contain artifacts.
We do assure that the initial image size is dividable by 4 in both dimensions. Our initial assumption was that it’s always the case if a mip level cannot be divided by 2 anymore without a modulo. But it’s not that simple as we have many cases where this is not the case and things still look fine. After quite some debugging we found that it has to do with the texture resolution but we cannot really figure out a pattern.
We have created a minimal repro: https://playground.babylonjs.com/#1BKO5H#3
For this specific case the initial image size is 1028x1468 and the broken mip level is #3 with 129x184px.
Here is a screenshot of how things look when a certain mip level is used on an iPad (we have the same issue on iPhones and Macs - but it seems that it’s only ARM related as Intel based Macs do not behave the same way)
Using the texture inspector one can go through the mip levels and verify the broken mip level:
We’ve tried different ways how to create the KTX2 texture but nothing seemed to change anything. Therefore our conclusion was that it probably has something to do with the transcoding.
Anyways, the given example was created using KTX 4.4.0 via ktx create --encode uastc --zstd 20 --format R8G8B8_SRGB --generate-mipmap --assign-tf srgb checkerboard.png checkerboard.ktx2
One possible workaround seems to be to use POT textures but then again, we have thousands of examples where non-pot textures work just fine.
Does anyone have a clue what’s going on here and where the issue is?