KTX2 (Khronos Texture Container version 2.0) is the latest texture compression scheme launched by Khronos, supported by Galacean since version 1.1. KTX2 will transcode to the corresponding format of compressed texture (BC/PVRTC/ETC/ASTC) based on the device platform support at runtime.
In the engine, simply use resourceManager
to load:
engine.resourceManager.load("xxx.ktx2");
// 或
engine.resourceManager.load<Texture2D>({
type: AssetType.KTX2,
url: "xxx.ktx2",
}).then(tex=>{
material.baseTexture = tex;
})
Using ktx2 in glTF requires including the KHR_texture_basisu extension.
KTX2 can be generated using:
When packaging the project, the editor can configure options to generate KTX2. Refer to the 'Project Release' document. The project export is a global configuration, and different compression formats can be configured independently for different texture resources. Check overwrite in the texture panel of the editor to override the global configuration:
KTX2 transcoding uses WebAssembly technology, requiring Chrome 57+ and iOS 11.3+ (WebAssembly in versions 11.0 ~ 11.2 has a bug).