Mental Ray production workflow

Why we need so much headache with things like
linear workflow and rendering passes?

If your renders looks perfect and finished, everybody satisfyed-
you don`t need to break your brain with all this stuff- just render!
Problems begin when you wish to dramatically change your renders
and do this in most effective way. This we can call "production workflow".
Indeed, people use this techniques to make life easier, and when everything works,
as you expected- its really makes life easier.
But nothing never works in CG as you expected:)

Speaking about production workflow in rendering we have to deal with 2 major things-
gamma and passes.
When we struggle with gamma issues we would like to setup linear workflow.Its involve not only 3D application, but any stage of creating CG- texture painting, rendering,
composing and even viewing images. Linear worklow is when you create CG correctly.
Nobody explain linear workflow with maya better than David Johnson in his article
Maya Linear Workflow In Two Steps.

We need passes to enlarge control over our renders without re-rendering images.
For example, you can add motion blur and depth of field effects after render;
you can color correct image, or any part of image, or any component of image
(specular highlight or shadow etc). This is composing-tweaking image after render.
When you able to paint fur specular from white to red on one of character
and make nails of another character metal without re render-
be sure- your workflow is production:)

Now we would not speak WICH passes we need to get pefect renders,
we explore HOW to get passes with mentalray in Maya 2009-2011.

A lot of ways to do this, but my choise for now- is Deex shaders pack.
Its similiar with Pavel Ledin shaders_pack. Deex based on mia_material, Pavel create its own
shaders in many aspects more powerfull than mia_material
(for example p_HairTK with fur is miracle), but any way i prefer mai_material for its beauty.

How this stuff works:
Mia_material_x_passes (and all other shaders with "x_passes " in their name) has build in
ability to break information about shading on peaces- like color, diffuse, specular, reflection and
so on. This peases of shading information called "passes".

What passes build in mia or deex shaders?
Its clearly described in Maya documentation. See Architectural Material gude.
Other x_passes (like mi_car_paint_phen_x_passes or misss_fast_shader_x_passes)
may have slitly different passes than mia_material, but logic the same.

Whan you render image with mia_material you see the result of compositing
(compositing inside maya) of different passes.
The goal to get this passes as separated images when render,
than compose them manualy (in composing aplication like Photoshop, Nuke etc)
to have grater control over image tweaking.
Besides obvious passes, like color of material and its reflective ability, you may need special passes,
which can be used to get different effects on composing stage(in post).

After render, to create depth of field effect you need "Depth pass"; to put texture on object you
need "UV pass", to get motion blur- "motion vector pass" and so on.

When you clearly understand what information you need to get desired result u can build scene,
lights and shaders. One way, you could build passes is render layers.
One layer for the beauty pass, another for occlusion, one more for SSS, cople of layers for masks
and so on. If you wish to break beauty on passes (color difuse specular etc) its posible to use
build in maya system for this layer only.
Main disadvantages of such workflow- you render scene not once, but same times,
as quantity of render layers we have. And such setup wery instabile when scene changes,
especially with references. With Deex shader you render once and get all you need.

At least EXECTLY WHAT SHOUD YOU DO to get passes with Deex shaders:

Setup light and shading in you scene. Use only deex materials.
When satisfied with results, create polygonal cube and deeX_Buffers_pass
(its in geometry shaders section).
In mentalray section of TRANSFORM node of polyCube check enable geometry shader.
Plug deeX_Buffers_pass in geometry shader slot.
Do not hide or template the cube- it would not be visible in render.

Adjust deex buffer pass as you need. Render. Thats all. Yes, simple.

Just cople of words about deeX_Buffers_pass parameters and main aspects:

Everything here is quite obvious:
1) set name and directory to render files, choose file format (in EXR you get all data in one file,
very useful), compretion and image depth.
2) In mentalray standart chennals section set RGBA format "from render settings".
When batch render maya save one file based on render globals(it will be beauty with alfa)
and another- based on deeX_Buffers_pass settings (actualy your passes).
3) Check Z, normal, motion etc if you need. If you set EXR for them- this passes will be addet to
the same EXR.
4) Than, depending on shaders that you use and passes that you need, check corresponndet
boxes in Output passes section. In control push "check same output pass ..." button to enable
all this passes in your materials(by default in materials all passes turns of and u wil get no info
from them in bufer writer).

And what if we need another passes, which do not build in deex materials or we need
material masks? For this reason in deex shaders exist magic "extra buffer" section.
In any deex material u can plug in this buffers all aditional data that you need and output it
with deeX_Buffers_pass. For example if you need UV info of all objects- create UV shader
and plug its output to extra buferr_01 of all shaders.
Check to output extraBuferr_01 in deeX_Buffers_pass. Easy.

A bit more modern approach of mentalray production workflow
See also Arnold pipeline guide