In this training we'll learn how to properly setup a linear workflow in RenderMan for Maya, while explaining the benefits of handling gamma and color profiles properly.
In practical terms, Linear workflow refers to a rendering workflow in which image gamma is carefully taken into account in order to assure proper light computations in a render.
In other words, we'll be able to turn...
LW is especially important for the shading system of RIS, because it makes sure proper light computations are made in what is a physically based system.
Linear workflow is the correct mathematical workflow for computer graphics and by consequence not a system motivated by aesthetics (unless photorealism is considered one), as artistic liberties can be taken with computer graphics at any point, including lighting and shading.
Before we begin
There are many different gamma standards within the various color profiles out there, so we need to make some choices (and assumptions) regarding our simple imaging pipeline:
- sRGB will be the color profile used throughout, which is the standard color space for the internet. It can be said sRGB is also the standard for HDTV, because it follows the primary chromaticity of Rec. 709, which is the broadcast color standard for High definition television
- Float images (images with floating point precision per channel) are assumed to have no color profile, such as EXR or Float Tif. This is the default for most HDR and painting/ sculpting applications.
- I will interchangeably use the terms sRGB and 2.2 gamma, because in the absence of a proper sRGB color profile a 2.2 gamma curve is almost identical.
What does all this LW talk mean exactly?
To oversimplify things, let's break down an entire rendering pipeline into three simple steps:
For a Linear Workflow to work:
All calculations need to happen in linear gamma, but all viewing (input/ output) needs to happen in sRGB gamma.
Something like this.
Why do we need linear gamma?
- Because light works linearly and therefore only works properly when it lights linear values.
Why do we need to view in sRGB?
- Because the resulting linear image in not suitable for viewing, but contains all the proper data. Pixar's IT viewer can compensate by showing the rendered image through a sRGB look up table (LUT), which is identical to what will be the final image after the sRGB gamma curve is applied in post.
This would be simple enough if every software would play by the same rules, but they don't. In fact, the default gamma workflow for many 3D software is incorrect. This is where the knowledge of a proper imaging workflow comes in to save the day.
Let's visualize what we know so far.
This is the default in most applications including Maya.
No INPUTS are color managed, therefore all the CALCULATIONS happen incorrectly and the OUTPUT display is linear. Which translates into wrong colors, wrong light and wrong display.
This is incorrect.
This is another common example of bad color management.
No INPUTS are color managed, therefore all the CALCULATIONS happen incorrectly, but the OUTPUT display is in sRGB. Which translates into wrong colors, wrong light, but proper display.
This is also incorrect.
This is a render with Linear Workflow.
All INPUTS are color managed, therefore all CALCULATIONS happen correctly and the OUTPUT display is sRGB. Which translates into correct colors, correct light and proper display.
This is correct!
Which brings us to the only natural question anyone can ask after seeing this... How do I do this?
How do we make inputs linear?
Thankfully RenderMan can interpret Maya 2016 color management perfectly.
First, let's make sure we understand one thing in the diagram above...
Values are not color corrected, only colors are.
- Bump maps
- Specular maps driving values
- Normal maps
- Displacement Maps
- Vector Displacement Maps
- Swatches (color pickers)
- Color maps (diffuse maps)
- Specular maps
- Subsurface maps
- Incandescence maps
In practical terms we need to enable color management from the Maya preferences, under Windows > Settings/Preferences > Preferences > Color Management.
Well, first we want to enable Color Management, secondly we want to tell Maya that our images will be rendered in Linear Space, and that we will be looking at them with a sRGB LUT, or Look Up Table. This applies the color profile to the viewer and simulates what will be burned into the image after finalizing the image in post.
We could also add rules to our project. This can help us apply the correct color profile, or lack thereof, to a certain group of images, based on extension names and/or a pattern in the naming convention. For example: Bump will tell Maya to apply the rule to any images that come in with the word Bump in the name.
In my case I've told Maya not to change the color profile of Bump, this will maintain my painted values intact as they drive shader values.
The wildcards on both ends (*), tell Maya that this pattern can be anywhere in the name of the file.
Another very important gamma correction that needs to happen is to our swatchs, also called pots or color pickers.
We are picking colors in the sRGB values of our monitors, so it is not linear. To compensate, Maya can apply a LUT to the swatch so that we are picking in the right color space.
To avoid double gamma correction, we need to make sure we uncheck the RenderMan "Linearize Colors" checkbox, under the Render Settings > Features > Shading. This attribute was created pre-Maya 2016 and is redundant with the current workflow.
Now that we have effective modified the images coming in, we need to view them correctly.
How do we view outputs with an sRGB LUT?
- RenderMan defaults IT to a sRGB LUT, which is the best way to view images rendered with a linear workflow. This means you don't have to change anything if rendering to the framebuffer. Remember, IT is not actually modifying the image, it's only showing you the image with a sRGB LUT. This can be found in the main IT menu under View > Display View > sRGB.
- Remember to set IT to display 32-bit color depth (float) in the RMS render option box to avoid color banding and clipping.
- If everything is setup correctly in the Display mapping preferences, IT will be able to interpret images correctly. This can be found in the main IT menu under View > Image Color Space > Automatic. If you feel IT is not interpreting the incoming image correctly you can override it using a long list of color profiles. The default values should suffice for most users.
- To view linear files in the Maya Renderview, the Color Management needs to be set to "Use View Transform. This will allow the Renderview to assume all incoming images are in linear space, and therefore applying the sRGB LUT as chosen in the Color Transform Preferences above.
To study a practical example, download and open the RenderMan_LW.zip project.
In depth gamma information which escapes the scope of this training can be found in numerous internet articles such as Charles Poynton's Gamma Faq, the Imaging Workflow section of the RenderMan documentation and the Color Management section of the Maya user guide.