BC Texture Compression Formats
What is BC Texture Compression
BC (Block Compression) is a block-based texture compression technique widely used in DirectX and modern GPUs. It divides the texture into 4x4 pixel blocks, compressing each block independently, thus supporting random access and fast decompression. The BC family includes BC1 through BC7, each designed for different data types, balancing compression ratio and image quality.
Detailed Common BC Formats
- **BC1 (DXT1)**: Used for opaque textures or textures with only 1-bit alpha. Each 4x4 block is 64 bits, compression ratio 8:1 (for RGB textures). Supports RGB and 1-bit alpha, but color precision is lower, may cause color banding.
- **BC2 (DXT3)**: Used for textures with explicit alpha. Each block is 128 bits, compression ratio 4:1. Alpha uses 4 bits per pixel, suitable for sharp alpha edges, but color part is same as BC1.
- **BC3 (DXT5)**: Used for textures with gradient alpha. Each block is 128 bits, compression ratio 4:1. Color part same as BC1, alpha uses BC4 format, providing better alpha smoothness.
- **BC4 (ATI1)**: Single-channel format, storing height maps or roughness, etc. Each block is 64 bits, compression ratio 2:1 (for single channel).
- **BC5 (ATI2)**: Dual-channel format, often used for normal maps (storing X and Y components). Each block is 128 bits, compression ratio 4:1. High quality.
- **BC6H**: Used for HDR textures (RGB half-float). Each block is 128 bits, compression ratio 6:1 (for RGB16F). Supports signed and unsigned modes.
- **BC7**: High-quality RGBA format, each block is 128 bits, compression ratio 4:1. Provides better quality than BC3, especially for complex colors and alpha, but compression is slower.
How to Choose BC Formats
Choosing a BC format depends on texture type and quality requirements:
- **Opaque color maps**: Commonly BC1, or BC7 if quality is high.
- **Color maps with alpha**: Choose BC2 or BC3 based on alpha needs, or BC7 for high quality.
- **Normal maps**: Recommend BC5 (only X and Y are stored, Z is reconstructed in shader) or BC1 (lower quality). Note the format difference between DirectX and OpenGL normal maps.
- **Single-channel data** (like roughness, metallic, AO): Can be packed into BC4 or the alpha channel of BC7.
- **HDR textures**: Use BC6H.
Advantages and Disadvantages of BC Compression
**Advantages**:
- Significantly reduces video memory usage, allowing more textures to reside.
- Lowers texture sampling bandwidth, improving performance.
- Hardware decompression support, no extra computational cost.
**Disadvantages**:
- Lossy compression, may introduce blocky artifacts or banding.
- Quality varies greatly between formats, requiring targeted selection.
- Compression process may be slow (especially BC7), affecting asset import time.
Practical Considerations
- **Normal maps**: When using BC5, ensure the shader reconstructs the Z component from the two channels and normalizes.
- **sRGB**: Color maps are often stored in sRGB format; compression involves color space conversion to ensure correct decoding.
- **Mipmaps**: BC formats support mipmaps; enable them to reduce distant texture shimmering.
- **Platform support**: All modern GPUs support BC1-BC5; BC6H/BC7 supported on newer hardware. Mobile platforms may use different compression standards (e.g., ETC, ASTC).
Summary
BC texture compression is an important tool for optimizing memory and bandwidth in real-time rendering. Understanding the characteristics of different BC formats helps make reasonable choices in projects, balancing quality and performance.
FAQ
What is the difference between BC1 and BC7?
BC1 has a higher compression ratio (8:1) but lower color quality and only 1-bit alpha; BC7 has a compression ratio of 4:1 but offers higher color and alpha quality, suitable for complex textures, though compression is slower.
Which BC format should be used for normal maps?
BC5 is recommended because it stores dual-channel data with high quality and 4:1 compression, suitable for normal map X and Y components. If quality requirements are lower, BC1 can be used.
Do mobile platforms support BC formats?
Most mobile GPUs do not support BC formats; they use ETC, ASTC, etc. Therefore, mobile development should use platform-specific formats or choose universal formats.
Does BC compression cause noticeable quality loss?
It depends on the format and texture content. BC1 may produce color banding on smooth gradients, while BC7 typically provides near-lossless visual quality. Choosing the right format can balance quality.
How to generate BC compressed textures?
You can use tools provided by GPU vendors (such as NVIDIA Texture Tools, AMD Compressonator) or engine import settings to compress automatically. Many image editing software also support exporting BC formats.