Autodesk Turtle is a rendering plug-in for Maya
that allows you to achieve a number to different global illumination effects.
It is particularly useful in getting the most out of baked lighting,
which is commonly used for games and other realtime simulations.
Turtle is available in the Maya Entertainment Creation Suite Premium or Ultimate.
In this movie, we’ll use Turtle to generate an ambient occlusion effect on our flying saucer.
Ambient occlusion is a simple lighting technique you can use
to create convincing indirect illumination or reflection on an object quickly,
and with a great degree of control and portability.
It complements but does not replace global illumination or final gather.
Rather, an ambient occlusion pass gives you a light-weight method
for fine tuning the details of your render.
The technique involves casting a cone of rays from each surface point on an object.
This is referred to as “sampling”.
If the rays reach the sky without being blocked by some part of the surrounding geometry,
then that point is made brighter.
The end result is that areas in the open will be rendered very bright,
while those surrounded on multiple sides by geometry will be rendered very dark.
Start by making sure the Turtle plug-in is loaded in the Plug-in Manager.
A TurtleDefaultBakeLayer also appears in the Outliner.
Open the Render Settings. You can now select TURTLE from the list of renderers.
In the common tab, set the Image Size to HD 720.
In the TURTLE tab, make sure you set the Render Type to "Rendering".
We’ll also set the Anti-Aliasing Min and Max Sample Rate to 2,
to bump up the fidelity of our rendered image.
Finally, assign some Image Based Lighting in the Environment tab.
This will allow us to illuminate our UFO using a color-rich image file.
We’ll use the “mars_sky.jpg” image that we’re currently using as a backdrop for this render.
Make sure to turn off the “Visible in Background” option
so our image is not multiplied to the current backdrop.
Now if you render the scene, you can see that our ship has a reflective surface
with some pretty flat lighting.
Notice in particular that the details around the rim and indentations along the hull are getting lost.
Click the Keep Image button to save this render as a point for comparison later.
We’ll use ambient occlusion to improve this flat shading effect.
Select the ship_body_GRP node under the UFO_GRP node.
This selects all the metal portions of the UFO.
Right-click the UFO and select Assign New Material.
Choose the Turtle-specific “Ilr Occ Sampler” shader. Rename it “UFO_Ambient_Occ_MAT”.
If you render again, you can clearly see the effect of ambient occlusion shading on the UFO.
Areas in the open are bright white, while those surrounded by polygons are cast in shadow.
Note that this occlusion effect is independent of the scene lights,
since it is calculated by using rays casted from the model outward.
The default Turtle occlusion is already set up ideally for our scene.
However, to give you an idea of how ambient occlusion works,
let’s reduce the Cone Angle attribute under Common Sample Attributes to 90 and re-render.
Notice that the levels of shading are much less defined than they were before.
If we think about how ambient occlusion works, this makes sense,
since the sampling distribution is reduced,
resulting in fewer angles from each point being tested.
A similar thing occurs if you reduce the Sampling Rays' Min and Max attributes.
Fewer rays casted from each point makes each point more and more of an estimation of lightning.
As with traditional ray tracing, decreased sampling is faster,
but yields less accurate results.
In this case, we’ll render using the full 180 degree cone angle.
Now we need to plug this shader into the UFO’s original shader.
You could handle this in separate render passes via an external compositing tool,
such as Autodesk Smoke, but for this example we’ll accomplish it using the Hypershade.
We’ll add ambient occlusion to our UFO by first baking the occlusion into a 2D texture map,
then multiplying it to a base material
and feeding that into the diffuse color of the UFO_MAT we started out with.
Keep in mind that baking lighting effects, such as ambient occlusion,
require that you unwrap your model’s UVs beforehand.
In particular, make sure you don’t have any overlapping UVs
otherwise you’ll also have overlapping occlusions as well.
To bake the occlusion, open the Render Settings again and go to the TURTLE tab.
Set the Render Type to "Baking".
Now in the Baking tab, make sure Bake To is set to “Texture”,
since we want to bake this lighting data to a texture and not vertices.
In the Targets section, turn on the “Bake selected surfaces” option
and select the ship_body_GRP node.
In the Texture Bake Settings section, increase both Width and Height to 1024
and turn on the “Merge to one map option”.
This tells Maya to group each object’s ambient occlusion data on the same output file.
We’re going to store the map in the “occMaps” folder of the Turtle project folder.
Name the file “baked_AO.tga”.
You can turn off the "Model View Hardware Visualization"
since we won’t need to preview this effect.
Now click the Render button to bake.
Maya renders the baked Ambient Occlusion map instead of the 3D scene.
Now using the Hypershade, we’re going to multiply our ambient occlusion effect
to a base material to get the final result for our UFO’s material.
Create a MultiplyDivide node.
In the Attribute Editor, click the checker box icon next to "Input 1", and create a new File node.
Load the ambient occlusion map file we just created into the attached file node.
Now we just need a base material to multiply it to.
Create a new Lambert shader and name it “UFO_Base_MAT”.
Right-click the output connections and connect its "outColor" attribute
to the multiplyDivide node's "input2" attribute.
Make sure your multiplyDivide node’s Operation attribute is set to "Multiply".
Now middle-drag the UFO_MAT material into the workspace,
and connect the multiplyDivide node’s output to UFO_MAT’s "color" attribute.
Apply this material to the UFO and its arms.
Open the Render Settings and switch the Render Type back to "Rendering".
Re-render the scene.
The UFO’s diffuse shading is now derived using ambient occlusion.
Use the slider to compare the two renders.
Notice how the addition of ambient occlusion has brought out the details that were washed out
in our non-occluded version.
Because the ambient occlusion effect is encapsulated in its own shader,
you can update the UFO’s base material, with a different color for example,
and still maintain the occlusion.
Right now, the reflection in our scene is calculated via ray tracing.
While this is fine for rendering in Maya, ray tracing is computationally intense
and may not always be a feasible solution.
In the next movie, we’ll show you how to use reflection occlusions
to replace these ray traced reflections with mapped ones.