Download

Optimize texture compression settings

If I have a black and white mask, I would like to compress it as a 1-bit texture with trilinear filtering to save on memory, and possibly use a much higher pixel resolution. Is there a way to do this manually, like, to set up my own compression settings profile to accept 1-bit masks? It shouldn’t be more expensive to have an uncompressed 1-bit texture at 512x512 resolution than the same texture with uncompressed 8-bit grayscale settings at 64x64. Also, what is the performance impact of trilinear filtering compared to bilinear? Does nearest neighbor (no filtering) help the rendering cost any?

I’m working on a master material to handle the tiling of texture assets to generate stuff like tiles and bricks without any noticeable tiling to the system at all. I want to sell it for being able to produce very high quality results with extreme efficiency and easy rendering. I’m at the point now where 3@512x256 maps (1 normal, 1 black+white mask, and 1 grayscale noise) can make very clean looking tiling bricks without any noticeable tiling at all, and a few maps of even smaller size can work wonders for tiles.

64x64x8/8 == 4096 bytes
512x512x1/8 == 32768 bytes

That being said, unless the hardware supports 1-bit textures, the best you can do is use DXT1 texture compression with cut-out support, which gives you black/white at 4 bits per pixel (where the black is also transparent.) Compressing a black/white RGB texture to this format will give the same on-GPU size ans compressing a black/white 1-bite texture.

trilinear filtering isn’t that much more expensive than nearest-neighbor, because nearest-neighbor will have to fetch the same texel block as the top level of trilinear; the lower-level block will cache pretty well. It used to be, the filtering blend in the texture unit had a cost, but I haven’t seen that matter on modern hardware for a long time (certainly not when also doing per-pixel lighting calculations – fragment shaders take more time than the filtering.)

Hmm, it seems the savings for a low bit format aren’t as dramatic as I had hoped. But the increase in values grow exponentially with the bit increase, so 1-bit gives you 2 values, 4-bit gives you 16, and 8-bit gives you 256. I thought the memory savings would be exponential, too. NVM.

Here is a screenshot of what I’m doing, using a very sharp 1024x512 mask and a 512x256 noise map to generate very sharp bricks that never appear to tile.

Shot6.jpg