Optimized Rendering and MENTAL
RAY FOR MAYA bible: (in progress,
almost weekly update)
“Good models create great render
times”
How to model to Render View,
which is the main asset of optimized rendering?

01: Show my initial Poly Cube
02: shows a more defined state
03: this one I smoothes to see what
the “EDGES” are doing of the object, You see the get round and don’t
maintain their proportion. That’s
something that’s really bothering me, in maya, unlike
nurbs which you can just add an isoparm,
and it keeps proportion.
04: Unsmoothed and we added some faces with the
Cut Poly Tool , and with the Split Poly tool.
05: Now we smooth object 4, and we see if we
look in the image below (the render one)
that the middle is kinda tessalated,
and doesn’t look smooth.
06: We add some Faces, near the most
outer edge of our surface
07: The smoothed final version
and see that the corners have more polys than the
entire object!!!!..
Most people just grab object 3 and keep moving points and smoothing,
until
the object is black, or they keep using the “Poly Cage” and
they keep adding poly lines(faces).
With my airplane, I modeled, and then rendered, to check with the amount of polys, I would be satisfied. My shots were from far away, that’s why my
plane is pretty low poly.

The Finish Product, after a
sphere and final gather turned on, looks like this:


This modeling will help out, for
render techniques like Global Illumination or Final Gather:

Only 8200 polys
for the body, Look
in Vector Render section for a wireframe render.
What more can you do?
Memory:
-01 killer
If you use a pointlight it creates 6 shadow maps ->
so in other words renders 6 shadows, it’s optional to turn the maps off.
-02 killer
3d Projected textures
-> so convert them to 2d textures and then put the image map in the Sourceimages and relocate it to the shader
Multilister/ Hypershade -> Edit
-> Convert to File Texture
-03killer
Hypershade, takes up way to much memory, use the multilister to have a quicker life.
-04killer
Go to your camera Auto
Render Clip PLane (turn it off) ... set the clipping
planes manual, increases time for Rays when you render..
(they'll travel less distance)
-05 killer
if you use Shadow maps, you can turn on Reuse Existing
Shadow map
First write them ->
Rewrite Shadow map
than do Reuse Existing Shadowmap,
fill in the names and voila.
Mental Ray, does it
automatically, so just file in the name.
!!! Beware this only goes
for non moving objects, that are going to keep the
same map!!
-06 killer
Optimize Scene, always do
this before you render, just turn every option on and check if you didn't loose
any animation.
-07killer
Things that don't reflect
or don't have motion blur, just turn it off..
Mental ray will motion
blur everything, so use layers. (different render
passes)
-08killer
Memory and Performance
Options (maya software)
-Recursion
Depth : don't change, but if your raytrace
stops and the computer is out of
memory, turn it to 1 , this will use
more CPU and less memory.
-09killer
Mental Ray: put Contrast A of sampling quality to 1 if
you don't need an alpha channel
Jitter: makes it go faster, and gets rid of
render errors (like dirt etc)
Maya's Filter is set to Triangle so why not mental rays! makes it go a lot
faster. Maya's Raytracing, Max Ray depth is set to 10 so why
Not Mental Ray's , and again we gain speed.
Types of rendering:
-First
some thesis Tips
[Go to
File-> Save
Scene Options-> Incremental Save On]
Turn Incremental
Save On, every time you save now it will put a number behind
your shot!!! a new one yes!!
so you won't have to go Save Scene as ,,
01 02 .. nope
[Transform
Tools Shortcut]
When you
move an object you sometimes want to use a different Orientation,
well just hold W, E, or R
down and click with the RMB
choose How you want to move it-> object, world, etc..
[Annotation}
Super
use, go to Create-> Annotation (you can make little Post IT notes to
your camera, or objects, they'll always face the camera)
Rendering:
Tweaking
a million lights -> use attribute spreadsheet (the intensity, shadows on etc
is in there)
Glow: To just have the highlights glow, go to Shader Glow
and Upper the Threshold
this only
makes the Specular glow!
Shadow
light: just create a spotlight and
duplicate it, now turn the 2nd one to a Negative intensity..
if you place a 3rd light
to light the scene, the 2 spotlights
only create shadows for the
objects they light.!!!
Depth of
Field: To control it easier, go to
Connection Editor, and connect Center of interest in the left to Focus Distance
on the right.. Where your
Raytracing: Only object that
have a different Refraction will have a good raytracing
aspect to them.
glass
it's index is: 1.6
Reflection Specularity: Control
the Highlights in Reflections
Light Absorbance: How
hard it is for the light to pass through the object
Surface Thickness: You
can make a surface look thicker, i
think it offsets the reflection
more
Jitter: turn it on in the sampling quality, will
speed up and will take care of unwanted things in your render
Shadows:
-First of
all some explanation bewteen differences in shadows:
What does
what?
[Maya
Software]
Depth Map
shadows:
Dmap resolution: This basically
shows how many pixels it takes to generate the shadow,
it creates a little map for it. The resolution goes in map size.
128 / 512
/ 756 / 1024
Dmap Filter Size Basically Blurs the
shadow (it
creates samples)
Now, the
higher the Dmap resolution the softer and better
quality the shadow will be.
[Mental
Ray]
You have
to have Depth Map shadows of maya on
in order to use Mental ray depth map
so turn both on!
ok here
comes a smart trick just, change the settings of maya's
depth map shadow and just hit, Take Settings From Maya button under the Mental
ray SHadow Map Tab:
Resolution : is the res of the map
Samples:
The fading of the blur
(more samples more render time, so optimize this)
Softness: how much it should blur
[maya software and mental ray]
Raytracing Shadows:
I'm going
to suprise you today:
I can achieve the Same effect as a Depth map!
Light
Radius: controls the Blur of the shadow, numbers starting
form 1 / 3 / 6 / 9 will blur the shadow!!
Shadow Rays:
does the same thing as with depth map resolution it creates more RAYS!!! so
creates a softer and higher quality looking shadow...
Maya Vector Rendering
You can find all kinds of plugins, like toonshader or you
can buy Wiredata, (great plugin,
seriously if I had money)
[Wire Frame Render]
Everybody
that's paying for the WireData shader,
maya 5 comes with Vector Render,
which is free wireframe renders..
-Window
-> Preferences-> Plugin Manager
-Turn VectorRender.mll on
Go to render
globals-> open Maya Vector tab
for wireframe render
Render Globals:
File Name
Prefix: "Your_image_name"
Frame/Anim Ext: name.#.ext
Image
format: Targa
Start and
end frame
Maya
Vector TAB:
Appearance
Options:
Curve
Tolerance= 0
Detail
Level Preset:
Automatic
or High Quality (blurs the lines)
* = Fill
Objects
Fill
Style: Single Color
= Show Back Faces (On or Off
depends on your goal, I would leave it on)
* =
Include Edges
Edge
weight=Hair
or 0.200 (any value, makes the wireframe’s line width thicker)
Edge
Style = Outline
* = Edge
Detail:
90

(here’s how you render globals should
look like)
Ok, now
select all your objects
and go to Polygon-> Normals-> Soften/
Harden
(make sure the settings are on 0.0)
Render in
Any File Format of your choice, and voila here you go.

[cartoon rendering]
Here’s a Maya Vector Rendering:

1 color no outline

1 color and an outline

1 color and outline.,
I didn’t have a separate beak..

1 color and outline, the
character has separate pieces of geometry..
Here are the settings, for
Maya’s Vector Render:

Hardware Render Buffer
Maya Software RayCast
Maya Software
, FAKE GI<
and FAKE HDRI… (and the every object glows trick)
Raytracing Maya Software
Mental Ray normal
First we're going to activate the Mental Ray Shaders in Maya, this will add a shader tab in the Hypershade.
Go to ../ My Documen/maya/ and you'll find a file called: "Maya.env".
Right Mouse Button click and do "Open With" , now select the Notepad and copy this line into the file.
MAYA_MRFM_SHOW_CUSTOM_SHADERS = 1
Save the file and now start maaya, You'll now find the new shaders available.
Cartoon Rendering / Contour
Rendering:
My first try gave me this image:
ple Contrast Shader in the Mental Ray globals.
(creates
a very nice and hard contrast in your image)

I prefer this image.. I like the look for some reason. Feels like a Japanese 3d movie..
To achieve the Cartoon look:
A: You turn on Mental ray, IN the plugin manager.
B: You open the Render Globals,
switch Render to Mental
Ray.
C:[Now
we have to create and connect some shaders]
-Contour Composite Shader(in
the Camera Attribute Editor, is the
Output Shader)
D:
Now the next two shaders are in the Render Globals,
under the mental ray tab, In CONTOURS!!
-Contour Contrast Function
Simple Shader(shader
is in the contrast shader, output.. in Render Globals)
-Contour Store Function Simple Shader(shader is in the Store Shader,
output in Render Globals)

Give me a few more, I’m figuring
this out while we speak.

not giving up yet.. This one isn’t it either,
however this is a cool outline…
I just did changed the output shader in the perspective camera to a
CONTOUR ONLY SHADER…
I made the color grey.
Now I put the Contour Composite Shader back in the Perspective camera, in it’s output shader.
Ofcourse the easy way out is to just make the objects separate,
but I want to keep my texture.
After a while and some more
research, I discovered how to make it look nice and cartoony.
Big Plus I discovered in Mental Ray’s Cartoon
Shading, is the image has an ALPHA channel!!..
That’s something I was missing
with maya’s vector render.
This is how you do it:

Turn Mental ray on, and turn the
Max samples to 3 (in
the sampling quality, under the mental ray tab)
See example below:

First of all we go into the renderglobals and connect to shaders
By clicking on
the “checker” box next to Contrast Shader.
We select the shader called: “Contour Contrast Function Levels”
Here is the example:

then we set the settings like this:

Now we go back to the render globals and click on the 2nd shader,
The Store Shader
(in
other words we click again on the Checker box)

As soon as we select the shader
The Connection Editor follows.

Now this is the most important thing…
We go to Left Display -> Show Hidden
(now all the hidden Render Globals
are turned on, and Visible in the Connection Editor)
Here’s the example:

Now we take the slider on the
left all the way down, and at the end of this list we see:
“Contour Store”
We connect Normal_Geom (on the right) to Contour Store (on the left)
Here’s the example:

Now the this Store shader is active and will work!!.
This was the most difficult
thing to do.
Now we open the Attribute Editor
of the camera that you want to render Cartoony with:
In my case Persp.
Click on Output Shader,
and out of the Output Shaders
select CONTOUR ONLY.

Change the background Color.

Now we’re going to the
materials.
Rendering Editors -> Multilister
/ Hypershader (multilister
has better performance, and shows unused shaders, or
lost
Connections)
We create a Lambert Shader, and then click on the “Little Cube Arrow” to go to
the shaders Shading Group.

We see the Mental Ray listed in
the Shading Group.
Open it up.
And voila we can connect shaders, and create our own.
Just click on the “checker box”
And select the “Contour Simple Shader”
See example below:


Now Render your image, and it
should look like mine.
In order to have it not be an outline,
but look like a cartoon.
You can change the Camera’s Output Shader.
And change it into a Contour_Composite shader
Turn Color and Alpha and Contour
on (there’s options where you connect the shader)
Rerender and now your image will look like this:

Now if you turn a shadow on, I
used a raytraced shadow of a light.
It will look like this:

Now if you just turn the Ambient
up on all your shaders it will
Look like this:

ever heard of that trick, where you create a shader manually, that acts like a Ramp Shader
(You connect a ramp to it’s facing ratio of a sampler info)
Do that and you get this:

Now if you go into the Contour Shader options, and set the option to Diff_Index,
(if you
turn Max_level to 2, you’ll create a wire on both
sides)
You’ll create a wireframe render:


Now I’m going to tell you
something cool, in the Materials. I mean
the shaders you can connect any Mental Ray Contour
Material, and they’ll change line
width, or they can create different width according to the camera.
My model wasn’t really meant for
cartoon shading, but it still gave a nice effect to it.
Mental Ray Caustics (this can be added to Global
Illumination, Final Gather or Both)
In other words the way photons refract
true the glass. I’m also going to talk about Dielectric Shader
and the DGS shader.

Dielectric Shading:
This is an interesting rendering
style, mainly used to create glass with liquid inside of them, or just normal
glass.

Ice, DGS material

Ice/ Frosted Glass, DGS material
You create a Phong
shader in the multilister/ hypershade, and just leave it default.
Now click on the “box with arrow, to go to the shaderGRP.

After that you put a DGS material shader
in the Material Shader and you drop a photon DGS
Shader
in the Photon Shader.

Now these shaders
work in relation with eachother, if you change the
material one, you have to change
The photon
one.
Somebody asked me for my
settings, so here they are.

Some explanation real quick for
what everything is:
DSG: Diffuse, Glossy and Specular Reflection and Transmission.
Shiny= this blurs the
reflection, by giving the material more diffuse (sort of bump to the material)
Number:
5/ 12 /
20 create very Blurry reflections
100 or higher almost no blur, and 0.0 just leaves it to be a mirror..
Shiny U and V= great option,
makes the reflection Anisotropic. Same values as Shiny, but they blur in one
direction.
Think of making a metal pan to cook with. The reflections on construction pipers, or air conditioning.
Those are all,
Reflections
that get smeared out.
Transp: is just how
transparent the object should be. 1.0
is totally transparent
And 0 is solid.
IOR= the Index Of Refraction, or
in other words, the refraction index of your material
Glass; 1.6 Diamond; 2.6 Water; 1.2; Frosted glass; 1.4
(you
can look these up online)
Mode= controls the light list (all = 0 ,
inclusive = 1, exclusive = 2)

Now you have to connect he
lights to the photon shaders. I don’t know why you
have to, and it slows down the render time.
I haven’t tried not doing this
yet, I have a feeling it doesn’t really matter, but I’ll explain how to do it.
Open the Outliner, Windows->
Outliner
Go RMB
(right mouse button click/ hold down)->
Show DAG nodes Only (turn this option off)
Now scroll down till you see
this:

Select the DGS_material_photon.
Open the Connection Editor, and Reload this one on the right.
Select your spotlight and load
it on the left.

Now connect “Message” to “Lights”
Voila now your done with that.
You have to do this with all
your DGS/ DiElectric shaders.

These are my spotlight settings.
You see a hundred thousand
photons.
Now I threw in a Physical_Light to get more accurate Caustics.
Here comes the big secret behind
maya and mental ray.
You can up any
value great than you’d think it could be.
Especially with HDRI, this is a
big deal, cause if you want the HDRI map to be
brighter you’ll have to adjust
The V greater
than 1.

You see.
Now do your render and you
object should look exactly the same like mine.
I added another point light with
similar settings to add more light into the glass. (glass
depends on light, if you don’t have enough light it will have dark spots.)
Mental Ray Global Illumination:
Now this is a hard one to
explain.


2 lights, Global Illumination
How does it work.
The photons are comparable to
shooting paintballs in a room. From the
light source, the photons get shot into the room and
whenever it hits a surface creates light more saturated closer to
the distance it was shot from and the farther it will have of course shadow or
less saturation.
What’s great about the photons is
that when you shoot them, they bounce off, therefore creating indirect light,
and that’s what we might refer to as “bounce light”.
Real physical nature has a lot
of the ‘bounce’ going on. Mental ray can use Area light to create a physical
correct environment, think of the ligthboxes in
photography.
The bigger the area light the
softer the shadows. You can use raytrace shadows to
create the most accurate shadow types.

When you create a spotlight you can turn Area light
on, under Area light. The sampling and Low Sampling, create the overflow/
resolution of your shadows.

If we set the intensity to
Linear Decay Rate, we’ll get a more physical light. Now that we set the light
to decay -> linear we have to make the intensity much bigger.

This will just give us light in
the room.
After this we can Emit the Photons. Just go into the light attributes and turn
‘Emit Photons’ on.
The Exponent means how the
‘light flows out into the scene’. It’s like decay.
The energy is comparable to
light intensity, it just fills the room with it’s
light.


Not enough energy is floating in
the room, so lets boost it up a knotch,
from 20.000
To 100.000


At first we’ll just have a
situation like this (one light).
Now we add another light inside
the room, let’s make it a pointlight, with 0 intensity, but we want photons to fill the room.
We’re going to put the decay
rate to Quadratic.
The photons are this time emitted with the energy of 100, and Exponent 2.

You see the room gets a lot more light.

Now you just have to play around
with the settings, but this is the basic principle.
The photon values work as
following.
R G B
Or in other words:
R
= 1.0 = equal to the amount of photons
G
= 1.0
B
= 1.0
A easy diagram:
You cross multiply to get the
photon color values.
I usually set the color selector
of maya to the color I like, and then calculate
The color of your light can be
different from the color that gets bounced of into the room.
Mental Ray Final Gather:

This technique is still my favorite, it’s based on lighting with objects. Final Gather
uses Ambient lighting. Hang on, does that mean I can
just up the ambient
Of any object and the object is
being lit? Yes, even the Camera’s Environment
Color, can brighten the scene.
Nowadays, this technique is used
to create Industrial Design
and Transportation objects. Final Gather, gives metal the best
look, it just looks amazing. What’s also
Great is that you can use normal
maya lights in combination with Final Gather. It’s a
2 for one bonus. With Global illumination, things will start looking weird when
you use normal lights,
In the realm of Final Gather,
things can look awesome.
How to use it?
-01: Turn Mental Ray on; Window->Settings/ Preferences-> Plugin Manager

02: Go into the Render Global
Settings: Window-> Rendering Editors
-> Render Globals
Turn the render using to Mental
Ray, After
that Disable -> Enable default light