Public Member Functions | Public Attributes

RealPixel Struct Reference

This reference page is linked to from the following overview topics: High Dynamic Range Bitmaps.


Search for all occurrences

Detailed Description

See also:
Class Color.
Remarks:
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);
and
ExpandRealPixel(RealPixel &rp, float& r, float &g, float& b);
as well as methods in RealPixel and Color.

#include <color.h>

Inheritance diagram for RealPixel:
Inheritance graph
[legend]

List of all members.

Public Member Functions

GEOMEXPORT  operator Color ()

Public Attributes

unsigned char  r
  The mantissas of R,G,and B, relative to this exponent.
unsigned char  g
unsigned char  b
unsigned char  e
  The base 2 exponent of the maximum RGB component.

Member Function Documentation

GEOMEXPORT operator Color ( )
Remarks:
Converts the RealPixel format to the Color format.

Member Data Documentation

unsigned char r

The mantissas of R,G,and B, relative to this exponent.

unsigned char g
unsigned char b
unsigned char e

The base 2 exponent of the maximum RGB component.