Need non-square image to generate all mips down to 1x1

I have a 512x1024 image that I am converting. It generates 10 mip levels and the program I am using the texture in (Unity) is expecting 11 mip levels and will not load the .dds file otherwise.

The mip generator is doing exactly what the options says, its stopping at 1x2 since it’s at the minimum pixel width of 1, but it’s preventing me from using any of my compressed non-square textures. I was able to generate the required number of mip levels in the 2023 Exporter I had previously installed, but not the current 2024.1 exporter.

Hi @kambal_mx! Thanks for reporting this bug. I think I need to add a special case for the logic when the minimum mipmap size is equal to 1, and change the description from “Stop generating mips if the next one would have a width or height less than this number” to accurately describe this case.

Thank you, and sorry about the issue! I hope to have a fix for this soon.

Hi @kambal_mx! Turns out this was a different bug than I expected; this works correctly with 1024x512 images (landscape mode), but not with 512x1024 images (portrait mode), because the code that determined the number of mipmaps accidentally used width twice where it should have used width and height. So, for instance, the nvcompress code (nvtt_samples/compress/compress.cpp at main · nvpro-samples/nvtt_samples · GitHub) does the correct thing.

I’ll have a fix for this in the Texture Tools Exporter in the next version, and will be adding some portrait-mode tests.

Thanks again!

1 Like

Thank you for the quick response. Didn’t think to test different orientations for the image, or that it was a bug in the first place. I just thought it was operating as expected based on the descriptions and was just breaking my workflow.

Took a look at the code you linked. Cool to see how it handles minimum mipmap size and that it also handles the case where min mipmap size = 1.