In this HowTo, guest contributor Leif Pedersen shows us how to properly setup a linear workflow in RMS, 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 new plausible shading and lighting system in RMS 18, 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.
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 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 RMS has a system in place to color transform images and view final renders in sRGB in a non destructive way.
Images with sRGB encoding (most 8-bit and 16-bit per channel standards like jpg, tif, tga, png, etc) which will be used in RGB inputs, need to be linearized. For example, an image driving the color or specular color of a shader. This can be done by adding renderman texture attributes to the file texture node in Maya and choosing linearize sRGB. Another solution to linearizing incoming textures is to use the Maya color profile drop down. Many common color profiles will be there to choose from including sRGB. This will make gamma correction simpler, but will not add the Rman texture attributre for nedded UDIM and filtering controls.
When using the Maps slot in the GP shader, there is a sRGB maps checkbox that will linearize the proper maps automatically. The Maps tab does not display inputs in the viewport.
- If using SLIM, there are several nodes that have built in linearize sRGB checkboxes, such as TextureColor and ImageFile. If manual conversion is needed there is a specialized node for that called LinearizeSRGB.
Images with sRGB encoding driving values or sliders do not need to be linearized, because RMS does not apply gamma to values. For example, an image driving the glossiness or displacement of a shader.
If you are using a Maya color swatch instead of a texture to drive a value, the swatch needs to be linearized because you are picking a color viewed through your monitor’s sRGB color profile. To achieve this, you can do two things:
Attach a maya gamma node and set all values to 0.4545. This will linearize the gamma by applying an inverse power function to the incoming gamma curve.
Use the automatic Linearize Colors button under Render Settings > Features > Shading (on by default). This will not only linearize color swatches, but any other Maya color utility such as a ramp. Beware, this will not linearize texture files, only Maya swatches and utilities.
If you are using Slim color swatches, no correction is needed because the display is compensated to 2.2 gamma by default.
Color swatches with a value of 1 or 0 do not need to be corrected, because they are terminal values of the gamma curve, meaning they will keep their values in any color profile.
How do we view outputs with an sRGB LUT?
RMS 18 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 display preferences need to be set to 32-bit floating-point in order to have sufficient color precision. Also, the Color Management needs to be set to Linear sRGB Image Color Profile. This will allow the Renderview to assume all incoming images are in linear space.
Images rendered to disk (batch rendering for example) need to be manually loaded into IT, or viewed with another LUT capable image viewer. When viewed through a standard non LUT capable viewer, the rendered images will look too dark for practical preview purposes.
To study a practical example, download and open RMS_LW_Correct.mb
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 RMS 18 documentation and the Color Management section of the Maya user guide.