Photographic Exposure (mia)

Category: Lens

Output: Color

This shader is a tone mapper that converts actual pixel luminances (in candela per square meter) into image pixels as seen by a camera, applying camera-related parameters (such as f-stops and shutter times) for the exposure, as well as applying tone mapping that emulates film and camera effects.

The shader has two basic modes:

• Photographic mode assumes that the input values are (or can be converted to) candela per square meter.

• Arbitrary mode assumes that scene pixels are not in any particular physical unit, and are simply scaled by a factor to fit in the display range of the screen.

If the Film Speed (ISO) parameter is non-zero, the photographic mode is used, and if it is zero, the arbitrary mode is used.

 Name The shader's name. Enter any name you like, or leave the default.

Film Settings

In photography, the film speed (the ISO value), the aperture (f-number) and shutter time all interact to define the actual exposure of the camera. Therefore, to modify the exposure you could modify each of them to achieve the same result. For example, to make the image half as bright, you could halve the shutter time, halve the ISO of the film, or change the aperture one "stop" (for example from f/16 to f/22). In a real world camera there would be subtle differences between these different methods, but with this shader they are mathematically equivalent.

 Film Speed (ISO) Specifies the ISO number of the film, also known as "film speed". As described above, if this is set to zero, the arbitrary mode is enabled and all color scaling is then strictly defined by the value of cd/m^2 Factor. Shutter Time Ratio The camera shutter time to be expressed in fractional seconds. For example, the value 100 means a camera shutter speed of 1/100. This value has no effect in arbitrary mode. f-Stop Number The fractional aperture number. For example, 11 means an aperture of f/11. Aperture numbers on cameras are expressed in specific standard series: f/8, f/11, f/16, f/22, etc. Each of these are referred to as a "stop" (from the fact that aperture rings on real lenses tend to have physical "clicks" for these values) and each such "stop" represents half the amount of light hitting the film at each increased "stop". It is important to note that this shader doesn't count "stops", you must give it the actually f-number for that stop. This value has no effect in arbitrary mode. Whitepoint A color that will be mapped to "white" on output. For example, an incoming color of this hue/saturation will be mapped to grayscale, but its intensity will remain unchanged. Vignetting In a real camera the angle with which the light hits the film impacts the exposure, causing the image to go darker around the edges. The vignetting parameter simulates this effect. When 0.0, vignetting is off, and higher values cause stronger and stronger darkening around the edges. Note that this effect is based on the cosine of the angle with which the light ray would hit the film plane, and it is affected by the field-of-view of the camera, and will not work at all for orthographic renderings. A good default is 3.0, which is similar to what a compact camera would generate. cd/m^2 Factor In photographic mode (a non-zero film speed) this is the factor used to convert between pixel values and candela per square meter. In arbitrary mode (a zero film speed), this factor is a multiplier applied when scaling rendered pixel values to screen pixels. This is analogous to the Gain parameter of the Simple Tone Mapping (mia) shader.

Tone Mapping

The parameters Allowed Overexposure and Allowed Underexposure guide the actual "tone mapping" of the image. That is, they specify exactly how the high dynamic range imagery is adapted to fit into the black-to-white range of a display device.

If Allowed Overexposure is one and Allowed Underexposure is zero, the transfer is linear and the shader behaves like a simple linear intensity scaler only.

 Allowed Overexposure Defines how much over-exposure is allowed. As it is decreased from 1 towards 0.0, high intensities will become more and more "compressed" to lower intensities. When it is 0.0, the compression curve is asymptotic, which means an infinite input value maps to a white output value, and overexposure is no longer possible. A good default value is 0.5. Allowed Underexposure When the upper part of the dynamic range becomes compressed it naturally loses some of its former contrast, but you can get some of that "punch" back into the image by using the Allowed Underexposure parameter. When 0.0, the lower intensity range is linear, but when raised towards one, a strong "toe" region is added to the transfer curve so that low intensities gets pushed more towards black, but in a gentle (soft) fashion. Saturation Compressing bright color components inherently moves them towards a less saturated color. Sometimes, very strong compressions can make the image look unappealingly washed out. The Saturation parameter provides artistic control over the final image saturation. 1.0 is the standard unmodified saturation, higher values increase the saturation and lower values decrease the saturation. Gamma Applies a display gamma correction. Be careful not to apply gamma twice in the image pipeline.

Side Channel

Supports the case where you want to insert an output shader prior to the conversion to "display pixel values".

This is accomplished by applying two copies of the shader, one as lens shader, the other as an output shader. The two shaders communicate via the "side channel", which is a separate floating point framebuffer that needs to be set up prior to rendering. See Render Channels & Framebuffers [Rendering].