92 4 Camera- <strong>and</strong> Exposure Effects1, a strong “toe” region is added to the transfer curve so that low intensities gets pushed moretowards black, but in a gentle (soft) fashion.Compressing bright color components inherently moves them towards a less saturated color.Sometimes, very strong compressions can make the image in an unappealingly de-saturatedstate. The saturation parameter allows an artistic control over the final image saturation.1.0 is the st<strong>and</strong>ard “unmodified” saturation, higher increases <strong>and</strong> lower decreases saturation.The gamma parameter applies a display gamma correction. Be careful not to apply gammatwice in the image pipeline. This is discussed in more detail on page 4.The side channel <strong>and</strong> side channel mode is intended for OEM integrations of the shader,to support “interactive” tweaking as well as for the case where one wants to insert an outputshader prior to the conversion to “display pixel values”.This is accomplished by applying two copies of the shader, one as lens shader, the other asoutput shader. The two shaders communicate via the “side channel”, which is a separatefloating point frame buffer that needs to be set up prior to rendering.Valid values for side channel mode are:• 0 - the shader is run normally as either lens- or output-shader.• 1 - the lens shader will save the un-tonemapped value in the side channel frame buffer.The output shader will re-execute the tone mapping based on the data in the sidechannel, not the pixels in the main frame buffer.• 2 - the lens shader works as for option 1, the output shader will read the pixels from theside channel frame buffer back into the main frame buffer. This is useful when onewant to run third party output shaders on it that only support working on the mainframe buffer.One may wonder, if one wants to apply the tone mapping as a post process, why not skipapplying the lens shader completely? The answer is twofold: First, by applying the lens shader(even though it’s output is never used), one can see something while rendering, which is alwayshelpful. Second, the <strong>mental</strong> <strong>ray</strong> over-sampling is guided by the pixels in the main frame buffer.If these are left in full dynamic range, <strong>mental</strong> <strong>ray</strong> may needlessly shoot thous<strong>and</strong>s of extrasamples in areas of “high contrast” that will all be tone mapped down to white in the finalstage.The use preview <strong>and</strong> preview work exactly like in the mia exposure simple shader describedabove.4.1.2.2 ExamplesLets walk through a practical example of tuning the photographic tone mapper. We have ascene showing both an indoor <strong>and</strong> outdoor area, using the sun <strong>and</strong> sky, mia material, <strong>and</strong> a
4.1 Tone Mapping 93portal light in the window. The units are set up such that the raw pixels are in c<strong>and</strong>ela persquare meter.The raw render, with no tone mapping, looks something like this:No tone mappingThis is the typical look of a Gamma=1 un-tonemapped image. Bright areas blow out in avery unpleasing way, shadows are unrealistically harsh <strong>and</strong> dark, <strong>and</strong> the colors are extremelyover-saturated.Applying mia exposure photographic with the following settings:"cm2_factor" 1.0,"whitepoint" 1 1 1,"film_iso" 100,"camera_shutter" 100.0,"f_number" 16.0,"vignetting" 0.0,"burn_highlights" 1.0,"crush_blacks" 0.0,"saturation" 1.0,"gamma" 2.2,...gives the following image as a result 4 :4 For speedy results in trying out settings for the tone mapping shaders, try the workflow with the “preview”parameter described on page 89.