DXT compressed texture support
by Joe Rossi · in Torque Game Builder · 07/28/2005 (12:43 pm) · 7 replies
Hi everyone, new user here. First I want to say thanks for this awesome engine! I can't wait to see what's coming up. My question is, are there any plans to add texture compression to T2D? It seems like a simple way to gain performace since we deal mainly with texture data. In my experience I've gained a good deal of FPS using .DXT over PNG images. I have some code to do this in OpenGL, and DirectX has this built in I believe.
#2
This is a free speed boost providing the hardware and extensions are there. It lowers texture bandwidth that is an issue for people with many large sprites. This is why the DXT/st3c formats were invented! So why don't we take advantage?
Anyway, framerates won't lie. I've actually found most time is spent rendering. Which isn't so slow but can be more efficient with texture compression. Compression really does provide an advantage in performance.
Edit: spelling, removed long winded justification of benefits of texture compression. :/
07/29/2005 (11:33 pm)
Quote:Performance? Are you drawing so much that you need 2D performance in your rendering system?Yes?
This is a free speed boost providing the hardware and extensions are there. It lowers texture bandwidth that is an issue for people with many large sprites. This is why the DXT/st3c formats were invented! So why don't we take advantage?
Anyway, framerates won't lie. I've actually found most time is spent rendering. Which isn't so slow but can be more efficient with texture compression. Compression really does provide an advantage in performance.
Edit: spelling, removed long winded justification of benefits of texture compression. :/
#3
I've successfully loaded DXT3 and DXT5 compressed .DDS files in T2D/OpenGL.
Hoping to share soon, in another post (resource?)...
11/01/2005 (3:40 pm)
Update: I've successfully loaded DXT3 and DXT5 compressed .DDS files in T2D/OpenGL.
Hoping to share soon, in another post (resource?)...
#4
Smaug also has a very good point regarding compression artifacts with DXT. You really need to twiddle with it a lot and pick the right compression otherwise your alpha will end up hosed and other nasty things.
11/01/2005 (3:58 pm)
Joe is probably very right on this. With Torque2D you aren't going to be vertex bound, GPU bound, or fillrate bound, so texture bandwidth would be the main GPU optimization you could do.Smaug also has a very good point regarding compression artifacts with DXT. You really need to twiddle with it a lot and pick the right compression otherwise your alpha will end up hosed and other nasty things.
#5
Poking thru the engine I notice Torque already does some texture compression...but I couldn't tell how to use it and I think .DDS file support is a good addition to T2D anyway.
11/01/2005 (6:47 pm)
I use ATI's Compressionator utility with it's DirectX compression, and with the shooter demo graphics I didn't notice artifacts even at DXT5. So maybe it's best for toony images and particles. You won't want to compress every texture, also IMO this is more for action packed games.Poking thru the engine I notice Torque already does some texture compression...but I couldn't tell how to use it and I think .DDS file support is a good addition to T2D anyway.
#6
12/06/2005 (10:02 am)
Joe, did you ever post this resource?
#7
If you want I can wrap up what I have. It's not perfect (no DXT1) but in OGL mode it seems to work fine.
I also didn't try adding it to the alpha yet.
EDIT>
There seems to be another problem. I only tested on small, power of 2 textures. Now I'm finding that any texture needing to be padded will end up half white. So the 800x600 "logowhite" image from the SDK demo won't work, but the missiles+ships from the shooter do.
Anyway, maybe someone with more TGE knowledge can pick up where I left off.
12/06/2005 (1:03 pm)
No Josh, mainly because I couldn't get the DirectX part to work. I got to the point where I have the pixels in a buffer that need to upload to a texture, but I have little experience in DX7 and all I can get is white textures. If you want I can wrap up what I have. It's not perfect (no DXT1) but in OGL mode it seems to work fine.
I also didn't try adding it to the alpha yet.
EDIT>
There seems to be another problem. I only tested on small, power of 2 textures. Now I'm finding that any texture needing to be padded will end up half white. So the 800x600 "logowhite" image from the SDK demo won't work, but the missiles+ships from the shooter do.
Anyway, maybe someone with more TGE knowledge can pick up where I left off.
Torque Owner Smaug
Performance? Are you drawing so much that you need 2D performance in your rendering system?
I've found that 2D game performance (or the lack thereof) comes more from CPU-related tasks than the actual rendering of a scene. 2D rendering isn't terribly slow due to the fact that, typically, 2D games only have about 3-4x overdraw at max. Any post-GeForce card should easily be able to handle that; even the Intel integrated chipset garbage can deal with that. Any rendering performance issues tend to come from pathological use of the OpenGL API (for example, lots of texture swapping due to making one texture per tile or something to that effect) rather than lack of fillrate.
Now, granted, I haven't played around with T2D's tilemap system, so I have no idea how it performs. But, even there, I would imagine that it's performance (or any lack thereof) would come more from its treating tiles as first-class objects than from the time it takes to rasterize them.
Plus, you have the fact that many 2D games don't tend to take DXT compression very well. By that, I mean that hand-drawn images tend to get non-trivially damaged by DXT compression. The compression itself was designed to work best with images that have lots of color (preferably large ones). Hand-drawn, SNES-style sprites tend to have only a few specific colors on them, as they aren't really going for a photorealistic look. Plus, smaller sprites (32x32), even with more photorealisitc color use (possibly prerendered), still will have problems at the edges of the sprites, as the DXT compression can't help very much with edges.
It's just not the most appropriate compression scheme for 2D games.