PNG -> DDS = better framerates?

Blitz3D Forums/Blitz3D Programming/PNG -> DDS = better framerates?

MadJack(Posted 2007) [#1]
My game typically uses 256x256 PNG textures, perhaps 25+ per level (including tanks/bullets etc..) and one or two 1024x1024 PNG lightmaps - it's not overly texture heavy, but I'd like to get better rendertimes.

My question is; have people found converting to dds gives better rendertimes?


Mustang(Posted 2007) [#2]
IMO .DDS doesn't give you any speed advantage, it just takes less VRAM. Because it's packed, decoding takes time... other formats are not packed (in VRAM) so .DDS actually may take more time. Of course HW does that decoding and the way .DDS are packed I think that in the end .DDS vs Others are just as fast. But IMO definitely .DDSs are not faster?


t3K|Mac(Posted 2007) [#3]
i think its faster (but only on older machines). uploading times to vram is shorter and if your game exceeds the amount of available vram, stuttering will be less, cause less data has to be copied from ram to vram. at least you are able to run your game on lower end graphics cards with low vram available (not too low end of course). i'd go for dds - take your 256 textures, make them 512, use dds and voila: your game looks even better and uses the same or less amount of ram. just my 2 cents.


Gabriel(Posted 2007) [#4]
If you're putting more textures in VRam than the card has VRam in which to put them then you'd be better off fixing that problem than optimizing the bad effect it has. Any time you're sending textures across the AGP pipe in realtime you're getting a massive slowdown that you really don't need.


MadJack(Posted 2007) [#5]
Thanks for the replies all.

Ok, so it seems that DDS is not intrinsically faster - except where VRAM usage is high/excessive. At this point I'll probably stick with PNG as I have a feeling I could do a lot of work converting everything to DDS and not getting much of a speed inc.


jfk EO-11110(Posted 2007) [#6]
Loading speed is better. The time ratio may be compared with the filesize ratio.

Distro ZIP Filesize will be much smaller. A good reason to use it. And masked DDS is looking much better than masked bmp,png etc.

Some people enthousiasticly reported faster rendering with DDS, but it was always some kind of "is it only me, or does this run faster??".

It won't take you much time if you write a little patching tool that will replace the texture paths in mesh files, corresponding to the dds files found in a certain folder, eg:
If texturepath found in mesh = mypic.bmp
And if file exists: mypic.dds
then patch texturepath in mesh.

BTW: DirectX will not fill Vram as much as it gets, but only with the stuff that is within the inital camera range. To prevent jerkish vram-upload pauses you should "render all" before the game starts, using a camera that can "see everything".


MadJack(Posted 2007) [#7]
Good tips - thanks


JoshK(Posted 2007) [#8]
DDS is always faster. It takes less time to upload the texture data to the video card.


Gabriel(Posted 2007) [#9]
Was there ever a clear answer on whether or not B3D loads MipMaps from DDS textures or if it still auto-generates it's own?


OJay(Posted 2007) [#10]
versions.txt in blitz root folder:
...
The mipmap flag is ignored when loading DDS textures. Instead, if the DDS file contains mipmaps, then they are
loaded & used.
...


Gosh!


Gabriel(Posted 2007) [#11]
Neat. That's a nice advantage. Thanks.


jfk EO-11110(Posted 2007) [#12]
Here's another thing that makes my heart jump like a monkey:

I just added a grass engine to my project. When a grass texture cannot be found, a substitute will be created at runtime, using createtexture. What should I say. From exactly the same angle, the same picture, with a lot of grass all over, gives me 9.3 frames with the created texture (flags:2+32), and 18.5 fps with the loaded alpha-masked dds texture! Since there are more meshes in the scene (grass is about 50% of the rendered tris) I guess the advantage is not only 100% but even more!

It's unbelievable and it feels good!

Still have to do some test, to make sure it's not only a daydream.

Other than that, I think I got to correct my prev. statement, DDS surprisingly really renders a lot faster. At least Alpha masked ones.

PS: How comes none knew about that.


MadJack(Posted 2007) [#13]
Sounds all good then! I understand the next version of Giles will have native support for DDS as well.


Vorderman(Posted 2007) [#14]
Using the DDS mipmaps certainly gives more control and a sharper image - I've managed to eliminate the seam down the centre of the SRX roads by converting my road texture to DDS and using only 5 levels of mipmapping.

Also using alpha-masked DDS textures on the fences and girders gives a much nicer distance fade effect whereas normal masked textures just flicker. Wish I'd known about DDS textures before.


t3K|Mac(Posted 2007) [#15]
in four words: we all love dds ;)


jfk EO-11110(Posted 2007) [#16]
I have to agree with you Vorderman. Maybe the higher speed of alpha masked dds is due to the mipmapping - probably normal alpha textures are flickering in the distance because they don't use Mipmapping at all?

I am currently using a trick provided by Fredborg if I recall correctly: before exporting the alpha masked texture as DDS I clone the texture as a new layer, then I gaussian blur it and set its transparency to 1%, this prevents the fade-to-white outlines artefacts seen with masked and alpha dds.

So once again: Thanks to Tom for the DDS module, and thanks to Mark for adding it to the runtime dll.


Vorderman(Posted 2007) [#17]
The problem I had with normal masked textures was that the mipmapping very quickly removed fine lines and so the entire texture became transparent, meaning items with thin lines (such as girders and fences) disappear very close in front of the camera. Turning mipmapping off just makes a flickery mess.

With an alpha masked DDS the effect is excellent - smoothly alphaed and it fades nicely as the camera moves away.