Crate rgbe

Source
Expand description

A library for loading and handling RGBE-format HDR textures.

Provides types for handling common-exponent floating point texture formats as well as conversions between them and independent floating-point channels. Supports the RGBE8 format which is storable in Radiance HDR and PNG files, as well as the RGB9E5 GPU texture format.

An intended use case for this library is to store HDR textures as RGBE8 PNG files and convert them to RGB9E5 for the GPU when loading.

Radiance HDR images can be converted to RGBE8 PNG files on the command line using the included hdr2rgbe-png tool.

Structs§

RGB9E5
Aligned epresentation of rgb9e5ufloat texel. Field order (from LSB to MSB) is 9 bits each of subnormal R, G, and B mantissa then 5 bits of a common exponent.
RGBA16F
Aligned representation of rgba16float texel. This is a common render format for HDR images when creating or processing assets before conversion to a GPU-read-only RGBE format.
RGBE8
Aligned representation of Radiance RGBE8 pixel. r, g, and b are subnormal mantissas and e (taking the place of the alpha channel) is a common exponent. This is commonly loaded from Radiance pictures (.hdr).

Functions§

decode_radiance
Reads the data from an HdrDecoder as a slice of RGBE8 texels.
decode_radiance_as_rgb9e5
Reads the and converts data from an HdrDecoder as a slice of RGB9E5 texels.
decode_rgbe8_png
Reads the data from an PngDecoder as a slice of RGBE8 texels.
decode_rgbe8_png_as_rgb9e5
Reads the and converts data from an PngDecoder as a slice of RGB9E5 texels.
encode_rgbe8_png
Encodes RGBE8 texel data into RGBA8 PNG format, storing the exponent in the alpha channel.
load_radiance_file
Loads a radiance file, returning the dimensions and a slice of RGBE8 texel data.
load_rgbe8_png_file
Loads an RGBE8-format PNG file, returning the dimensions and a slice of the pixel data.
load_rgbe8_png_file_as_rgb9e5
Loads an RGBE8-format PNG file, returning the dimensions and a slice of the pixel data converted to RGB9E5 format. This is intended for loading HDR textures to use on the GPU.
save_rgbe8_png_file
Saves RGBE8 texel data into RGBA8 PNG file, storing the exponent in the alpha channel. This package also exports a command-line tool (hdr2rgbe-png) for converting Radiance HDR images to RGBE8-PNG.