The terms gamma correction and linear workflow has certainly started many debates about what is the correct way and what is the incorrect way, particularly in the 3D visualisation industry. The simple answer is, there is no correct or incorrect way. Think linear workflow as a tool, and a none-linear workflow as a different tool, both tools can produce similar results in different ways. A linear workflow may take five steps to complete where as a non-linear workflow may take ten steps. What matters is the quality speed at which you can complete those steps.
If you are passing files onto another person it is best to keep everything linear to avoid confusion. If it is just you and the client then, if you like your current workflow, your render times, your setup times and your final output, why change?
Adjusting to a linear workflow can be a time consuming process. As an amateur 3D visualiser you may not have the resource to fully understand linear workflow resulting in a lot of confusion and wasted time. Working in a linear environment allows you to get the proper amount of light where it belongs. That said choosing not to use a linear workflow means you are constantly fighting your tools and the results may not be as realistic as if you had used the proper tool to begin with.
A non-linear workflow would require you to use lights that have high multipliers causing blow-outs near the light source, which will then need to be corrected in post. To get a more natural flow of light you can cheat and add in fill lights but this takes time and there are now more lights in the scene that you must control.
This article refers to Autodesk 3ds Max and Chaos Group Vray, but the theory can be applied to any 3D rendering application.
How does gamma effect 3D software applications?
Any digital screen requires an input voltage, which outputs light intensity. Variations in voltages produce dark and light areas on the screen which in turn displays an image. Ideally the input voltage would match the output light intensity and the result would be exponential. This means the growth rate of the output is proportional to the current value of the voltage producing a linear pattern.
Image may be NSFW.
Clik here to view.
Unfortunately, in reality the result is not linear it is a power curve. As the input voltage is increased, the light intensity doesn’t increase by much. It is pretty much even until the voltage reaches a certain level, then the light intensity accelerates quite quickly. How this relates to an image is as follows; the shadows and low light areas will be very dark, the mid tones will be over bright and the highlights will become blown out.
Image may be NSFW.
Clik here to view.
To correct this, a mathematical inverse of the power curve is added, which counteracts and brings the curve to a more linear level that is considered correct for viewing images on screen. The inverse curve that is added is known as gamma.
Image may be NSFW.
Clik here to view.
Software applications such as Autodesk 3ds Max work in linear space. All textures and colour pickers have gamma correction applied already so that they can be viewed on screen, with the exception of HDR images because these predominantly are in linear space (Gamma 1.0). When textures and colour pickers are added to a scene, you are adding gamma 2.2 data to a gamma 1.0 application. The result is a linear render engine that has various gamma inputs, which effects material colours and light intensity.
If gamma is applied to the render output then various inputs will have double gamma applied to them, causing very bright renders. To fix this the solution would be to de-gamma all the inputs so that everything is working in linear space. By default all inputs have gamma 1.0 applied to them, this needs to be divided by the target gamma. The target gamma would ideally be whatever gamma was used on the textures and colour pickers, because it is impossible to know, a standard was set known as Gamma 2.2 or sRGB colour space.
The resulting render output after everything has been made linear is therefore a linear image. This will appear very dark on screen and it will need to be corrected. A gamma correction can be applied in a post using software applications such as Adobe Photoshop.
Gamma correction and linear workflow are not the same
In gamma correction you correct the gamma to be 2.2 and save in 8bit format, usually a JPEG. The resulting image has gamma 2.2 burnt in, you do not need to correct it in post. Textures that have already been corrected to be gamma 2.2 need to be told that a gamma correction has already been applied. This is done by overriding the gamma to be gamma 2.2 as you import the texture. If left at Gamma 1.0 (linear) it will be twice as bright.
In linear workflow you do not alter any default gamma setting and save in floating point format, usually a 32bit EXR. The resulting image is everything is linear (Gamma 1.0). The gamma correction is then automatically applied in post. Textures that have already been corrected to be gamma 2.2 (Usually the digital camera used to take the photo does this) need to be un-corrected when added to a material, this is done automatically by Autodesk 3ds Max as you import the texture.
Either way you require an image that has gamma 2.2 applied in order for it to display correctly. This is due to CRT and LCD monitors not displaying colours in a linear format. Therefore if you input a colour of medium grey (RGB 128, 128, 128) when displayed on the screen it will not be twice as dark as pure white (RGB 255, 255, 255).
Variations in colour mapping
Colour mapping is a combination of exposure and gamma correction algorithms. Exposure is as it is in photography, the amount of light that is allowed to fall on the photographic film during the process of taking a photo. Increasing the light makes the image over exposed, decreasing the light makes the image under exposed, somewhere in the range is a happy medium but it depends on the surroundings at the time the photo was taken. Gamma correction adjusts the gamma value, typically in a range from 1.0 – 2.2.
Image may be NSFW.
Clik here to view.
Because we have monitors of varying specifications and not everyone works in linear space, other colour mapping options are available. Only linear multiply allows for a linear workflow, this is because the various colour mapping options adjust gamma as well as exposure, therefore they are no longer linear.
You can still use gamma correction with any of the colour mapping algorithms. Gamma correction is recommended no matter what colour mapping is used, the only resulting issue is that it is not linear, if you are not compositing or passing files onto someone else then it does not matter, use whatever suits your workflow.
For a complete list of the various colour mapping types and their descriptions click here.
Gamma correction summary
If you want to save the rendered image as a 32bit file format for compositing then don’t burn in the gamma, save at gamma 1.0 (linear). Gamma correction will be automatically applied when opening the file in post for the majority of software applications including Adobe Photoshop.
If you want to save the rendered image in 8bit so it can go straight out the door then burn the gamma onto the image during rendering.
For a guide on how to set up gamma correction and/or a linear workflow visit this tutorial.