![]() |
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure |
#include <StelToneReproducer.hpp>
Public Member Functions | |
StelToneReproducer () | |
virtual | ~StelToneReproducer () |
void | setDisplayAdaptationLuminance (float displayAdaptationLuminance) |
void | setWorldAdaptationLuminance (float worldAdaptationLuminance) |
float | getWorldAdaptationLuminance () const |
void | setInputScale (float scale=1.f) |
float | getInputScale () const |
void | setMaxDisplayLuminance (float maxdL) |
float | getDisplayGamma () const |
void | setDisplayGamma (float gamma) |
float | adaptLuminance (float worldLuminance) const |
float | reverseAdaptLuminance (float displayLuminance) const |
float | adaptLuminanceScaled (float worldLuminance) const |
float | reverseAdaptLuminanceScaled (float displayLuminance) const |
float | adaptLuminanceScaledLn (float lnWorldLuminance, float pFact=0.5f) const |
void | xyYToRGB (float *xyY) const |
void | getShadersParams (float &a, float &b, float &c) const |
The aim is to get on the screen something which is perceptualy accurate, ie. to compress high dynamic range luminance to CRT display range. The class perform mainly a fast implementation of the algorithm from the paper [1], with more accurate values from [2]. The blue shift formula is taken from [3] and combined with the Scotopic vision formula from [4].
Important : you may call setDisplayAdaptationLuminance() and setWorldAdaptationLuminance() before any call to xyYToRGB() or adaptLuminance otherwise the default values will be used. (they are appropriate for a daylight sky luminance)
REFERENCES : Thanks to all the authors of the following papers I used for providing their work freely online.
[1] "Tone Reproduction for Realistic Images", Tumblin and Rushmeier, IEEE Computer Graphics & Application, November 1993
[2] "Tone Reproduction and Physically Based Spectral Rendering", Devlin, Chalmers, Wilkie and Purgathofer in EUROGRAPHICS 2002
[3] "Night Rendering", H. Wann Jensen, S. Premoze, P. Shirley, W.B. Thompson, J.A. Ferwerda, M.M. Stark
[4] "A Visibility Matching Tone Reproduction Operator for High Dynamic Range Scenes", G.W. Larson, H. Rushmeier, C. Piatko
StelToneReproducer::StelToneReproducer | ( | ) |
Constructor.
virtual StelToneReproducer::~StelToneReproducer | ( | ) | [virtual] |
Desctructor.
void StelToneReproducer::setDisplayAdaptationLuminance | ( | float | displayAdaptationLuminance | ) |
Set the eye adaptation luminance for the display (and precompute what can be) Usual luminance range is 1-100 cd/m^2 for a CRT screen.
displayAdaptationLuminance | the new display luminance in cd/m^2. The initial default value is 50 cd/m^2 |
void StelToneReproducer::setWorldAdaptationLuminance | ( | float | worldAdaptationLuminance | ) |
Set the eye adaptation luminance for the world (and precompute what can be).
worldAdaptationLuminance | the new world luminance in cd/m^2. The initial default value is 40000 cd/m^2 for Skylight Star Light : 0.001 cd/m^2 Moon Light : 0.1 cd/m^2 Indoor Lighting : 100 cd/m^2 Sun Light : 100000 cd/m^2 |
float StelToneReproducer::getWorldAdaptationLuminance | ( | ) | const [inline] |
Get the eye adaptation luminance for the world.
void StelToneReproducer::setInputScale | ( | float | scale = 1.f |
) |
Set the global scale applied to input lumiances, i.e before the adaptation It is the parameter to modify to simulate aperture*exposition time.
scale | the global input scale |
float StelToneReproducer::getInputScale | ( | ) | const [inline] |
Get the global scale applied to input lumiances, i.e before the adaptation.
void StelToneReproducer::setMaxDisplayLuminance | ( | float | maxdL | ) | [inline] |
Set the maximum luminance of the display (CRT, screen etc.
.) This value is used to scale the RGB range
maxdL | the maximum lumiance in cd/m^2. Initial default value is 120 cd/m^2 |
float StelToneReproducer::getDisplayGamma | ( | ) | const [inline] |
Get the display gamma.
void StelToneReproducer::setDisplayGamma | ( | float | gamma | ) | [inline] |
Set the display gamma.
gamma | the gamma. Initial default value is 2.2222 |
float StelToneReproducer::adaptLuminance | ( | float | worldLuminance | ) | const [inline] |
Return adapted luminance from world to display.
worldLuminance | the world luminance to convert in cd/m^2 |
float StelToneReproducer::reverseAdaptLuminance | ( | float | displayLuminance | ) | const [inline] |
Return adapted luminance from display to world.
displayLuminance | the display luminance to convert in cd/m^2 |
float StelToneReproducer::adaptLuminanceScaled | ( | float | worldLuminance | ) | const [inline] |
Return adapted luminance from world to display with 1 corresponding to full display white.
worldLuminance | the world luminance to convert in cd/m^2 |
float StelToneReproducer::reverseAdaptLuminanceScaled | ( | float | displayLuminance | ) | const [inline] |
Return adapted luminance from display to world with 1 corresponding to full display white.
displayLuminance | the display luminance with 1 corresponding to full display white. The value can be more than 1 when saturation.. |
float StelToneReproducer::adaptLuminanceScaledLn | ( | float | lnWorldLuminance, | |
float | pFact = 0.5f | |||
) | const [inline] |
Return adapted ln(luminance) from world to display with 1 corresponding to full display white.
lnWorldLuminance | the world luminance to convert in ln(cd/m^2) | |
pFact | the power at whihc the result should be set. The default is 0.5 and therefore return the square root of the adapted luminance |
void StelToneReproducer::xyYToRGB | ( | float * | xyY | ) | const |
Convert from xyY color system to RGB.
The first two components x and y indicate the "color", the Y is luminance in cd/m^2.
xyY | an array of 3 floats which are replaced by the converted RGB values |