LuxRender Tone mapping
From LuxRender Wiki
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 Kernels
The Reinhard tone mapping kernel 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 tone mapping kernel can do this on a pixel by pixel basis.
- This setting controls the brightness of the darker areas (shadows, in image editing lingo) of the image. Increasing it brightens the shadows. Once it reaches a certain point it begins to compress the dynamic range (and thus 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 dynamic range a lot which produces a very gray and washed out image. Prescale is connected to the "burn" setting. One affects the other.
- This setting is separate from the other two and it controls the brightness of the scene by scaling the output image brightness 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.
- This setting affects the brightness of highlights in the image relative to the darker areas. Increasing it dims the highlights. It does this by scaling the image 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.
The "prescale" and "burn" settings are connected; the areas they affect overlap. You can use the the postscale control to get a good, even exposure for your image. The histogram can help here, just check that the main curve is mostly centered between the two white bars. Once you have it centered, you can use the prescale and burn controls to get an acceptable exposure.
The linear tone mapping kernel settings are based on real camera and film settings. This kernel is not brightness-adaptive, so it should be used for animations in order to avoid flickering. This is for the same-reason that you would turn off auto-exposure on a real camera when shooting a properly lit film. Sensitivity, f/stop, and shutter speed are all mathematically interchangeable when determining exposure. It is important to learn to think in "stops" when setting exposure inside the linear tone mapper. One stop is either twice or half as much light.
- Sensitivity (ISO)
- Sensitivity is directly related to the ISO setting or film speed of photographic film. Film speed is the measure of a photographic film's (or digital sensor's) sensitivity to light. The values for 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. ISO or sensitivity stops are easy to remember, they are 25, 50, 100, 200, 400, 800, 1600, etc. Thus, 200 is twice as much light as 100 and 50 is half as much as 100. The linear tone mapping presets in LuxRender are broken into "third-stops", hence 100, 125, 160, 200 etc. Each one of these is one third of one stop. It is important to understand that in LuxRender the sensitivity setting is extraneous because the amount of noise in the final image is determined entirely by the number of samples per pixel. In the real world, photographers shoot at the lowest possible ISO to reduce noise, unless noise is a desired quality for the image.
- The exposure setting is directly related to camera shutter speed or exposure time, which is the amount of time the shutter is open exposing the film to light. The shutter-speed stops are easy to calculate and remember. 1/2 second is going to yield half as much light as 1 second. Likewise, 2 seconds will yield twice as much light as 1 second. One stop of sensitivity can be exchanged for one stop of shutter speed and achieve the same exposure. For example ISO 100 @ 1/125 of a second will achieve the same exposure as ISO 200 for 1/250 of a second. When lighting your scene with a sun lamp, you can consider using 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 numeric value for exposure 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.
- f/stop is directly related to the f/stop setting of a camera (which is where the term stop originated, as the aperture ring clicked from stop to stop). The f/stop, or F-number. f/stops are dimensionless numbers, so they don't directly reveal the diameter of the aperture. Rather, f/stop is a function of the focal length of the lens over the aperture diameter. f/stops simply have to be memorized. They are 1.4, 2, 2.8, 4, 5.6, 8, 11, 16, 22, 32, etc. Just like for shutter speed and ISO, there are third stops in between these full stops. f/2 will yield twice as much light as f/2.8, and f/4 will yield half as much light as f/2.8. The smaller the f-number the wider the aperture, and the more light is transmitted to the film.
- Depth of Field
- Though depth of field is not a setting inside of the Tone Mapping panel, f/stop is related to aperture diameter, and aperture diameter determines depth of field, so it is important to understand how one effects the other. As f/stop is focal length over aperture, if the calculation is reversed the aperture diameter will be revealed. Shooting with a 100 mm lens at an f/stop of 2.8 will give an aperture of 35.7 mm. If shooting with a 50 mm lens at 2.8, the aperture diameter will be 17.8 mm, and thus a deeper depth of field as the aperture is smaller. Both lenses are at an f/stop of 2.8 so they are allowing the same amount of light to reach the film plane. If the photographer wanted identical depths of field on the 50 mm lens as was achieve on the 100 mm lens @ f/2.8, the 50 mm lens would have to have a 35.7 mm aperture, which would be an f/stop of 1.4. The lens is now letting in two stops, or four times more light than when shooting @ f/2.8, so either ISO or shutter speed, or both, would need to be adjusted down two stops, to allow 1/4 as much light to the film plane, achieving the same exposure. Focus distance (different than focal length) is very important in determining depth of field. In the above example, the focus distance to the subject for both the 100 mm and 50 mm lenses would have to be identical. Changing the F/stop setting inside the Tone Mapping panel in LuxRender will only effect overall exposure, and will not change the actual depth of field of the rendered image. To affect the depth of field in the render, the f/stop setting must be set inside of your exporter. If you built your scene to scale, and have set a camera preset, you can use a DOF calculator to determine depth of field before rendering.
- This setting scales the final result to match the specified camera settings at the gamma setting specified in the Gamma and Film Response panel.
Photographers usually set shutter speed for the desired amount of motion blur, set aperture for the desired amount of depth of field, and then either use neutral density filters, lights, strobes, and/or adjust ISO to achieve the correct exposure. If they fail to achieve desired expose by these means, they make concessions with shutter speed and f/stop.
Auto-linear works the same way as the linear tonemapper, but it will auto-configure itself. It has no settings. The auto-linear tonemapper can be a good choice for test renders before you have your final scene lighting set up.
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.
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.
This controls how LuxRender will deal with values that are too high to be displayed in the final, low-dynamic range output.
Preserve Luminosity (lum)
In this mode, LuxRender will attempt to keep general light intensity the same by making bright areas to clip to white, regardless of actual color.
Preserve Hue (hue)
In this mode, LuxRender will attempt to preserve the color of bright objects. Once one channel of a pixel clips (reaches RGB 255) the other 2 channels will be locked for that pixel so that they are unable to change proportionately to the clipped channel. This will prevent bright areas from clipping to white or starting to change hue, which is what is usually done in drawings, and often what we see due to the high dynamic range of the human eye. However, this can also give highlights a strange "compressed" appearance
Clip Individually (cut)
This will allow each channel to clip independently of the others. This will cause colors to change hue or desaturate as their brightness approaches the maximum the image will allow. This is not a visually pleasant effect, however, it is how digital cameras behave, so this can be desirable from a realism standpoint.
The white point setting serves to define the color "white" in a given render. This gives you the ability to adapt to different lighting situations.
For instance, outdoor (sunlight) shots typically need the white point set to 6500 deg. kelvin (blackbody temperature). This is often referred to as D6500, the D stands for daylight.
With a properly lit indoor scene that uses incandescent lights. The white point should be set to approximately 2700–3300 deg. kelvin. Now if you want to simulate a camera set to the wrong white point then set it to D6500. The scene will look a bit orange but it will be accurate.
When LuxRender renders out an image, it stores a series of linear values for the color of each pixel. Unfortunately, these linear values cannot be displayed 'as is' on any computer or TV monitor. In order to convert these linear values into RGB colors that can be displayed, LuxRender must translate the values using one of several available 'color spaces'. Each of these color spaces will create RGB values from the linear data in different ways, so each of them will give you a differently 'colored' result. For computer monitors, sRGB-HDTV is generally considered the most 'realistic' color space, however, any of the available modes can be used.
|Adobe RGB 1998 color space||Apple RGB color space||CIE E color space||NTSC 1953 color space|
|NTSC 1979 color space||PAL/SECAM color space||ROMM RGB color space||sRGB-HDTV color space|
Gamma and Film Response
Gamma is used to correct for your screen gamma when viewing the image in LuxRender. It is an important part of linear workflow with LuxRender. This slider should always be left at 2.2, unless you have a specific reason for using a different value.
Film Response loads color profiles for various film and camera setups. Film and digital cameras are generally not designed with a linear response to light, since this results in images that many people consider to be dull and sterile-looking. Film response profiles will offset the light response LuxRender uses during tone mapping, in order to give a more pleasing color and contrast. This can help reduce the "sterile, ray-traced look".
In the examples that follow the ball was given the color red ([1.0 0.0 0.0]) and the render settings were not changed to emphasize the differences. Keep in mind that changing the film response may require you to adjust the render settings to obtain an acceptable image.
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.