G3D::ToneMap Class ReferenceApplies gamma correction and bloom.
More...
#include <ToneMap.h>
Inherits G3D::ReferenceCountedObject.
List of all members.
Detailed Description
Applies gamma correction and bloom.
GApp subclasses have a built-in ToneMap named GApp::toneMap.
In the real world, the shadow under a car is about 1,000,000 times darker than the specular highlight off its hood. Most computer displays can only represent a dynamic range of 255 values (eight bits) per color channel, so bright areas are blown out and all detail is lost in dark areas. This is the dynamic range problem of displays.
Furthermore, displays were designed for 2D rendering where rgb=128 should appear half as bright as rgb=255. In contrast, 3D rendering simulates light, so rgb=128 should have half as much energy as rgb=255, which does not correspond to the perception of half as bright. This is the gamma ramp problem.
There are many sophisticated algorithms for altering a rendered image to correct both of these. This ToneMap class uses an algorithm that is not the most sophisticated, but is extremely fast and produces attractive results. It alters the lights in a scene to conserve dynamic range and then post-processes an image to make overexposed areas "glow" and correct the gamma ramp for all other areas. The resulting images have more detail in dark areas and appear more realistic than unprocessed ones.
Use Example:
void onGraphics(RenderDevice* rd) {
LightingRef lighting = toneMap.prepareLighting(app->lighting);
SkyParameters skyParameters = toneMap.prepareSkyParameters(app->skyParameters);
toneMap.beginFrame(rd);
rendering code ...
toneMap.endFrame(rd);
}
Member Function Documentation
Call before rendering anything (including clearing the screen.
| static ToneMapRef G3D::ToneMap::create |
( |
|
) |
[inline, static] |
| bool G3D::ToneMap::enabled |
( |
|
) |
const [inline] |
Call after rendering the rest of the scene to apply tone mapping.
Call before rendering the scene to create a tone-mapping compatible lighting environment.
Guaranteed to return a new lighting environment that is safe to further mutate.
If you created the lighting from SkyParameters that was itself prepared, do not call this method or the lights will be too dark.
Call before rendering the scene to create a tone-mapping compatible lighting environment.
| void G3D::ReferenceCountedObject::ReferenceCountedObject_zeroWeakPointers |
( |
|
) |
[inline, inherited] |
Automatically called immediately before the object is deleted.
This is not called from the destructor because it needs to be invoked before the subclass destructor.
| void G3D::ToneMap::setEnabled |
( |
bool |
e |
) |
|
Member Data Documentation
The long name is to keep this from accidentally conflicting with a subclass's variable name.
Do not use or explicitly manipulate this value--its type may change in the future and is not part of the supported API.
Linked list of all weak pointers that reference this (some may be on the stack!).
Do not use or explicitly manipulate this value.
The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:48 2007 for G3D by
1.5.2
Hosted by
|