Skip to main content

Texture API / HDR loader

Load lighting data without flattening its range.

RadianceHDRLoader reads RGBE .hdr files and returns texture levels with floating-point samples and format metadata. Exposure, tone mapping, and environment use remain decisions for the application or renderer.

HDR decode path

Return texture data; leave display policy to the renderer.

The loader expands RGBE values into a usable texture representation. Applications can then select environment mapping, filtering, exposure, and tone mapping according to the scene.

Detect

Read Radiance HDR headers and scanline-encoded data.

Expand

Decode shared-exponent RGBE pixels.

Return

Expose dimensions, levels, formats, and floating-point data.

Render

Apply application-specific lighting and display policy.

Detailed guide

RadianceHDRLoader reference

The detailed reference covers input detection, decoded texture levels, RGBE values, options, and common rendering uses.

From-v4.4

Loader for Radiance RGBE .hdr textures.

See also: Radiance HDR

RadianceHDRLoader
File FormatRadiance HDR / RGBE
File Extension.hdr
File TypeBinary
Data FormatTexture
Supported APIsload, parse, parseSync

Usage​

import {RadianceHDRLoader} from '@loaders.gl/images/radiance-hdr';
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' From-v4.4
  • compressed: false
  • format: GL_RGBA32F
  • textureFormat: 'rgba32float'
  • width
  • height
  • data: Float32Array
  • levelSize

Options​

OptionTypeDefaultDescription
N/A

Notes​

  • File format background: Radiance HDR
  • RadianceHDRLoader decodes standard 2D Radiance RGBE files only.
  • The alpha channel is synthesized as 1.0 for every pixel.