Color Management is an important part of any visual medium production process,
whether it's computer graphics, photography, or print.
In this movie, we'll show you how to adjust the colors in a scene
using Maya’s built-in Color Management system.
Make sure to set the current project to the provided scene folder,
then open the file "01-Cabin_window_start.mb".
This scene consists of an open window into an apartment,
and is composed of several objects assigned various shaders and textures.
We’ve lit this scene using two spotlights for the key and fill lights, and a point light for the lamp.
We’re also using an HDR image as a background.
Before diving into the lesson, let's first review what color management is
and why it's necessary.
Switch the current perspective to "main_camera" to frame our scene.
If we turn on the scene lights in the workspace, notice how dark it becomes.
Your first thought might be that the lights simply aren't bright enough.
So let's increase the intensity of “key_light” to 30000,
and “fill_light” to 3000.
This looks a little better in the workspace, so try rendering using mental ray.
This is definitely not right.
The HDR background appears too dark, the shadows on the rose petals are too hard,
and the shelf's wood texture is washed out.
Let's try a different approach.
Notice that both the key and fill lights' Decay Rate attributes are set to Quadratic.
This is the most physically correct way of calculating a light's energy
(also known as its “luminance”) over distance.
But since our scene is already too dark, maybe we can preserve the luminance
by changing the lights’ decay to Linear mode to brighten up our scene.
Of course this means we'll have to reduce the intensity of both the key light (100)
and fill light (50).
Try rendering again.
Unfortunately, the render still looks very wrong.
The HDR background and curtains are still too dark.
While the shadows on the rose’s petals are slightly softer, they're still too intense.
To make matters worse, we've also introduced these rather extreme highlights on our vase
and silk handkerchief.
We could work around this by lowering each light’s intensity
and adding more lights to the scene,
but since light is additive we'll still end up with most of the same problems,
in addition to unnecessarily bloating our scene with lights.
To properly fix this, we need to understand what's actually happening here.
In order to display images on a screen, electric signals are sent to the pixels on your monitor.
The higher the voltage of the signal, the brighter a pixel appears.
However, unlike the relationship between energy and luminance in the real world,
the relationship between voltage and luminance on a computer monitor isn’t linear.
That is, if we double the voltage we don’t necessarily get double the luminance.
This can be problematic, as 3D graphics rely on linearity for the under-the-hood mathematics
to produce natural and pleasant lighting.
All displays vary slightly, but for various reasons we won't get into,
computers are programmed to assume a voltage- to-luminance relationship
as a power law function with an exponent of approximately 2.2 (known as the gamma)
rather than 1 to 1.
Because of this, image files such as JPG and PNG store color values
that are higher than the actual desired colors as a counter balance,
otherwise they would appear too dark. This is known as "Gamma Correction".
When this increased brightness is combined with the darkness of the monitor,
the graph achieves the desired linear relationship,
meaning that colors onscreen appear the way the artist originally intended.
Like those JPG and PNG files, scenes in Maya also need to be Gamma Corrected as well,
since Maya assumes a linear luminance relationship.
Part of the reason our render appears so dark
is that this gamma correction is not being applied yet.
However, if we were to simply apply a straight gamma correction to our final render,
then that would mean our textures, like this shelf’s wood surface or the room's walls,
would appear way too bright since the textures controlling their surface reflectance
are already gamma corrected themselves (i.e. a double gamma correction).
And in reality, a straight gamma correction is often insufficient anyway,
because a computer monitor is not actually capable of displaying the range of luminance
experienced by the human eye in the real world
(and by extension a simulation of the real world in Maya).
Naïve gamma correction typically results in a loss of contrast when there is a high dynamic range.
Thus, another conversion from the scene's color range to the monitor's color range
(a step known as tone-mapping) is often inserted in between,
to help mitigate the limitations of the monitor.
In summary, you can think of the color correction process as a series of three steps:
First, importing texture files and undoing their gamma correction
(or their tone-mapping, if the images themselves were also tone mapped)
so that they're consistent with Maya's linear luminance calculations
(also known as being "scene-linear").
Next, converting Maya's entire scene-linear color space to your display-linear space
(i.e. tone-mapping the scene).
And finally gamma correcting the display-linear result
to actually display the artist's intended luminance onscreen.
Color Management refers to that process
of intelligently bringing all these disparate color spaces together in harmony
so that the scene outputs the way the artist expects.
Because the process is so complex,
it's extremely helpful to have a Color Management system, like the one in Maya,
to handle most of the heavy lifting for you.
Although a Color Management system existed in previous versions of Maya,
it required a lot of manual tweaking of the DAG to get working correctly.
The new Color Management system introduced in Maya 2015 extension,
greatly streamlines that process.
Reload the current scene, making sure not to save over it.
Return to the main camera and turn on the scene lights in the workspace again.
This time, we're not going to touch the lights. Instead, go to Maya’s preferences.
In the Color Management section, turn on Enable Color Management.
The screen immediately brightens up as Maya adjusts all the gamma values for your monitor.
The default values listed here are actually already tailored
for a wide range of production use cases. That being said, let’s go over them in a bit more depth.
First note the Default Input Color Space.
This attribute determines the assumed color space of incoming image files
such as texture bitmaps.
sRGB (standard Red Green Blue) is one of the most commonly used color spaces in the industry,
so it should adequately cover most incoming files.
We'll still have the option of changing any incoming color spaces
on a texture by texture basis if we need to later.
This is typically an attribute you want to set right from the start of your project,
since it only applies to textures that are referenced after Color Management is enabled.
Next, take note of the Rendering Space.
This attribute determines the working color space,
which Maya uses to perform its lighting and rendering calculations.
By default Maya has set the Rendering Space to “scene-linear Rec 709/sRGB”.
This rendering space is tailor fit to match
the standard color capabilities of monitors and HDTV's, but with scene-linear color values
(so they are appropriate for the rendering algorithms used by Maya).
Note that like the Input Color Space,
typically you want to choose a rendering space right from the start of your project,
since it can affect the colors selected via swatches and ramps as you're building it.
Notice that if you change this value now, the colors in the scene change,
meaning we'd have to resample all of them again.
Thus, for the purposes of this tutorial we'll stay with the default setting.
Finally, View Transform converts colors from the rendering space to the display space
for viewing on your display device.
For now, let's assume that there will be a compositing step
that happens in an external compositor after rendering.
In this case, the View Transform should be set to match the same tone map
used by your compositor.
In this case, we'll use "ACES RRT".
ACES (short for Academy Color Encoding System),
is a radiometrically linear light encoding system
which encodes scene exposures as they exist at the camera's focal plane.
The RRT (short for Reference Rendering Transform)
encompasses a much wider color gamut with a high dynamic range
and is therefore more versatile than sRGB, though it is not quite as intuitive to work with.
A full description of each of the available color transforms
is available in the Maya documentation.
Once you've enabled Color Management, you can toggle the View Transform on and off
and even temporarily switch from one transform to another via the Panel Toolbar.
This option is also available in the Render View window as well.
However, notice the shadows on the toy rocket ship are a little off.
This asset is a low polygonal object using a normal map for added detail.
However a normal map doesn't actually represent color.
Rather it represents normal data used for shadow and light calculations.
Because of this, we don't actually want to color manage it at all,
otherwise we could end up with incorrect values for our shadows.
To ensure this doesn't happen,
select the rocket’s “stage 1” object and navigate to its normal map texture node via its material tab.
Switch the Color Space attribute to Raw.
This setting bypasses color management and thus fixes the shadows.
Repeat this for the "stage 3" object’s normal map.
Render the scene again.
The render is a little better. While the lighting isn't dark like our pre-color managed scenario,
it is still too dim. Additionally, many of the shadows are still very hard.
These are happening because we haven't optimized our output method
to work with our new Color Management settings yet.
Open the Render Settings.
In the Common Tab, notice that the Image format is currently set to Maya IFF.
The IFF file format is a quick and lightweight format for rendering,
but has only limited support outside of Maya.
Instead, switch this to OpenEXR, which is a standard format for compositors and grading.
Next, go to the Quality tab. In the Framebuffer section,
set Data Type to either a "Half" or "Float" value. In this case, we'll use "RGBA (Float) 4x32 Bit".
We need the increased bits of storage to convey the increased color information in our scene.
While we're here, let's also increase the Sampling Quality attribute to 1 to improve the overall render.
Finally, in the Indirect Lighting tab, turn on Final Gathering.
This is a global illumination method that will more accurately simulate
the way the light should be bouncing around your scene.
Try rendering now.
Notice that with the help of Final Gathering, the scene is much brighter than before.
Additionally, we're getting some red reflectance from the handkerchief and curtain
that weren't present earlier.
Finally, the highlights aren't so harsh, and the shadows are more subtle.
This is much better than our previous attempts, and required no modification of our scene lights.
If you recall from the preferences we set earlier,
we set the View Transform assuming that there would be a compositing step
after our render was complete.
However, what if compositing wasn't necessary
and we wanted to author our scene directly out of Maya?
In a composited workflow,
you can often control the conversion of color values from the rendering space
into one that is more suitable for the device you're viewing it on
and the stage of production you're at (animation preview, lighting preview, etc).
However, if we remove the compositing step,
then it would be pertinent for Maya to bake that conversion right into the render itself,
especially if our viewing device doesn't automatically apply
the appropriate view transform to scene-linear images.
Open the Render Settings.
In the Common tab, in the Color Management section, turn on Apply Output Transform.
This attribute enables you to bake a color transform right into your render.
Set Output Transform to “Use View Transform”.
Although we can set a specific transform,
it's easier for us to just use our chosen View Transform.
These options are also available in the Color Management section of the Preferences.
Render the scene again.
As Maya renders the scene, things seem fine,
but once finished, the resulting colors suddenly get completely overblown.
So what happened?
We've basically told Maya to include an output transform to all our colors,
on top of what we're seeing in the workspace, to make the render appropriate for viewing.
However, the image in our render view is already being transformed by the View Transform.
Thus, we're actually getting a double transform.
To mitigate this, turn off the View Transform icon in the Render View
to see what the transformed render actually looks like.
Also note that while we're using the integrated mental ray renderer for this example,
3rd party support is also possible via the provided SDK.
You're now ready to control the colors of your scene no matter where your render is going.