Compression (Source 1): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Texture Compression: ATI1N is also useful for spec masks)
(→‎Map Compression: write out section)
Line 18: Line 18:


== Map Compression ==
== Map Compression ==
* [[BSPZIP]]
In some engine branches, such as {{src13mp|4}}, [[.bsp (Source)|BSP files]] can be [[Wikipedia:Lossless compression|losslessly compressed]] using a [[BSPZIP#Compression|BSPZIP]] command. There is usually no disadvantage to doing this, although some caveats are listed on the BSPZIP page.


== Dedicated Server [[FastDL]] Compression ==
== Dedicated Server [[FastDL]] Compression ==

Revision as of 17:38, 17 May 2023

Describe importance of compression here

Texture Compression

Textures are one of the biggest potential sources of file size bloat. Additionally, higher quality textures can result in increased VRAM usage, which will increase a game or mod's minimum GPU requirements.

  • Most textures should use DXT1 or DXT5 (depending on if they have an alpha channel). While older DXTn compressors introduced a green tint to textures, the modern compressors used in VTFEdit Reloaded and Vtex2 can reliably compress to these formats without noticeable color shift.
  • If an opaque texture is low-res enough that DXT1 compression artefacts are problematic, consider using 16-bit BGR565 instead of 24-bit BGR888. The quality difference may
  • Formats with more than 8 bits per channel should be reserved for HDR skyboxes and cubemaps only; nobody is going to be able to tell a 48-bit normal map apart from a 24-bit one!

The Strata Source Strata Source, notably used by Portal 2: Community Edition and Momentum Mod, supports some additional texture formats and features:

  • BC7 is much higher quality than DXT1 or DXT5, while maintaining the same GPU footprint as DXT5. This means it can be used where other engine branches would require a BGR565 or BGRA8888 texture.
  • ATI1N is a compressed greyscale format which is half the size of I8. While this is the same size as DXT1, it only has a single greyscale channel, making it superior for greyscale textures like decals using the DecalModulate shader, or specular masks for materials without a normal map.
    Confirm:Make sure the DecalModulate shader actually supports greyscale textures.
  • VTF 7.6 supports deflate compression. While this does not reduce GPU footprint, it can greatly reduce filesize on the user's storage device.

Audio Compression

  • MP3
  • ADPCM
  • Ogg Vorbis?

Map Compression

In some engine branches, such as Source 2013 Multiplayer Source 2013 Multiplayer, BSP files can be losslessly compressed using a BSPZIP command. There is usually no disadvantage to doing this, although some caveats are listed on the BSPZIP page.

Dedicated Server FastDL Compression

Source supports FastDL downloads to be compressed using BZip2 (BZ2). The files will be decompressed by the user client after downloading. It is recommended to compress most loose files that are larger than a couple kilobytes (VTF, WAV, MDL, etc). BSP files should be compressed with BZ2 if not already compressed with BSPZIP. MP3 files are already heavily compressed and do not substantially reduce in size from BZ2 compression; BZ2 compression of MP3s or BSPZIP-compressed BSPs may unnecessarily increase user client load times with negligible bandwidth savings.

File System Compression

User-side; last resort

  • NTFS compression
  • BTRFS compression