Structure RealPixel
See Also: Class Color.
struct RealPixel
Description:
This structure describes color in terms of r, g, b, e.
This is taken from GraphicsGems II, "Real Pixels" by Greg Ward of Lawrence Berkeley Laboratory. What it means is this: "e" is the base 2 exponent of the maximum RGB component, and r,g,b are the mantissas of R,G,and B, relative to this exponent. It essentially compresses the essential data of a floating point color into 32 bits.
Quoting from Graphics Gems II:
"It appears that this format favors the largest primary value at the expense of accuracy in the other two primaries. This is true, but it also is true that the largest value dominates the displayed
pixel color so that the other primaries become less noticeable"
One GBuffer option is to write out the image in RealPixel format, storing NON CLAMPED colors. This could be used by a Video Post process to detect those areas of the image where the intensity goes beyond 1 and apply halo and flare effects much more realistically.
There are functions for converting between floating point and RealPixel format:
RealPixel MakeRealPixel(float r, float g, float b);
ExpandRealPixel(RealPixel &rp, float& r, float &g, float& b);
as well as methods in RealPixel and Color.
Structure Data:
unsigned char e;
The base 2 exponent of the maximum RGB component.
unsigned char r,g,b;
The mantissas of R,G,and B, relative to this exponent.
Operators:
Prototype:
operator Color();
Remarks:
Converts the RealPixel format to the Color format.