Unity stores Lightmaps with different compression and encoding, depending on the target platform and the compression setting in the Lighting Window. See documentation on Texture Types and Global Illumination for details.
The Double Low Dynamic Range (dLDR) format decodes by multiplying by 2 in linear space, and 4.5948 in gamma space (22.2).
The RGBM format decodes like this:
float scale = color.a * Range;
ColorRGBAf converted = ColorRGBAf(color.r * scale, color.g * scale, color.b * scale, 1);
The range of RGBM lightmaps goes from 0 to 34.49 in linear space, and from 0 to 5 in gamma space.
Some platforms store lightmaps as dLDR because their hardware compression produces poor-looking artifacts when using RGBM.
Target Platform | 编码 | Compression |
---|---|---|
Standalone | RGBM | BC3 |
Xbox One | RGBM | BC3 |
PlayStation4 | RGBM | BC3 |
iOS | dLDR | PVRTC_RGBA4 |
tvOS | dLDR | ASTC_RGB_4x4 |
Android* | dLDR | ETC_RGB4 |
Tizen** | dLDR | ETC_RGB4 |
STV | dLDR | ETC_RGB4 |
Nintendo 3ds | dLDR | ETC_RGB4 |
*For Android targets, you can change the default texture compression format from the Build Settings dialog. The formats include: DXT1, PVRTC, ATC, ETC2, ASTC. The default is ETC.
**The Tizen platform target enables you to change the default texture compression format from the Build Settings dialog. The format options are: ATC, ETC2, and ASTC, and ETC (default value). Note: Loading an unsupported texture forces decompression at runtime, causing the texture to be uncompressed. This impacts performance and memory consumption.
The inputs to the GI system have a different range and encoding to the output. Surface Albedo is an 8-bit unsigned integer RGB in gamma space. Emission is a 16-bit floating point RGB in linear space.
To provide custom inputs, use a Meta Pass.
If your graphics hardware supports it, Unity stores the irradiance output texture using the RGB9E5 format. The RGB9E5 format is a shared exponent floating point format with a range of 0 to 65536.
Otherwise, the output texture is stored using the RGBM format, and therefore the range is the same as baked lightmaps using RGBM.
See Khronos.org: EXT_texture_shared_exponent for details on the RGB9E5 format.