3D animation tutorials

Sculpting geometry with Maya with the Soft Modification tool.

Organic, hands-on model crafting.

In the video tutorials on 3DbyBuzz, we look at the Sculpt Geometry tool in Maya.  It is a key tool for folks who want to have that sense of crafting an object in a direct, hands-on fashion, almost like you are working with clay.

ZBrush and Mudbox.

This is an important issue, today, as more and more animators move toward Pixologic ZBrush and Autodesk Mudbox – both of which offer an organic sculpting capability for crafting models.  Many animators are creating their characters in one of these applications and then importing them into Maya for refinement, applying materials, and then animating. ZBrush is more popular and more powerful, and offers a Maya plugin.  Mudbox, as it is a companion product to Maya, has a built in workflow that allows the modeler to move smoothly between the two applications.

The Soft Modification Tool.

While the Sculpt Geometry tool, which uses a painting metaphor and can be used with polygon, subdivision, and NURBS models, is very popular, there is another tool in Maya that is also quite powerful. It shares something with the Sculpt Geometry tool, and with another tool that we have looked at in the video tutorials, the Soft Selection Tool: the Soft Modification tool can be carefully tuned to have a drop off effect on geometry surrounding the point of application of the tool.  (The Soft Selection tool is also covered in 3DbyBuzz.

The settings.

This is how the Soft Modification Tool can be activated:


Here are its settings:


Note that the top slider controls the falloff radius.

Using the tool.
Below, we see what happens when we right click, go into Object mode, and select the Moai model we have used in the tutorials and in this blog.  It does the same thing that the Soft Select tool does, using a rainbox of colors to tell us how far outward the tool will have an effect.



It is important to note that the tool needs to have a very low setting on the slider in order to make your modifications localized.

3D animation tutorials

Using Maya expressions and variables to animate models.

In the video tutorials on 3DbyBuzz, we look at using a simple Maya expression to rotate a door knob.  In this posting, we reexamine this and then take a look at two other expressions. Then, at the very end, we’ll look at a few useful MEL system variables, and at defining user variables.

Example 1: Expressions in Maya and the doorknob.

There are many cases in which keyframing the motion of an object is very difficult, in particular, in situations that require precise, cyclic changes in the attribute of an object, or in the relationship between two or more attributes. In the image below, the knob on the door is selected, and then we have right-clicked on the Rotate attribute.  This brings up the Edit Expression option.



The expression editor.
Selecting this in turn brings up the Expression Editor:



We have entered an expression in the Expression Editor – it tells Maya to change the value of the rotation attribute along the x axis over the course of the frames that appear on the timeline.
Specifically, Maya is told to rotate the knob through an entire 360 degrees.
We then hit Create on the Expression Editor.

Example 2: Applying an expression to the visibility attribute of an object that has a material with a glow intensity.
Let’s do another example.

The foggy street.
In the video tutorials on 3DbyBuzz, we made use of a street scene, with a sidewalk, pavement, grass, and fog.  We inserted the of lights of a car.
What we’ll do here is color those lights, one red, and one blue, and then have them flash on and off randomly.

Lights that are not lights.
Here’s the important point, though: these “lights” are actually spheres with blinn materials that have a glow intensity.  They are not Maya lights.  Here is the attribute editor after we have selected the blinn material for one of them:



What we will apply our expression to is the visibility of the two spheres – not to the material on the spheres.

Assigning an expression to the visibility of an object.
Below, one of the spheres has been selected in the main window, and we have opened up the Expression Editor by going to Window at the top of the Main Menu, selecting Animation Editors, and then choosing Expression Editor.  Then we clicked on the visibility attribute in the second column from the left.
Here is the expression after we have typed it in and hit Create:



The expression makes use of a random function with reevaluates the visibility of the sphere for every frame.  This is a great function to have – because one of the most difficult things to do is to generate what appears to be random values.

We then must do the same thing to the other sphere.

The result.
Finally, here is a sequence of three frames, taken across a series of 30 frames:




Now, we have flashing emergency lights, perhaps from an approaching police car.


Example 3: our squashing ball.
In a previous posting of this blog, we looked at using a Squash deformer to flatten a ball when it hits the ground.
You might remember that we also wanted the ball to stretch out as it rose up.  We did this by using the scale tool and keyframing the ball stretching out as it went up.
We’ll do this again, but in reverse, and not by using the scale tool.  We will use a squash deformer when the ball hits the floor, as we did before.  But we will use an expression to stretch the ball out as it comes down.

The stretch expression.


The result.



Notice the squash deformer, which we introduce just before the ball hits the ground:


Useful MEL variables and user defined variables.
System variables.
Here are some useful facts about MEL variables:
currentTime is a system variable which contains the current timestamp.
frame is a system variable which holds the current frame number – this is very useful, since expressions get evaluated on every frame.

User defined variables.
Variables created by the programmer, always have a $ in the front, e.g.: int $buzzint;.
Keep in mind that after the $ there has to be a character, and not a number.
Another example of a use variable: float $buzzarray[] = {1.1, 32.2, 23.3, 14.4, 45.6}; 
One more example: matrix $buzzmatrix[9] [2] ; 
There are also local and global variables.

Local variables.

Here are two local variables:
{ int $kingint = 1; int $buzzint = 0; if ($kingint = 1) print ($buzzint); }; The squiggly parens mark the scoping of the two variables.

Global variables.
This program will print the same result as the one above, but it contains a global and a local variable:
global int $kingint = 1; proc buzzproc() { int $buzzint = 0; if ($kingint = 1) print $buzzint; } buzzproc();

Control structures.
Lastly, we note that MEL has a handful of control structures.  Here is an example:
global int $kingint = 1; proc buzzproc() { int $buzzint = 0; while ($buzzint < 3) {print $buzzint; $buzzint = $buzzint – 1; }; } buzzproc();
Note that this program will run forever…

3D animation tutorials

Using anisotropy with mental ray to control the transparency of frosted glass.

In the video tutorials on 3DbyBuzz, we used the mental ray mia_material and its frosted glass preset to create frosted glass doors for a closet.

In this posting, we focus on one particular setting for the frosted glass, Anisotropy.
Anisotropy is an attribute that can be set in the mia_material attribute box.  This controls highlights that run across the scene in multiple directions.

Anisotropy settings.
In the image below, we see the Anisotropy settings for the mia_material that makes up the frosted glass of our doors.


Set to 1.
Below is a render resulting from an Anisotropy setting of 1, meaning that the left-right and up-down values of the highlights are equal, or more precisely, that the highlights are even in all directions.
Thus, the glass doors blur the white shelves behind them.


Set to 10.

Below, the setting is 10, creating a highlight that is not equal in all directions.  In particular, the top-down highlights are softer than the left-right highlights. The effect is to undo some of the frosted effect of the glass, as the highlights don’t blur the shelves as much. You can think of it this way: in order for the horizontal shelves to be distorted to the point of not being easily visible, the white coloring of the shelves needs to be moved upward and downward.



Set to 100.

If we crank it up even more, we see that the highlights are very weak in the top-down direction (compared to the left-right direction).  So there is now virtually no frosted glass effect.


A number less than 1.

Below, we see what happens if you set the number to .1.  Now, the highlights are greater up-down than they are right-left, and the doors are distorted again.


3D animation tutorials

Using ambient occlusion with a mental ray material.

In the previous posting of this blog, we looked at a few ways of manipulating light in a Maya scene, focusing on the mental ray renderer.  We looked at global illumination and final gathering, caustics, and irradiance. Now, we look at another way of fine tuning light effects with the mental ray renderer on Maya.

A sample model.

In this lesson, we will use a scene built by Dreamlight.  It is called La Piazza Realistic Mediterranean Town, and was originally built for Daz3d.  I exported it out of Daz3d as an FBX file and then imported it into Maya.  I then replaced the materials on the central tower in the scene with a mia_material that is colored a light tan.  We will only look at a piece of the scene.

Ambient occlusion.

The mia_material has a special setting called Ambient Occlusion:


Without ambient occlusion.

Here is the rendered scene, using mental ray, and with Ambient Occlusion on the mia_material settings not checked off:


Note that the left face of the tower is hidden in shadow.

With ambient occlusion.

Here is the same scene with ambient occlusion turned on:


Note that now, we can seem much of the detail on the left face of the tower.

What happened?

Importantly, remember that ambient occlusion is a property of the material that is on the tower.  The rest of the scene does not have a mia_material on it. By turning on ambient occlusion, we are telling the mental ray renderer to not let the strong spotlight that falls on the right side of the building wash out the right side and cast the left side into shadow. Importantly, there is a second light in the scene, an ambient light.  When we turn on ambient occlusion, we are telling Maya to pay less attention to the spotlight and to let the effects of ambient light effect the material.

With only ambient light and without ambient occlusion.

Now, here is a rendering where the spotlight has been turned off and ambient occlusion on the mia_material is turned off.  Left click to enlarge it:


Wow!  it turns out that the mia_material, without ambient occlusion, will not accept the effects of ambient light.

With only ambient light and with ambient occlusion.
Now, with only the ambient light turned on, but with ambient occlusion turn on in the attribute editor for the mia_material, we get the following.  Please note that the ambient light had to be made much stronger in order to light up the tower by itself:


The lesson.
With ambient occlusion turned on, and with the spotlight turned on, mental ray accepts the effects of ambient light and so the ambient light created by the spotlight and the ambient light illuminates the tower, making the detailed light and shadow of the tower more visible.
With ambient occlusion turned on, and with only the ambient light turned on, the ambient light by itself lights up the tower.

A proper rendering.
Because my manipulation of this scene does not do the artist’s work justice, here is a rendering of the center of the original scene, created by the Daz3D renderer.  Left click on the image to enlarge it:


3D animation tutorials

Global illumination, final gathering, caustics, and light emitting materials in Maya, using mental ray.

In the video tutorials on 3DbyBuzz, we look at the basics of creating lights in Maya, using ray tracing, and manipulating shadows.  We also look at the rudiments of global illumination and final gathering.  And we look at depth map versus ray traced shadows. In this posting, we review final gathering and then look at a couple of new things: caustics and irradiance.  Our goal is to look at a few different ways of adding light effects to a scene. We will be using the mental ray renderer for this posting.

Global illumination and final gathering.

We use these two options to add more light to darkened areas of a scene. As a reminder, final gathering, which is an option you can set in the mental ray renderer, adds some extra computations to the ray tracer, and in doing so, fills in dark areas.  These often occur when one part of a model is casting a shadow on itself.  By using final gathering, we put some extra rays in those little spots. If we go to Window, choose Render Editors, and then Render View, we can select mental ray, and then go to the Indirect Lighting tab and choose Global Illumination. We will also turn on Final Gathering, which does a similar job, but is less effective.



 Below, is the before and after. Without global illumination and final gathering.  Notice the area around the brass bolt.




  With global illumination and final gathering.  Look at the same area:




We use caustics to create the harsh light reflections and refractions we often get when light hits a glass object. We will manipulate both the lights in a scene and the mental ray settings to get caustics. We will use a scene that we have seen in the tutorials on 3DbyBuzz.  We have a NURBS curve that has been revolved to make a dish.  On it we have placed the mental ray mia_material, with a ThickGlass preset:



We apply this material to the dish by selecting the dish in the Main window, then right clicking on the material, and then assigning it:



 First, here is a scene without caustics:



  Now, we turn on Caustics in the mental ray render settings:



Now, we turn on photon emitting in the attributes of the dominant light in the scene, which happens to be a spot light with a wide cone.  The other light in the scene is also a spotlight with a wide cone, but its intensity is much lower.



  Now, we render the scene again:



 Light emitting materials: Irradiance.

First, we choose a highly reflective material from the mental ray list of materials.



We apply this material to the dish by selecting the dish in the Main window, then right clicking on the material, and then assigning it:



Now, we turn our two spotlights in the scene down low and render. There is very little light in the scene:



Now, we turn up the irradiance of the material.

Below is the result.  We have a sci-fi goblet.



3D animation tutorials

Placing fill lights in a Maya scene.

Lights in Maya.

In the video tutorials on 3DbyBuzz, we have looked at creating the various kinds of light that are available in Maya.  One thing we have not looked at is using lights as precise, local fill lights.

Fill lights.

We create lights by going to Create on the Main Menu and going to Lights. Here is a rendering of the Moai statue we have used in the videos.  The only light is a directional light.


Softening the nose shadow.

Now, we create a point light and locate it near the left bridge of the nose.



We have softened the shadow.

But, what about Volume lights?

You might think that the best kind of light to use for very refined control would be a Volume light that is set to shine inward:


But the problem is that Maya 2013 seems to have a lot of trouble rendering volume lights with either the Maya software renderer or Mental Ray.  It simple seems that the light does not exist. But if we want to use the Hardware renderer, it will work:


3D animation tutorials

Using the Append to Polygon tool for connecting two stairs.

Connecting two carpeted stairs.

In one of the videos on 3DbyBuzz, we looked at connecting two carped stairs and noted that we have to model the offset of the front face of the top step from the bottom step, so that the carpet would pull backward over the lip of the top step.  We used NURBS tools to do this.

Polygon stairs.

Here we take a quick look at doing a similar thing with polygon modeling. First, we create the two planes need for two steps. Importantly, we must use the Combine tool and create one object out of the two.  This tool is found by changing the Main Menu Selector in the upper left corner of the main Maya window to Polygons.  Then we choose Mesh and then select Combine.



The planes are not connected yet, but they are one object.

The Append to Polygon tool.

Now, we go to Edit Mesh and select Append to Polygon Tool.



  Then we select the two edges of the two polygons that are closest together.


Then we hit Enter – and the two planes are connected by an angled polygon, creating the the offset of the carpet from the front of one step to the top of the other.



3D animation tutorials

Using the Lattice Deformer to damage our mailbox.


In the tutorial videos on 3DbyBuzz, we have looked at the use of deformers to alter that shape of an object, either for the sake of creating the model itself or to deform and thereby animate the shape of an object over a series of frames.

The Lattice deformer.

In this posting we look at a deformer we have not examined yet: the Lattice deformer. The deformers can be found by setting the Main Menu Selector on the upper left hand side of the Main Maya window to Animation.  We then go to the Create Deformers dropdown. We choose Lattice Deformer:


The tool settings.

Here are the settings for the tool, which we get if we click on the little square box to the right of the Lattice entry on the Create Deformers dropdown:



Notice that there is an advantage to manipulating the mailbox via a lattice deformer instead of by manipulating the wireframe of the object itself: we can control the area over the surface of our mailbox that is deformed by adjusting the divisions and other settings of the deformer – and not by actually altering the density of geometry of the object.



Vertex mode on the deformer.
Now, we select vertices on the deformer and move them.  (They are called Lattice Points, not vertices, actually.)



The result.
After we move the lattice points, we get:



A note on the deformer tool.
Here are the tabs that appear when we create the lattice deformer.  Note that there is a tab named ffd2Lattice.  (The 2 merely means that this is the second lattice deformer I created in the scene.)
When you change the shape of the lattice by moving lattice points around, you change the values under the ffd2Lattice tab, and this in turn alters the shape of the model.  You can update the values under the tab (instead of moving points around) and this will alter the model.



3D animation tutorials

Filling in a face on the Moai with the Bridge tool

Filling in a hole in a polygon model.

In recent postings, we’ve been looking at using various polygon tools to manipulate a polygon model.  Today, we look at fixing a hole in a model.

The hole.

Sometimes, as we manipulate a polygon object, having been doing such things as adding and removing edges, extruding faces, combining multiple polygon objects into a single object, etc., we discover a hole where we need a face. Consider the Moai below, which we have used in the 3DbyBuzz video tutorials. There is a missing polygon on the side of the nose.



Edges and bridging. So, we right click and go into edges mode.



Then we select two edges.  Then,we select the Bridge tool from the Edit Mesh drop-down.  (Note that we have to have the Main Menu Selector in the upper left corner of the Maya interface set to Polygons.)



Too many polygons.

We succeeded in filling in the hole, but there are multiple faces where we only want one.



  So, we hit control-z until we undo the Bridge operation.  Then we select the Bridge tool again, and this time click on the little box to the right of the tool’s name and pull up its settings.  We chance the number of subdivisions to 0 and try again.



The hole filled in with one face. It worked.


Final note.
One caveat — when you use the Bridge tool, all selected edges must be on the same object.

3D animation tutorials

Removing a window with Merge to Center

Removing a window.
In the previous blog posting, we looked at merging edges.  In this posting, we use another tool on the same drop-down menu: Merge to Center, and we use it to move a window from a glass door.
Here are the closet doors we’ve used in the tutorials in 3DbyBuzz:


Choosing four edges and the tool.
We select four edges around the window.  (They are in orange and surround the upper left window of the left door.)  Then we choose the tool:


The result.


The result rendered.


3D animation tutorials

Merging edges in a single piece of geometry

Fixing a mailbox.

In one of the 3dbybuzz videos, we made a mailbox out of a single polygon object.  We created a lid by selecting a ring of vertices and separating the object into two pieces.  Note that it remained one object:


The problem is that the bottom edge is separated from the rest of the mailbox:


Perhaps we should have left that edge connected so that we could more naturally animate the mailbox.

The Merge Edges tool.
So, we put the Main Menu Selector on Polygons, then we go to Edit Mesh and select the Merge Edges tool.


mailboxlinedup-2013-02-8-21-52-1.jpg mergeedgetool-2013-02-8-21-52-1.jpg

We then select the two edges along the bottom that connect the lid to the body of the mailbox.  Then hit Enter.


Before and after.


Above is the before hitting Enter…  Below is after hitting Enter.


3D animation tutorials

Coloring a material with lights

In the previous posting we looked at using a Mental Ray material to make colored glass.  We manipulated a color attribute of the material.

Coloring the light, not the material.

In this posting, we color a bowl by using the lights that are shining on it. Here is the Mental Ray material’s attributes; we are using one of the metallic paint materials:



Note that the colors of the material are all set to white.

The lights.

There are two spot lights shining on the bowl.  They are between the bowl and the viewer, pointing directly at the bowl. Here are their attributes:




Notice that we are using two different yellow-ish colors. (Note that the brown background is not influencing the color of the bowl.)

The result. Here is the rendering:



3D animation tutorials

Making colored glass in Maya with Mental Ray

In this posting, we will make a colored glass door for the closet we used in some of the video tutorials on 3DbyBuzz.

Mental Ray glass material.

First, we go to Window on the Main Menu, then choose Rendering Editors, and then Hypershade.

Then we go to the list below the words “mental ray” in the hypershade and create an instance of a material called mia_material.


Coloring the glass.

We go to the Main window choose the preset GlassThin for our material, and we select Replace:


Then we click on the Refraction color and set it to a dark yellow:


Assigning it to the glass door.

Then we shift-select the four panes on our right hand door, go to the Hypershade, and then right click on the material and hit Assign Material to Selection.

The result.

Then we render with the Mental Ray renderer:



3D animation tutorials

Using soft body dynamics to age a Moai statue

Today, we look at using soft body dynamics to age a Moai statue.
The polygon Moai.
Here is the Moai statue that we have used in videos on  3DbyBuzz.com.  It was made out of stone a long time ago.  It has sat in the open on a wind-swept, treeless island for many hundreds of years.        moaisoft-2013-02-5-18-10.jpg
Turning the Moai into a soft body.
We set the Main Menu selector in the top left corner of the Maya Main Window to Dynamics.
Then we select the Moai, go to Soft/Rigid Bodies and choose Create Soft Body.
Now, our Moai will be influenced by dynamic forces.


Introducing a field.
Now, with the Moai selected, we go to Fields and Select Turbulence.  It is not shown here, but the Magnitude of the field is about 40 – not too strong.  We don’t want to blast our Moai away.  Also, the Phase x and Phase y settings of the Turbulance tool are set to -1.


Before and after.
This is the Moai before running the scene:


Here is the Moai after running about 100 frames.
The turbulence has gently eroded the nose and the mouth and the jaw.
If we want, we can move the turbulence field around and age more of the Moai’s face.

3D animation tutorials

Using the Graph Editor in Maya to fine tool animation

Maya’s Graph Editor. In the videos at 3DbyBuzz, we’ve looked at the Graph Editor and how it can be used to adjust motion and to reuse motion cycles.  Here, we look at one specific feature of the Graph Editor and how it can be used to fine tune the keyframing of objects in your scene. (Note: left click on images below to enlarge them in your browser.) This is the top of the Graph Editor:


Frame and Value.
Notice the two boxes in the upper right corner.  When they have values in them, they are pinkish-purple.  Values appear in there whenever some curve in the Graph Editor is selected.
Remember that the Graph Editor shows the Translation (movement), Rotation, and Scaling of objects in your scene as the frames go by.  The Frame box gives you a frame number and the Value box gives you the value of a given point.
Our closet.
Below is the closet that we have used in a few of the 3DbyBuzz videos.  Notice that the left door is selected.
closetopen-300x196-2013-02-3-16-49.jpgIf you left click on the closet, you will see that two keyframes (in red) are showing down on the Timeline.  The first is when the left door starts to move and the second is when it shuts.
The rotation curve.
In the image below, we see that the Rotate x curve is visible.  This tells us how the door rotates over a series of frames.  In the image, it is moving between frame 11 and frame 36,  just as our keyframes in the image above suggest.
Here is a closeup of that curve:


The Rotation Curve
This is what the curve looks like if we click on Frame 36 on the Timeline and then select the curve in the Graph Editor:


Notice that the frame number is showing in the Frame box.
Here is what the scene looks like on Frame 36.


Changing the number of frames it takes to close the door.
Notice that the vertical red line tells us what frame appears in the Frame box.  Let’s change the keyframing so the door closes only part of the way.  Here is what we put into the Value box:


The effect.
Here is what happens after we press Enter.


In general we can add, subtract, multiple, and divide values by adding expressions to the Value box.  Here, we have made the door close only halfway instead of all the way.

3D animation tutorials

Creating an ocean water swell in Maya

We will create a swell of water that ripples outward in Maya. The setup. Below is a polygon plane that has a high vertex count.  Above it is a polygon sphere.


The ocean is made of cloth.
Here is the attribute editor of the plane.  This is after selecting the plane and setting the Main Menu Selector to nDynamics, then going to nMesh and selecting Create nCloth.  The vertices of the plane have been turned into particles.


The ball is under the power of gravity.
Next, we place the ball above the plane, select the ball, and then select Fields, then Gravity.  (You might want to check the attributes of the gravity field to make sure it is going downward in the  y dimension, in case the default is set otherwise.)
The plane has an ocean shader on it.
Then we go to Window, choose Rendering Editors, then Hypershade.  Then click on the Ocean Shader to make an instance of it.


Next, we select the plane in the Main window.  Then we select the ocean shader in the Hypershade, right click, and choose Assign Material to Selection.
The ball falls through the water.
Then we set the scene up with perhaps 200 frames.  We then play the scene, with the ball starting up in the air and falling through the plane.
Here is what it looks like after the ball passes through.


The water creates a rippling swell.
As the scene continues, the water develops a deep swell that ripples.
Here are three frames.  The first is BEFORE the ball falls.  The second is after the ball has just passed through, and the third is a number of frames later:





3D animation tutorials

Bouncing a squishy ball

We will use a deformer, the scale tool, and keyframing to bounce a ball so that it squishes on the ground and then stretches as it bounces up. (You can left click on any image below to blow it up.) The ball. First we create a NURBS ball. The Squish Deformer. Then we select the ball and create a Squash deformer from Create Deformers (on the Main Menu with the Main Menu Selector set to Animation).


Squish the ball. We then place the ball on the lower plane and then select the deformer.  We use the move tool to lower the pink deformer handle inside the ball to squish the ball.


  Keyframe the ball. We then keyframe the ball to go up and down over a series of at least 75 frames (so we can easily see it move and deform).  This is how we set the keyframes: Stretch the ball. We start at the top and set the first keyframe there (with the s key). But before we set the keyframe, we  use the scale tool to stretch the ball out top-to-bottom. Bounce the ball. Then we go to frame 30 or so, move the ball to the ground (and the deformer will automatically squish it for us).  We set the second keyframe it there. Stretch the ball. Then we keyframe it at the top again, at perhaps keyframe 75. But again, before we set the keyframe, we  use the scale tool to stretch it out top-to-bottom again. Run the scene. We see it fall and squish, then bounce and stretch.  Maya even makes it stretch gradually as it moves upward.