atteneder / KtxUnity

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

Incorrect color channel after importing #66

Closed ApprenticeGC closed 1 year ago

ApprenticeGC commented 1 year ago

I use the image downloaded from this site. Using libvips cli tool on linux Ubuntu 22.04 to convert heic format of image to png format.

The command I use is

vips pngsave samplefilehub.heic samplefilehub.png

After getting samplefilehub.png, I use the tool(toktx) provided by KTX-Software also on Ubuntu 22.04

The command for making ktx2 format is the following

OUT_FILE="samplefilehub.ktx2" \ IN_FILE="samplefilehub.png" \ && time ./bin/toktx \ --t2 \ --assign_oetf srgb \ --genmipmap \ --encode astc \ --astc_blk_d 6x6 \ --astc_quality fastest \ --bcmp \ --lower_left_maps_to_s0t0 \ ${OUT_FILE} \ ${IN_FILE}

After importing to Unity It shows like this while it should look like this originally.

I notice that the importer will use B5G6B5 format, is this correct result?

atteneder commented 1 year ago

Hi @ApprenticeGC ,

I could reproduce the issue. Yes, the texture format choice was bad and that's why it ended up with wrong colors. I've already made the fixing changes in branch ktx-, to be released soon.

I'm also thinking about lettting user override the format in the importer. That would make it a lot more useful.

Thanks for reporting!

P.S.: in you conversion command, toktx ignores all ASTC parameters and only takes --bcmp.