Hi @donmccurdy , once again, thank you for providing valuable guindence, the https://gltf.report/ really helped me debug my current app. So just to sum up the knowlage that was described in this topic.
There are 2 easy ways of creating KTX2 files from your existing JPEG/PNG files:
- Via PVRTexTool - GUI app that is less performant but easier to use
- Via Khronos Texture Tools specificly toktx - command line app which is much better when you know what you are doing
PVRTexTool
- Download/install the app from the link found in this topic
- Open the PNG/JPEG file in the PVRTexTool
- On the left menu click on - Encode the current texture to a new format
- Select the following combination: Group/API: Super Compression, Name / Type / Colour Space: BASISU ETC1S / Unsigned Normalised Byte / sRGB. You can also use UASTC if you want (bigger size on disk, better quality)
- Select checkbox Generate MIPMaps
- Select BASISU Encoding Quality - Best
- Click Encode
- After encoding is finished clicked on File - Save As and select .ktx2 format
Now you have your KTX2 texture ready for your KTX2Loader in Three.js.
Pros : Easy to use
Cons : Not getting the best results - the textures are bigger (in terms of size on the disk) and the quality is not so great as you can get.
toktx.
- Download/install the app from the link found in this topic
- Open CMD and naviage where your PNG/JPEG texture can be found (example: cd Downloads/mytextures/)
- Add the following command:
toktx --2d --genmipmap --target_type RGBA --t2 --encode etc1s --clevel 5 --qlevel 255 Atlas.ktx2 Atlas2.jpg
Which can be translated like this: Create KTX2 texture named Atlas.ktx2 from original file Atlas2.jpg. The KTX2 texture will be 2D (–2d) with generated MipMaps (–genmipmap) and the target color type is RGBA (–target_type RGBA). Because it is KTX file I am specifing that I want it in version 2 (–t2). Also compress it with ETC1S (–encode etc1s) and I want MAX quality (–encode etc1s --qlevel 255) together with MAX compression (–encode etc1s --clevel 5).
Now you have your KTX2 texture ready for your KTX2Loader in Three.js.
Pros : Better end results, smaller textures, better quality, multiple other functionalities like resizing etc.
Cons : Much harder to use when you are not familiar with terms and the texture problematics.
But after this 1 month I definetly recomend usage of toktx command line tool. Because when you know what flags you need, it is easy to write some Go or PHP or C++ script which will convert your textures without any problem. So I concider this issue as resolved. @donmccurdy do you want to add anything else? If no, I will mark this last response as answer to my original question (of course it is just a summary of all your advices, so I am not the one who solved my issue, I just a person who sum it down
)