pixijs / pixi-compressed-textures

Compressed textures and retina support for pixijs. Loader can choose textures depends on platform and rendering mode.
MIT License
93 stars 25 forks source link

ASTC (RGBA) textures loading #14

Closed adasek closed 7 years ago

adasek commented 7 years ago

Hi, I wrote a commit that enables load of ASTC encoded textures. Support of ASTC is rising since its Khronos standardization in 2012. According to webglstats it is supported on 28% smartphones.

I encoutered two problems: 1) According to stackoverflow thread it is impossible to determine compresion type from astc file header. I detect blocksize by data length and presume RGBA color space (no support for SRGB8) 2) ASTC-encoder that seems like a natural choice for encoding is using top-left instead of bottom-left coordinates. Simplest solution is to flip the image vertically before encoding.

I made a simple example. Tested on Android phone.

I would be glad for your feedback.

ivanpopelyshev commented 7 years ago

that seems like a natural choice for encoding is using top-left instead of bottom-left coordinates. Simplest solution is to flip the image vertically before encoding.

We can hack it when we upload, there was some flag about it.

Also it will be different for pixi-v5 and webgl2 support: https://github.com/playcanvas/engine/blob/21ed3bc8eb3000e484dd1438c7c7492995e81ab9/src/graphics/device.js#L1275