Hi, I’m working on a sprite animation system that requires 2048x2048 textures per animation.
The scene will need to display any of these animation at any time, and all those animations needs to be loaded.
How many textures can I expect to load on desktop nowadays?
A 2048x2048 texture has roughly 4 Mio. pixels. Assuming you are using regular ARGB textures, with 8 bits per channel, that’s 4 bytes per pixel. So in total that’s 16 MB for the texture. Usually you also have mipmap levels, which adds another 33%, making the texture just over 21 MB in size.
According to the Steam hardware survey the average PC on Steam has about 2GB of video memory nowadays. That’s enough for more than 90 such textures. A bit less in reality, as you can’t use every last bit of VRAM for your textures. A high-end PC will have 8+ GB.
Using texture compression you could reduce texture size by a factor of 4, or even more, depending on the format.
Yes, most GPUs can render some format of compressed textures directly. If you set the format of your texture to Compressed in the Pipeline Tool MG will handle it for you and choose the right compression format based on the target platform (e.g. DXT on desktop). Note that texture compression isn’t lossless.
That’s why the compressed texture formats are all block based. A 4x4 square block is friendly to the GPU’s parallelism, the value table in the block is used to look up what value to use for each pixel of the 4x4 block and that’s pretty snappy. They end up as a whole bunch of indexed color tiles.
Compressed looks right except for whatever you have going on with your silhouette?
Did you compress everything, such as also compressing a normal-map? You can’t reasonably compress a normal-map for use on anything with curvature without everything going to hell (aside from using 2-channel encoding and inferring Z).
You can compress normal-maps on mostly planar surfaces without a disaster, but texture compression and normals is and probably always will be an open problem.
There something I should mention, my sprites only need grayscale and alpha informations.
Ideally, I’d like to process the texture from the pipeline with only an Alpha and Grayscale channels, this would make 16bits pixel without loss of information, and have the spritebatch apply a mask color; Is this possible?