Lightmap Compression

(This is going to be a short post)

If you’re compiling both HDR and LDR (-both) in your map files, the raw BSP size is going to be significantly (2x~) bigger:

Which for raw-unpacked map files is obviously not great.  Luckily we’re in an age where storage space is abundantly cheap for files this small.  However what isn’t cheap or quite abundant yet, is bandwidth…



Conveniently enough, we have compression technology that we can use when transferring files.  The nice thing about HDR and LDR is that they’re almost the same data, so using a modern compression algorithm we should see this reflected:

And sure enough we do!  This means that unless you’re concerned about the actual at-rest filesize, HDR + LDR is effectively free.  Thankfully the Garry’s Mod workshop uses some form of LZMA/XZ for its compression, and so we can get extremely compressed files on the workshop:



All of this is great, but there is some bad news…
The algorithm Source uses for its FastDL system (.bz2) doesn’t fare as well:

We’re still cutting the file-size roughly in half, but not nearly as good as the 77% reduction LZMA/XZ get.


In conclusion:

For the Gmod Workshop, and anywhere you can get a .7z/.xz/LZMA compressed file, HDR+LDR is free, but if your major means of distribution is FastDL and you’re really counting your bits, then you may need to forego HDR+LDR.

Which one you drop is up to you, both HDR and LDR produce virtually the same filesize, so it just depends on what platform you want to target, and fallback.  Source will fallback to LDR on a map that doesn’t have HDR (but LDR), but it will not fall forward for LDR users, only providing them with a fullbright version of your map.  LDR is generally the best bet here because of that.

Another thing I haven’t experimented with, but may be an option, is the BSP Repack feature built into the Valve tool bspzip.



bspzip compression

Tested TF2’s bspzip tool for repacking with compression:

It works somewhere in-between LZMA/XZ and BZ2, and has the benefit of working at-rest.

However, maps that are repacked only work for TF2 and GMod, trying to load them in other branches will cause a crash.

Bookmark the permalink.

One Comment

  1. Sidenote…
    Either plan on repacking, or zipping (For the workshop), since you aren’t going to get anything smaller from zipping the repacked map.

Comments are closed