Hello, I’ve been told that dds may boost some huge performance improvements in cgfx shaders.
I’ve been using cgfx shaders in Maya for my pipeline for a while, but am not quite pleased with the performance. Currently I make use of tga files as the textures feeding my custom fx shaders. tga are the base image format for our pipe, but we can always convert to them in the end.
I’m thinking of converting the pipeline (at least in Maya) to using dds instead of tga on fx shaders. This is a lot of work, so just thought I’d get some ideas from anyone who may have some experience using dds before, or made any comparisons for using them over other image formats in cgfx shaders?
I experienced some major performance gains in one test case when I switched from tga to dds. I haven’t used this in production - just one particular scene - but the increased performance in the test was well worth the conversion.
I think that the speed-up may have been due more to the fact that the textures were compressed in dds. I don’t think you’d get any performance improvement from uncompressed dds files. Smaller file sizes = less memory bandwidth = better performance. That’s the theory anyway.
I did my test in 3ds Max, so your results in Maya may be different. I’d recommend that you pick a texture-heavy scene, convert all the textures to compressed dds and measure performance gains against the original.
DXT is the compression format commonly used inside DDS files because hardware supports it and its much faster to read than uncompressed 32bit textures.
It may or may not improve performance depending on the content on your scene and which graphics card you are using. How many textures and at what size etc.
We generally keep our data uncompressed because we may decided to compress it in different ways for different platforms and also artists don’t want to do the conversion every time they change a texture.
I have thought about making a proxy system that could replace your textures with “cheaper” versions, but I haven’t got around to trying that.
Max has a bitmap proxy system, but it only works with software materials.
In MAx you can switch between using the render materials instead of dx9 materials, this gives some improvement in speed.
DXT can be UGLY, in that you can get very bad results.
Thanks for the info guys. So if I understand this right, the performance is really from reducing the memory band-width piping to the card on each draw call? This is assuming of course, that the texture-uncompression overhead is negligable and all handled by the card?
I’m not sure how cgfx is implemented in Max, but in Maya they seem horribly cpu-bound. Meaning 10 shader instances shall produce 10x the slowness. Regardless of how they’re assigned to geometry (even if they’re not assigned to geo they’ll compute)! Thus, I’m trying as hard as possible to speed this up as best as I can, using dds shall hopefully help.
Also, I have a strong suspicion that the textures in my shader (currently using tga) are not actually cached and loaded each time the shader evaluates. I’m hoping by using dds, that this forces the shader to not have to keep on re-loading the texture every time.
I think DXT is also faster due to the fact that the textures are swizzled, and modern graphics cards draw batches of pixels in small quads, so the memory and cache coherency are much better. But this is at the extreme performance end of things - the likely speedup will just be the better memory bandwidth.
The biggest speed improvement I’ve seen in Max is to compile the shader with FXC and use assembly instead of HLSL. It was a little cumbersome to maintain, but it did improve the speed. This was back on Spider-man 3. Since then I haven’t needed to do that. Maybe it’s due to improvements in Max’s HLSL support or maybe it’s just because we’re using faster machines these days.