Linear Color Workflow(s) in Maya – Part 1: Maya Tools
I previously explained the sRGB color space here: Color space and Your Screen
Now I will talk about ways to render your images correctly from inside Maya.
Renderers operate in linear color space. Their color calculations are designed such that 2+2 = 4 in a direct fashion without applying curves, etc to the color inputs and outputs. Here are a few reasons you will need to understand this and appreciate it.
- Color correct workflow insures that your result is predictable.
- Color decisions can be made in each phase without major disruption since you aren’t using your 3D package in a way 2D software is best suited.
- Viewing your textures as you create them in the correct color space will have a consistent result when you output them. Paint in rec 709 > linearize > output to rec 709 will look the same.
- Using the correct physically plausible materials (like mia_materials) will respond correctly to light giving you photorealism more quickly and reducing tweaking time.
- Tweaking settings with curves baked in them is counter-intuitive.
There are two main ways to deal with this situation inside Maya. The first is possibly the easiest. But the final solution, while more complicated, is generally preferred for reasons I will explain.
I’m going to assume a few things (I know assuming is bad, but hey, gotta start somewhere.)
1. You are using Photoshop to paint your textures. Photoshop assumes you’re painting in Perceptual Space (sRGB) but you will probably want to turn off color management to make sure it’s not making too many decisions for you. This is fine because you want to paint what you will expect to see later.
2. You have a decent monitor that has been calibrated. CRTs have great reproduction but you have probably migrated to LCD by now. IPS monitors are best because their viewing angles are wider and color reproduction is better. Higher-end monitors like HP’s Dreamcolor Monitor will also allow greater bit depth to be displayed (30-bit color, etc) when combined with supporting software and hardware.
3. You know your destination color space. If you are generating content for most sources it’s probably sRGB again. If it’s HDTV then it’s probably rec 709 and for film and special projects (shot on film or otherwise) you can have a specific color space/LUT you need to view your images with. (Sidenote: film is often in Log(arithmic) space because of how film responds to light. The Cineon format is often used here and is well documented. Cineon File Format )
Basically:
- 1. Paint in Photoshop
- 2. Linearize your image (based on your destination colorspace)
- 3. Render (this is a linear process) and view in the correct destination colorspace
- 4. Composite with floating point linear files viewing them in the correct destination colorspace
- 5. Output to the correct colorspace from the compositing program
Let’s use Maya to help us this time.
Step 1 is easy, paint your textures in Photoshop. The majority of images used for this are collected from other sources that are sRGB. Like the Internet or texture collections. HDR formats however are floating point and by standards those are assumed to be in linear color space (avoid correcting them for anything other than just viewing) Remember: floating point does NOT mean it is linear. Bit depth and color space are different concepts. But floating point images are assumed to be linear color space.
Step 2, linearize the file. Current Maya versions provide a mechanism for correcting your images to be rendered in linear color space. Renderers, mental ray here, will assume the data you are feeding it is linear. Maya has an option in the Render Settings called “Enable Color Management”
You have a selection of color spaces to choose from: Linear sRGB, sRGB, Linear Rec. 709, HDTV Rec. 709 and additionally output for CIE XYZ. (image)
An explanation can be found here: Maya Render Settings Docs
The recommendation is that you render “sRGB non-linear. Applicable for use with most viewing arrangements. Implicit D65 white point.” This means you painted in Photoshop on a monitor and are viewing in a color space of sRGB.
So far so good.
Output is Linear sRGB. This means your output will be in linear color space. This is preferred (required in order to be correct) for compositing. Compositing packages like Nuke will operate linearly when given floating point files. You will also notice the file nodes have similar controls for overrides, etc. (image)
Ok, so far the Maya controls seem to do the job. But there’s a problem. The color picker for Maya is in sRGB colorspace (despite internally being floating point). This means that red you chose just won’t do! (image)
How do you fix this? Well, sadly for now you must attach a gamma node to the color connection and apply a correction of 0.4545 (1/2.2) for the color you want that is now the input color of the color picker. Now things should be linear through and through. (Applying an inverse function will flatten out the sRGB curve.) (image)
But you have a bump texture? Textures provided as data for the shader to use like displacement, bumps, and maps for controlling things like glossiness can be left alone. They are not going to be visible as a color in the render but provide data to the shader to produce a result not related to color directly. The management for these textures should be negated.
Displacement maps should be floating point and therefore linear color space by default.
Be sure your Render Settings > Quality > Framebuffer is set to RGBA 16 half. (image) Also select 32-bit in the Renderview > Display menu (requires restart). Render to the Renderview and using the Display > Color Management, choose Image Color Profile = Linear sRGB (image) You will now view your image in the correct colorspace without making alterations to the rendered file (it will still be written as linear) This is a preview of what your image will look like when composited and output as a final to sRGB.
Now let’s recap this:
–Paint in Photoshop and save. (Your texture is going to be in sRGB format if saved to a standard format that is not floating point.)
–Enable color management in Maya as default (sRGB to Linear sRGB) and render to a floating point format, generally speaking OpenEXR RGBA 16-half. (You can render to 16-half because it is still considered a floating point format but saves space compared to 32-bit by losing some unnoticeable precision) Take care not to alter your bump and displacement, etc.
–Your images are linear and ready to composite in something like Nuke.
That’s one solution. But here’s the problem(s) I have with that solution: It’s tied to Maya. This means that your success is tied to using Maya’s mechanism even if it’s faulty or changes from one version to the next. And what if you change packages for rendering? What about those nodes reading in bump and displacement to fool with?
Well, you can use the gamma nodes attached to nodes and omit them for data type textures like bumps. But why?! This not only increases your workload for every texture and color picker, but what if you forget one or fumble thumb a setting? So let’s not go there. I’ve never quite understood that workflow. (I try to name my nodes and all those gamma nodes become an accounting nightmare.)
So why not linearize before taking the image to Maya? Great! Maya is a 3D package. Try not to make it your color package too. There are much better pieces of software for that. (Sidenote: You can generate color profiles for Maya using a colorProfile node. More information can be found here: colorProfile Node But this may be a bit complicated for most users. And again you are tied to the internal mechanism of a single package for rendering.)
Can you make this a little easier?
You can linearize a color texture from Photoshop to Linear sRGB easily.
In Photoshop you should change your image bit depth to 32-bit float and save as EXR when you’re done. (Image ->Mode) Remember that floating point files are assumed to be linear. This means Photoshop saves a linear color space file you can use for rendering. Now you can ignore the Color Management on your texture nodes and Render Settings. View your render as you did before with the Color Management in the Renderview. You still must correct the color picker.
Now you also have a library of textures that can be rendered in any package for sRGB because they are saved correctly in Photoshop.
Photoshop -> Linear sRGB -> Render (view as sRGB)-> Composite (view as sRGB) -> Output to sRGB
But what about a project where you are rendering to a specific LUT? (Film Still) Maybe you have a project shot on film. Your color space is not sRGB. Now what?!
For the preferred workflow, look here: Part 2: The Preferred Method
. . . .
Posted on November 23, 2011, in colorspace, maya. Bookmark the permalink. 14 Comments.







Hey David, I just wanted to report that your first technique is apparently broken in Maya 2012. I was using this technique in 2011 without any problems as far as I remember, but I recently tried in maya 2012, and I get bad compression artifacts on my textures. If I make the gamma nodes manually, it’s fine, if I use EXRs, it’s also fine. But the maya way… is now wrong. I tried on different PCs, can you confirm that or is it just me?
I almost never use that technique but somewhere I was earlier was not having problems with 2012. Are you on a service pack? I’ll see what happens here.
I used Subscription Pack and SP1 but got the same problem. I tried rendering an old project from 2011 with 2012 and didn’t see any these artifacts. Actually I think that was specific to one of my textures. I tried this same texture in different projects and scenes and had the same bug, while the others were fine. But why would it do that only with the maya color management and not with gamma correct nodes or EXR? No idea. I don’t have the time to investigate at the moment unfortunately. I already switched my pipeline to the “EXR 32bits from photoshop” way and it works great, as I’m only working in sRGB.
So you narrowed this issue to a specific texture? What type of texture is this?
I made some quick tests tonight, it’s only visible in the dark parts of the textures (colors with a value around 20%). That’s maybe why I couldn’t see it on other textures. I tried png, tiff, tga, jpg, and get the same banding effect. Also tried a lambert instead of a mia_material_x.
So I think I can say that it’s related to maya color management.
It looks like the render view is actually not in 32 bits mode, but it is. And the exr I get from a batch render has the same problem. You can easily try it by yourself with just a light or a physical sky (I didn’t forget to put the gamma back to 1 in the camera lens). Or I can send you a test scene if you want.
The problem doesn’t occur in Mental Core
This might answer your question:
http://forums.cgsociety.org/showpost.php?p=7188732&postcount=10
I know this is a little weird but dot87 and chafouin are the same person. I’m in a nickname transition period, sorry about that
So I already read your message but this is not the problem I’m having. Tomorrow I’ll be posting images and a scene so you guys can see the difference.
Hi Bitter, did you have the opportunity to take a look at the scene I uploaded on cgtalk? http://forums.cgsociety.org/showthread.php?f=87&t=1022895&page=2&pp=15
I did awhile back. I think if the rendered images are correct then there is something wrong with how the Maya Render View displays them. A bug should be reported to Autodesk for that.
Wow. Your posts are well written and very helpful. I’ve been learning a lot!
Pingback: Linear Color Workflow(s) in Maya – Part 2: The Preferred Method « elemental ray
Pingback: Area Lights 101 « elemental ray
Pingback: Texture Publishing to mental ray « elemental ray