This library provides wgpu-rs compute shaders for compressing rgba floating-point textures into BC6H compressed textures, reducing their size by 16x. These shaders were adapted from the ones provided by GPURealTimeBC6H.
For more information, see the presentation Real-Time BC6H Compression on GPU.
For a slower but higher quality offline BC6H compression library, I hightly recommend intel-tex-rs-2
.
For a example, run:
cargo run --example compress_dds examples/lightmap.dds examples/compressed.dds
This will take an existing Rgba32Float
DirectDraw Surface file and compress
it into a Bc6hRgbUFloat
texture. Both files can be opened just by dragging
them into RenderDoc.
- Requires no
wgpu::Features
, not evenwgpu::Features::TEXTURE_COMPRESSION_BC
if you simply copy the buffer to a file as in the example. - Can use push constants instead of allocating a uniform buffer with the
push_constant
feature. - Can compress 2D and 3D textures.
- The shaders are designed with unsigned floating point values in mind, so
Bc6hRgbUFloat
textures are supported but not signedBc6hRgbSFloat
ones.