I typically use PNGOUT to losslessly compress atlases. This does use more memory on the GPU than a single-channel format, but the portability is important for me.
I am able to load this 200-something-color paletted atlas using RGBA8888 format specified in the atlas, and at least that works on HTML and desktop. Shaders won’t ever interact with a PNG directly they only see what has been loaded onto the GPU, and if the PNG was palette-based with 256 shades of gray, the GPU will have the same contents as if it had loaded a grayscale PNG, if both using the same format. So the only reason to prefer 8bpp grayscale over 8bpp palette is if the image is so tiny that the palette takes up a significant part of the file, and since we had better be using texture atlases, that should never happen in a real game. If you’re using PNG output color mode 0 (grayscale) or 4 (grayscale with alpha), it seems like PNG compressors can’t do as much for file-size with those, and color mode 3 (palette, or indexed color) generally makes a smaller image as long as there is at most one transparent color.
As far as I can tell, there isn’t a generally-portable way to load a single-channel image into GPU memory on all platforms (HTML doesn’t support GL_RED).īut if you want grayscale images for file size reasons: So, as far as I can tell, this is a valid issue still, but there’s nothing we can do about it… Optimizing for GPU memory usage is not easy.