Posts

Showing posts from July, 2014

Converting image to compressed texture (DXT1) using D3DXCreateTextureFromFileEx

Problem at hand was displaying many images as hires textures in 3D scene.

Current algorithm was using uncompressed 32-bit pixel format to render which led to the giant amount of RAM consumed for each - 2048 x 2048 x 32bit = 16 Mb.
It was not the problem when image count was low (1 to 20) but after image count hit 100, application started to consume more than 2 Gb of RAM and on x86 it had become the source of very real "out of memory" error.

The idea of solution was simple - use compressed textures.
This way, there will be a ceiling for image count but it will be high enough to satisfy most of the needs.

The main questions emerged was how to actually compress textures and which compression format should we choose?

Due to engine used, we were limited to DXT1, DXT3 or DXT5 compression formats.
Chose DXT1 as soon as it gives the best compression rate (8/1) and its limitations (1-bit alpha) are not critical for our application.

The next question, actually how to compress, took so…