RadianceHDRLoader
Loader for Radiance RGBE .hdr textures.
See also: Radiance HDR
| Loader | Characteristic |
|---|---|
| File Format | Radiance HDR / RGBE |
| File Extension | .hdr |
| File Type | Binary |
| Data Format | Texture |
| Supported APIs | load, parse, parseSync |
Usage​
import {RadianceHDRLoader} from '@loaders.gl/textures';
import {load} from '@loaders.gl/core';
const texture = await load(url, RadianceHDRLoader);
const level = texture.data[0];
console.log(texture.type, level.width, level.height);
console.log(texture.format, level.format);
console.log(level.data instanceof Float32Array);
console.log(texture.metadata?.exposure);
Data Format​
Returns a Texture with shape: 'texture', type: '2d', and one decoded level in data.
The returned texture includes:
shape: 'texture'type: '2d'format: 'rgba32float'data: TextureLevel[]metadata?: RadianceHDRMetadata
Metadata​
When present in the file, RadianceHDRLoader exposes application-facing header metadata on texture.metadata.
type RadianceHDRMetadata = {
colorCorrection?: [number, number, number];
exposure?: number;
gamma?: number;
pixelAspectRatio?: number;
primaries?: [number, number, number, number, number, number, number, number];
software?: string;
view?: string;
};
The loader does not expose internal parsing fields such as normalized scanline orientation or format markers in metadata.
The returned level includes:
shape: 'texture-level'compressed: falseformat: GL_RGBA32FtextureFormat: 'rgba32float'widthheightdata: Float32ArraylevelSize
Options​
| Option | Type | Default | Description |
|---|---|---|---|
| N/A |
Notes​
- File format background:
Radiance HDR RadianceHDRLoaderdecodes standard 2D Radiance RGBE files only.- The alpha channel is synthesized as
1.0for every pixel.