LuxRender Tone mapping - LuxRender Wiki

LuxRender Tone mapping

Personal tools

From LuxRender Wiki

Jump to: navigation, search

While rendering, LuxRender calculates the brightness of the image using physical values. Typically, the contrast between the brightest and the darkest areas of the rendering is bigger than a computer screen or print can display. Therefore, the calculated values somehow need to be converted to coloured pixels. This is exactly what tone mapping does.

In LuxRender, tone mapping settings can be adjusted in real time while rendering.

tone mapping options in LuxRender's interface


Contents

tone mapping kernels

maximum to white (max white)

The "maximum to white" tone mapping process is the most simple tone mapping process available: it will check for the brightest pixel in the image and consider this white. All other pixels are scaled relative to this pixel.

This process works well on images with limited contrast, but if the view contains a very bright object, the rest of the image will appear too dark.


contrast

The "contrast" tone mapping process maps visible differences in calculated luminance into visible contrast in the resulting image. Just like the "maximum to white" tone mapper, this process is applied to the image as a whole. Therefore, this process will be less successful if the brightness varies a lot on different parts of the image.

The "world adaption luminance" value (Ywa) controls the overall brightness of the final image.


Reinhard/non linear

The Reinhard tonemapper was developed by Erik Reinhard, Mike Stark, Peter Shirley, and James Ferwerda. This algorithm is designed to adapt the high dynamic range of the real world to print or screen. In simple terms it balances the light and dark areas of an image and compresses them to fit the dynamic range of the media in question. This is based on a photographic process called the zone system, developed by Ansel Adams, which is explained in detail in the pdf file on the site listed above. Essentially the bright parts of the image are darkened and the darker parts of the image are brightened until a balance is achieved. In photography this is accomplished using various zones of luminance, which are burned or dodged as needed. The Reinhard tonemapper can do this on a pixel by pixel basis.

Examples:

Image:Reinhard_demo_Linear.png Two balanced light sources using the linear tonemapper with the following settings.



Sensitivity = 100
Exposure = 0.0625
F/stop = 2.8
Gamma = 1.0

Image:Reinhard_demo_Linear_10x_shelf_light.png Two light sources, shelf light at 10x gain, using the linear tonemapper with the following settings.



Sensitivity = 100
Exposure = 0.0625
F/stop = 2.8
Gamma = 1.0

Image:Reinhard_demo_default.png Two balanced light sources. Reinhard tonemapper using default settings.



Prescale = 1.0
Postscale = 1.2
Burn = 6.0

Image:Reinhard_demo_Reinhard_10x_shelf_light.png Two light sources, shelf light at 10x gain, using the Reinhard tonemapper with the following settings.



Prescale = 1.0
Postscale = 1.2
Burn = 6.0

Note how the highlight from the other light source on the teapot is muted to compensate for the
overly bright shelf light while using the default settings.

The "prescale" setting is applied before tonemapping. This setting scales the histogram to the left or darker side. Once it reaches a certain point it begins to compress the histogram to the middle of the overall range, which can affect the contrast of the scene, i.e. a setting of 8.0 compresses the histogram a lot which produces a very gray and washed out image. Prescale is connected to the "burn" setting. One affects the other.

The "postscale" setting is applied after tonemapping. This setting is separate from the other two and it controls the brightness of the scene by scaling the histogram up or down (sliding the histogram to the right or left), ex. a setting of 8 yields a white and over exposed scene, and a setting of 0.1 produces a very dark and under exposed scene.

The "burn" setting affects the relative brightness of dark vs. light tones in the scene. It does this by scaling the histogram down (sliding the histogram to the left). However, unlike "postscale" when the histogram reaches the same point where the histogram begins to compress it compresses toward the darker side of the histogram instead of to the middle.

Now the "prescale" and "burn" settings are connected they work together. Use the "postscale" setting to slide the histogram to sit between the two LDR range lines in the histogram window. Then adjust both the "prescale" and "burn" settings to have a good amount of histogram compression so as to fit the HDR information in to the LDR range.

So in a nutshell: Turning up prescale compresses the histogram mostly from the left, and slides it somewhat to the right. Burn does just the opposite, scrunching mostly from the right and sliding left. Postscale simply slides left/right without scrunching it.

linear

The linear tonemapper settings are based on real camera and film settings. Between Reinhard and linear, the linear tonemapper is the more realistic of the two. While Reinhard will automatically balance the light in the scene it's not very realistic.

The "linear_sensitivity" setting is directly related to the ISO setting or film speed of photographic film. Film speed is the measure of a photographic film's sensitivity to light. The values for "linear_sensitivity" directly correlate to film ISO settings. With relation to film speed, ISO 25 film is very slow due to it's low sensitivity to light and will require higher exposure times, where as a faster/more sensitive ISO 800 film will require a much shorter exposure time.

The "linear_exposure" setting is directly related to camera shutter speed, how long the shutter is open exposing the film to light. The shorter the exposure time the higher the film ISO needed. As an example consider the Sunny 16 rule. This rule states that on a sunny day you can use ISO 100 film with an f/stop of 16 (f/16) and an exposure time of 1/100th of a second or the reciprocal if the ISO speed (ISO 400 and 1/400th of a second). The acutal setting in the luxrender scene file (lxs file) is a decimal representation of the shutter speed. ex. To set a shutter speed of 1/125th of a second you would divide 1 by 125 which equals 0.008.

The "linear_fstop" setting is directly related to the f/stop setting of a camera. The f/stop, or F-number of a camera is an expression of the aperture width and the focal length. Quoted from the wikipedia article. "In simpler terms, the f-number is the focal length divided by the "effective" aperture diameter." The smaller the f-number the wider the aperature, and the more light is transmitted to the film. The actual setting in the luxrender scene file (lxs file) is the same as the f/stop number. ex. f/2.8 is equal to 2.8, f/16 is equal to 16.0.

The "linear_gamma" setting adjusts the gamma of the rendered image. The following is taken from a conversation on the forums about HDR environment maps.

"Hi,

If you want to have photographic controls, use the linear tonemapper instead of Reinhard. If your map isn't gamma compensated, leave the gamma value to 1, otherwise use the corresponding gamma, and if it is correctly calibrated, leave the gain to 1.

Jeanphi"

So, to sum up, if your HDR map has a gamma correction of 1.5 then change that value to 1.5 so it matches your HDR map.

colour space

gamma

histogram

The histogram is a tool to analyse the result of tone mapping. It schematically displays how bright pixels in the tone mapped image are.

The histogram is divided in three parts by two vertical lines. On the bottom of the graph, there is a gradient going from black (on the left) to white (on the right). The vertical height of the graph indicates how many pixels will have a brightness corresponding to the brightness of the gradient.

Any value that is on the left side of the first dividing line will show completely black in the output image. Any value on the right of the second dividing line will be completely white. Typically, to get a properly exposed image most of the graph should be located between the two lines.

NOTE: It's not "wrong" to have part of the image outside the two lines. If you have one extremely bright object, like a light bulb, it might look oddly dim unless it's clipped out.