Converting Radiance HDR to Float RGB

The Radiance HDR format is defined as 8-bit R, G, B + 8-bit exponent. There is no 16-bit or float variant of it, but you can convert the individual 8-bit components into float RGB instead. Here’s the code:

unsigned char hdr_r, hdr_g, hdr_b, hdr_e;

// -- read hdr_r, hdr_g, hdr_b, hdr_e from the image as unsigned chars.

// Convert the 8-bit HDR RGBE components to RGB float.
float r, g, b, e;

e = ldexp( 1.0f, hdr_e - (int)(128+8) );
r = hdr_r * e;
g = hdr_g * e;
b = hdr_b * e;

This page was last modified 20:45, 10 Dec 2010.
This page has been accessed 6737 times.

© Copyright 2009 Autodesk Inc. All Rights Reserved. Privacy Policy | Legal Notices and Trademarks | Report Piracy