DDS format ObjectLightMaps = performance boost...

For info on the site, community and 'battlefieldy' things
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

I have converted the lightmaps for my DC Sea Rigs map to DDS format instead of TGA files. Firstly most of the lightmaps are large. 512x512. And the interior lightmaps are 1024x1024. There was noticeable frame rate drops when I would pan the camera around the map whenever the rig comes across my view. This would be worse on slower machines.

So rather then redoing some of the lightmaps at smaller sizes, I decided to convert them all to DDS format using DXT3 compression. And after I tested it, it was actually faster. The file size of the DDS files are slightly larger then the TGAs before it. (TGAs were 60 or so MB combined while the DDS files were 80 or so MB combined). But the RFA packed better and the map has a smaller file size.

My theory is that either mipmaps capability with lighthmaps makes the game run better or the game simply caches the DDS in memory better then the TGAs. So I would encourage someone to do a map with a lot of large lightmaps to try converting them all to DDS. You should see a performance boost from it if you had lag before. :D

Also note. nvDXT/DDS Converter 2 can't convert the lightmaps to DDS as is, since it doesn't seem to support converting 8-bit grayscale TGAs to DDS. So you will need to run them through a batch converter like "Advanced Batch Converter" which supports TGAs. Even if you don't tell the converter to do any changes to the output files they still come out in RGB. So then you could convert them to DDS.

A couple things to expect from DDS format lightmaps:

1. DDS files are in color. So that means you can have colored lightsources and stuff in your lightmaps instead of being confined to the pallete file.

2. There's a chance the pallete.pal file has no effect on DDS lightmaps. You might not need this file in this case.

If anyone else has tried this, post your results. In theory you can make crazy large lightmaps (like 2048x2048 for example) and expect it to still run good if it's in DDS format. ;)
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: DDS format ObjectLightMaps = performance boost...

Post by fo0k »

not tried but this does sound very cool.. I think 8192x8192 did work when i tested it on a huge building. Although this was on very high spec so just a test really.. however it does sound like dds will handle it better. but aren't they the same size when in memory? I realise dds is smaller file size but once loaded into the engine its all raw..? maybe not.

Also, if you generate lightmaps in 3dmax the tga's are colour too..
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Senshi »

So...is it confirmed yet that converting to dds allows to color-light them? And it's used by the game? I'm currently sitting on a new map (Shanghai Nights) which would be an excellent candidate for that, as it definetly requires some fancy lighting.

Also, I think I recall you made a tutorial on lighting in 3dsmax to simulate indoor light sources? Can you point me to that, as I'm unable to find it and I'd like to have some lights running inside the factory buildings and street lamps. I think it will add greatly to the immersion.
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: DDS format ObjectLightMaps = performance boost...

Post by fo0k »

I mentioned above.. colour lightmaps are possible with tga already.. I realised this when trying to lightmap my castle with yellow candles... the spots on the lightmap near the yellow lights came up yellow :)
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

Yes color TGAs are just as good, though I recall there could be CTD issues with certain video cards on certain machines. But this was related to BF2 perhaps and maybe not so much with this game.

If lag is a concern, DDS is suitable. However if you just want to add color to your lightmaps, color TGAs work just as well.

A high end rig with good video card probably wont' notice much difference, but my machine is what I would consider mid range. The video card has only 256mb of ram compared to the 512mb on average for most high end machines. I also don't have a dual core system.

I'm sure they take up the same memory ram. But as I mentioned earlier, I believe the game simply caches DDS faster or is simply better optimized for them. I tested and noticed that when I lowered texture quality settings in the video options, the lightmaps came down in quality the same amount as the normal textures. I don't fully understand what mipmaps are used for, but I think they are used on lower quality settings and also at a distance as well. TGAs are the same size in all situations since they do not have mipmaps.
ImageImageImage
I have cameras in your head!
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: DDS format ObjectLightMaps = performance boost...

Post by fo0k »

thats a very good point about mipmaps and tgas! thats certainly where the improvement lies with using dds for sure.
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Senshi »

You got the mipmap stuff exactly right. That's the whole beauty of them: While having mipmaps generated for a texture requires slightly more filespace and stored all in the same .dds file, the game engine is able to treat them individually, meaning that smaller mipmaps are automatically used as the object moves away from the player, causing a smaller memory load overall. It's pretty much the same as LoDs in BF42, but texture-only. Was a fantastic development back when BF was released, as it helped perfomance a lot with absolutely minimal visual losses. That's also the reason why BF42 eats .dds and .tgas, dds was implemented along the path in a cooperation project with nVidia, and it was definetly a wise choice! Initial plans were to use .tga exclusively...
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: DDS format ObjectLightMaps = performance boost...

Post by fo0k »

interesting that dds was not used for lightmaps though.. I wonder if it was purely an oversight or a considered decision due to some unknown bug..
User avatar
Senshi
Posts: 697
Joined: Sun Oct 18, 2009 1:14 pm
Location: Germany
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Senshi »

Yes, IIRC there is quite some mixture of tga and dds throughout the game files. And in some cases dds still seems to be no-no (e.g. loading screens).
User avatar
Apache Thunder
Posts: 1210
Joined: Mon Oct 19, 2009 2:48 am
Location: Levelland Texas, USA
Contact:

Re: DDS format ObjectLightMaps = performance boost...

Post by Apache Thunder »

DDS loading screens? I have gotten that to work once. But only with mipmaps off and at the correct res for a DDS file. (the game just resizes it to fit the screen I think) BFV uses DDS load screens I think...
ImageImageImage
I have cameras in your head!
Post Reply