How to Model a Low-Polygon Butterfly and Animate Wing Flapping in Autodesk Maya

Let me preface this tutorial by saying that I am by no means an expert in Maya. I just picked up a couple of cheap used books through Amazon and taught myself. I have goofed around with Maya in my spare time for about the last 3 years, so I  definitely understand the frustration and confusion many first-timers have had using this. Hopefully this tutorial will help and if you have any questions or get stuck, please feel free to leave comments.

This is a beginner’s tutorial. We will walk through:

  1. Basic modeling using polygons. We’ll take basic shapes (primitives) such as cylinders, cubes, and a sphere and then tweak them to our needs.
  2. Adding polygons to “smooth” out the models to make them look  more organic. In other words, less like a pointy, ugly computer-made model.
  3. Material selection. We’ll discuss why the materials have strange non-intuitive names and when to use certain materials (and when not to). Why a Phong can represent plastic and a Lambert can represent a piece of paper.
  4. Rigging the model for animation using simple but powerful techniques. We’ll make our own “Flap” attribute and using the Set Driven Key set it up to make the wings flap in simple and elegant way (saving time when it comes to animation).
  5. Basic animation. We’ll be keyframing basic movement, but we’ll also touch on the Graph Editor and automate cyclical animations saving us a tremendous amount of time. We’ll be using our custom “Flap” attribute that we rigged.
  6. Basic rendering settings. Some tips on what exactly you should be getting out of Maya, and then what to do with it.

And as a bonus– a pretty 45-second final effect video at the bottom!

Sponsor

Step 1 – Modeling

Create a new scene (File -> New Scene). Next create a polygonal cylinder (Create -> Polygonal Primitives -> Cylinder).

Step 2

Click on the cylinder. Open up the channels box. Change the Rotate X value to 60. Click on the polyCylinder1 to change radius to 0.8, height to 4, subdivision axis to 17, and subdivisions height by 5.

Step 3

Click on the cylinder to select it. Right click and then move the mouse to select Vertex.

Step 4

Select some of the vertices using the select tool or the lasso tool. Use the scale tool to expand out the middle as you see fit. Check the next few pictures to see how I did it if you are unsure how much to expand them out.

Step 5

When you are finished scaling/moving the vertices create a polygon cube and position it next to the body.

Step 6

Select the cube and in the channels box, change the parameters. Make the rotate X -20, width 2.3, height 0.3, depth 3.5, subdivision width 3, subdivision depth 4.

Step 7

Next right click on the cube and select Vertex similar to step 3. Now select each pair of vertices (one on the top of the cube and one on the bottom) and either click on the Move tool or press W on your keyboard and then drag the move handles on the screen to move each vertex pair into a wing shape.

Step 8

This part is sort of optional. Basically I selected a few of the vertices (1 at a time instead of the pairs before) and moved them around as shown in the picture. This is to make the butterfly wing look a little more organic and provide some contours. Just play around with it as you see fit. I figured the ends should be a little skinnier than the fat middle so I tried that. Just select each vertex and press W on your keyboard and then drag the move handles.

Step 9

With the cube/wing selected, right click until the menu shows up and then select object mode.

Step 10

Now that the wing is selected as an object, we are going to duplicate it. Go to Edit – > Duplicate Special and click the box [] to the right. A new window should pop up. If you look at your scene, you should see a red/green/blue x/y/z coordinate map. Notice that if we were to scale the x plane by -1 we would have flipped the wing over. We also need to translate it some in the x direction so it doesn’t duplicate on top of the current wing. If you set up your scene slightly differently, (i.e. your wings were in the y axis instead of the x axis, change the second box instead of the first one).

Step 11

After you have duplicated the wing successfully, go ahead and make a polygon sphere primitive (Create -> Polygon Primitives -> Sphere). Position this at the top of the body as shown. (Use the move tool while in object mode; see above steps if you need help).

Step 12

Now create a long skinny cylinder polygon primitive (Create -> Polygon Primitives -> Cylinder) and position it above the head.

Step 13

Next click on the polyCylinder2 in the channels box. Change the radius to 0.1, height to 2.2, subdivisions axis to 15, and subdivisions height to 5. The height and radius are set assuming the scaleX, scaleY, and scaleZ are set to 1.

Step 14

Next right click on the cylinder until the menu pops up and then select vertex. Select the vertices by the group shown and use the move and rotate tools to make the cylinder look like a bug antenna.

Step 15

Once the vertices are positioned as you like them, right click on the cylinder until the menu pops up and select object. Next go to Edit -> Duplicate Special and click the box [] next to it. This time we’ll translate it by a small amount in the x direction and again use the scale: -1 to flip it. As mentioned earlier, if your axes are different change the second or third box in the duplicate special window to achieve the desired result. You can keep tweaking the settings, hitting Apply, and then Edit -> Undo until you figure it out.

Step 16

You’ll also want to rotate the antennas while in object mode and move them a little bit so aren’t sticking straight up. Try to create some sort of asymmetry (rotate one more than the other, or go and modify some of the vertices again) so the butterfly looks more organic than computer-made. Remember we duplicated them so they are identical which isn’t the most “organic” looking. A good workflow that I have found is to create as much symmetry as possible initially (to speed up the modeling process) but at the end go in and tweak the objects to make them look more life-like.

Step 17

Now we are done with most of the modeling. Let’s rename some parts to get organized. A great tool is the Outliner and you can open it by going to Window -> Outliner. Once that is open, click on the first part. In my case that is the pClyinder1. In the channels box I’ll rename it to body. Just click on the pCylinder1 in the channels box and you’ll be able to rename it.

Step 18

I repeated this until I renamed all of the parts. I named the wings lWing and rWing to correspond with the left and right wing.

Step 19

Next we’ll parent everything to the body. You can do this a couple ways. In the Outliner you can select the lWing and then hold the middle mouse button (MMB) and drag the lWing into the body. You’ll see a little plus sign [+] when you do this. Alternately you can click on the lWing FIRST and then the body SECOND and go to Edit -> Parent. Do the same for the remaining body parts until they are all parented to the body.

Step 20

I renamed the body to Butterfly. Notice now that if you click the Butterfly in the Outliner everything is selected (all body parts). If you click on the body on the screen all other body parts will be selected as well. If you click on the body and ONLY want the body selected (not everything else) click the down button on your keyboard to traverse the hierarchy that you set up.

Step 21 – Smoothing

Next we’ll start to smooth out the shapes. This is the process of adding more polygons to make the object look smoother and more organic. The more polygons the better the object looks, however this increases the computations necessary to display and interact with the model. This is especially important when rendering your objects. More polygons means a longer rendering time. Also if you are designing for video games your game processor (computer, xbox, playstation, gameboy, etc) will throw a hissy fit if you have too many polygons that the game has to deal with. To add more polygons, select one of the wings. In the polygons menu set, go to Mesh -> Smooth and click the box [].

Step 22

In the smooth options window select 2 for the number of division levels. This adds more polygons than if you were to select 1 division levels. Click apply to apply the changes and leave the window open.

Next you can click the other wing and hit apply again. Go ahead and do the same for the body. Remember that since you parented everything to the body, when you select it ALL body parts will be selected. Press the down button on your keyboard to select just the body alone. Hit apply to apply the smoothing. For the antennae we don’t need so many polygons so we can drop the division levels down to 1 for those two parts. When you are done close the smoothing window.

Step 23 – Rigging

Okay now the modeling is done. We’ll now rig the model for animation by creating our own “flap” attribute for the butterfly so we can keyframe the wing flapping. For an experiment, click on one of the wings and then use the rotate button (or press E) to rotate the wing like it is flapping. Notice that the wing is rotating around its center. This doesn’t make as much sense as if the wing was rotating around its edge. With the wing selected and the move tool selected, press the Insert button on your keyboard. This makes the pivot location show up. Drag it closer to the edge of the wing instead of the center of the wing.

Step 24

Do the same for the other wing, bringing the pivot location closer to the edge (near the body). Now if you were to rotate the wings (just click and drag on the one circular arc) you’ll see that they rotate more naturally around a pivot near the center of the body. Press undo to return the wings back to their normal (resting) position.

Step 25

With the wings back to their normal position and the Butterfly selected go to Modify -> Add Attribute. With the window open name it Flap, make sure the attribute is keyable, the data type is float, the attribute type is a scalar, the minimum value is -20, maximum 20, and a default of 0. Click add to add the attribute.

Step 26

If you did step 25 right and with the Butterfly selected you should see a new attribute in the channels box.

Step 27

With the animation menu set active, go to Animate -> Set Driven Key -> Set….

Step 28

We’ll use our new Butterfly Flap attribute (the driver) to drive the lWing and rWing rotations (the driven). With the Butterfly selected, click Load Driver. Now click on the left wing and hold shift and click on the right wing. With both of them selected, click the Load Driven button.

Step 29

Okay this might be a little confusing but save often and make religious use of the undo command if things start to fail. With the set driven key window still open, we’ll rotate the wings in the up position. Just select each wing and use the rotate tool to rotate them up.

Step 30

This part can be tricky. With the wings rotated up select the Rotate X, Rotate Y, and Rotate Z in the driven window. Make sure both lWing and rWing are selected. Now click on the Butterfly in the driver window and make sure Flap is selected. With the Butterfly selected go into the channels box and make our custom Flap attribute 20. Once that is all done click the Key button in the Set Driven Key window.

Step 31

Now select the wings and rotate them down. Click on the Butterfly and change the flap from 20 to -20. Make sure everything is selected as shown and hit the key button. You can close the Set Driven Key window now.

Step 32

Assuming you did everything correct you should be able to try out the new Flap attribute now. Remember that the Flap attribute was set up for the Butterfly, not set up for a certain component like the wing or the head or something. Click the Butterfly (which is the body of the butterfly because that is the parent and all other pieces are its children) and in the channels box try out some values in for the Flap (in the range of -20 to 20). A neat little trick is with the Flap attribute selected, click and hold the middle mouse button and drag it across the screen. You’ll see the butterfly flap its wings.


Step 32.5 – Understanding Materials

Now that we are done rigging the model, let’s pick out some materials. Bring up the hypershade window by going to Window -> Rendering Editors -> Hypershade. This window allows you to create all sorts of materials and textures and preview them on little balls before you apply them to your scene. The materials that you use also depend on how you are rendering (whether with maya software, maya mental ray, or some external 3rd party rendering engine). For photo-realistic (and super long renders involving complex ray-tracing algorithms) we would select mental ray. However for this tutorial we will use the maya software rendering engine because we don’t want to be sitting around 5 minutes for 1 frame to render out. Especially if we are doing a 10 second animation at 30 frames a second.. 300 frames to render!

Commonly used materials for maya software renders are Lambert, Blinn, and Phong. The funny names are  named after the mathematicians/computer scientists who developed the algorithms that the computer runs when trying to make an object look a certain way. Lambertian materials are defined as having the same apparent brightness no matter what the viewing angle is. In other words, they won’t be shiny when you rotate/tilt them to catch light’s reflections. Some real world Lambertian surfaces are pieces of paper, the walls in your house, or anything else that is not glossy or shiny. Phong and Blinn shading look pretty similar, but that is because Blinn shading is a modification on the original Phong shading. In some scenarios it will create a slightly more realistic representation of surfaces than Phong. Blinn and/or Phong shading does NOT make the assumption that a material’s apparent brightness is the same depending on the viewing angle. In other words, as you rotate a glossy piece of plastic or a ceramic mug or a look at a marble floor from different angles you will catch bright hot-spots of light. If we are making a pretty little butterfly that “catches the lights’ rays” as it flutters about we’ll be selecting Blinn for our materials.

Step 33 – Material Selection

With the Hypershade window open you should see three materials already in your work area. Don’t worry about them; they are the default materials. As a matter of fact, that lambert1 material looks a lot like your butterfly right now… but we’ll fix that. Under where it says Create Maya Nodes, click on the Blinn material.

Step 34

After you click on a Blinn material, a new blinn1 material should show up in your Work Area. Select the new blinn1 material in your Work Area and then open up the Attribute Editor. Rename it from blinn1 to something more useful: body_blinn, because this will be the blue body of the butterfly. Click on box next to where it says Color and a color wheel / picker window will pop up allowing you to pick a bright blue. Finally, slide the Ambient Color slider to the right a small amount.

Step 35

Now we’ll make the wing material. Click on the Blinn under Create Maya Nodes again to create a new material that will show up in your Work Area alongside your body_blinn. With that new blinn2 selected and in the Attribute Editor again, rename it to wing_blinn. Click the color box and choose a bright pink/red. We’ll slide the Transparency bar to the right a little to make the wings appear somewhat transparent, and we’ll slide the Ambient Color bar to the right a little to make it “naturally brighter”. In other words, we’ll require less light from our light source to make it appear bright.

Step 36

Lastly we’ll make a dark green blinn for the antenna. Click blinn to create a new maya material node, in the attributes editor rename it to antenna_blinn, and choose a dark green in the color box.

Step 37

With the three materials made, go ahead and close the Attribute Editor. Back on your model, click on the wing to select it. Then right click and wait for the options to pop-up. Move your mouse down to Assign Existing Material and choose wing_blinn. An alternate way of assigning materials is with the Hypershade window open, click with your middle mouse button on a material in there and then drag it over to your object and release the button. You might notice by now that in Maya there’s about 10 different ways to do the same thing.

Step 38

Finish assigning the existing materials that you just created to the rest of the body parts. Remember that because of you parented the wings, head and antennae to the body, when you select the body you will select everything. Press the down button on your keyboard to select just the body.

Step 39 – Animation

Now with the model appropriately textured let’s do some animation. Our goal is to have the butterfly flap across the screen. At the bottom of your screen you should see a time slider and a range slider. If they aren’t there, go to Display -> UI Elements -> Time Slider and Range Slider. The default setup is 48 frames total with 24 of them viewable at a time. If we want a 10 second animation at 24 frames per second (this is common for film and movies), we’ll need a total of 10*24 = 240 frames. Change the default 48 to 240. In order so that we don’t only see the first 24 frames of the 240 total, change the default 24 to 240. You can click and drag around on the frame slider to select which frame you are currently viewing.

Step 40

Make sure that you are on frame 1. Click on the body of the butterfly to select the whole thing and with the move tool, drag the butterfly to the left of the screen. Open up the channels box. Depending on which way you moved your butterfly, you’ll see some values for the Translate X, Translate Y, and Translate Z. In my situation I dragged by butterfly in the Z direction only. Nonetheless, we’ll just key all three directions to be sure. With all three Translates selected, right click and select Key Selected.

Step 41

Now the first thing we need to do is change the frame to 240. Either type it in the box or drag on the slider to get to frame 240. Now with the move tool and the butterfly selected, drag it to the right of the screen. If you tried to move the butterfly first and then change the frame, the butterfly will jump back to its original position. With the butterfly selected and to the right of the screen and the channels box open, you’ll see that there are new values for the Translate X, Translate Y, and Translate Z. Select all of them and right click and then choose Key Selected.

Step 42

Now hit the play button to watch your animation. In my screen shots it is the red stop button because it is already playing. You should see the butterfly glide across the screen. Sort of boring. Next we’ll add some flapping animation.

Steps 43

Slide the time slider back to frame 1 (or type 1 into the current frame box). With the butterfly selected, open up the channels box. Enter in a value of 20 for our custom Flap attribute that we created earlier in the tutorial. Right click on the Flap and selected Key Selected.

Step 44

Next slide the time slider to frame 30 (or type in 30 in the current frame box). Flap should already be set to 20, but we need to key it in. Right click and go to Key Selected.

Step 45

Now we’ll slide to frame 15 (or type it in) and change the Flap attribute to -20.  Right click where it says Flap and go to Key Selected.

Step 46

Now if you press the play button or scroll through the first 30 frames you’ll see the butterfly flap its wings… once. Now you could keep repeating this every 15 frames until you have all 480 frames done, so that’d be somewhere around 32 keyframes you’d have to set manually. Fortunately there is a better way to take care of cyclical animations. With the butterfly still selected (or select it after you open the window) go to Window -> Animation Editors -> Graph Editor. Click on the Flap attribute and you should see the 3 keyframes that you just made. If your display gets out of wack as you move around the graph editor, you can always go to View -> Frame All or Frame Selection.

Step 47

Next go to View -> Infinity. You should see black little dot representing infinity in both the positive and negative direction. Then select all 3 keyframes and go to Curves -> Post Infinity -> Cycle.

Step 48

You should see that the dotted lines (representing infinity) now cycle up and down as if we were to keyframe those every 15 frames manually. However the curves don’t look very smooth. If you play the animation and look closely you’ll see that the butterfly flaps its wings, just not very fluid. To fix this, select the first keyframe in the graph editor. Two handles on either side should pop up. Select the right handle and with the Move Tool selected (or press W on your keyboard) drag it down as shown in the picture. You’ll also need to do this for the third keyframe. Now it curves look smoother.

Step 49 – Rendering

Close out of the graph editor and play your animation through. You should see the butterfly flap across the screen. Now let’s work through the basic rendering setup. Go to Window -> Rendering Editors -> Render Settings.  Make sure Maya Software is selected for Render Using. In the Maya Software tab, a great pre-set is to just select Production Quality for the Quality settings for the Anti-aliasing. We won’t be using any ray tracing or motion blur (those are two other common settings to play around with) in this tutorial so we don’t have to worry about them.

Step 50

Go back to the Common tab in the Render Settings window. Give your frames a name, I named mine butterfly_shot. If you are doing a bunch of different shots that you’ll later be editing in some video editing software you might want to give your shots a more descriptive name like butterflyAcrossScreenShot or something. Now where it says Image Format you have an overwhelming amount of choices. My personal preference is to have Maya render out Targa (.tga) files that I’ll later import into Adobe Premiere or Adobe After Effects as a numbered sequence. Targa files are pretty large files however they are not compressed at all and image quality is not lost in the process. If you are exporting only a single frame you might want to use a jpeg to stick it on the internets immediately, otherwise a photoshop .psd file might be more useful if you want to do any post-process work like color/levels touch-ups.  Next you need to choose a Frame/Animation setup– I usually prefer the name.#.ext as Premiere or After Effects reads the numbered sequences no problem.  Change the start and end frame to match your animation or time slider. Since we didn’t add another camera into the scene, we’ll use the persp (perspective) camera as our renderable camera. For the image size, we can use a 640×480 preset, or nowadays you might want to render out in 720 or 1080 HD. There are presets available there as well. Do keep in mind that the frame size is directly related to the render time.  A bigger frame size will take much longer to render.

Step 51

Close out of the Render Settings window and return to your scene. As we selected in the Render Settings our renderable camera will just be persp (perspective). Go to View -> Camera Settings -> Resolution Gate to turn on a rectangular grid showing the composition your rendered frame will look like.

Step 52

Move the camera in a position that you’d like for all 240 frames of the animation. To preview what a single frame will look like, go to Render -> Render Current Frame while in the Rendering menu set.

Step 53

You should see whatever frame you happened to be on when you hit the Render button be rendered before your eyes. This will likely be a quick render as we aren’t doing any fancy ray-tracing or have any photo-realistic mental ray materials assigned to the model. Nor are we doing any high-def renders (unless you selected the 1080 HD preset). Nonetheless you should see how long your render time took here, and this could give you a ballpark idea of how long it will take to do 240 frames.

Step 54

Close out of the Render View window. Now we’ll turn on the rendering process to have Maya pump out all 240 frames. In the rendering menu set, go to Render -> Batch Render. Now would be the time to either A) grab a snack or B) go to bed. This depends on how complex your scene is. In the Command Line at the bottom of the screen you should see  a percentage for the current frame as well as what frame is currently being rendered. The way we set it up was to start at frame 1 and render in order until frame 240. If you had a complex scene you might put Maya on three different computers (even a netbook, more on that at the end) and have one render frames 1 to 80, another computer do frames 81 to  160, and the last do frames 161 to 240. Fortunately for us we are not rendering out an intensive scene.

Step 55 – What to do with the files

Once your Batch Render has finished you can go to the directory where you set the files to output. The directory should be listed in your Render Settings window, or alternately you can look at the directory in the command line at the bottom of the screen while you were batch rendering. If you are working in the default project space, you can find your images in your Documents folder / maya / projects / default (or whatever you named your project if you did so) / images.

Step 56

Maya is notoriously terrible at exporting video files directly from the rendering process. This is why we rendered each frame from Maya and we’ll now have to use another piece of software to import those frames and have that software turn all the frames into a single video file such as a .avi, .mp4, or .mov (etc) depending on your preferences. I enjoy using Adobe Premiere Pro. If you are using that software just go to the Import Media, find the first frame, and make sure you check off Numbered Stills.

Step 57

This basically wraps up the tutorial. For my video I made two different 10-second shots in Maya, rendered out each frame, edited and exported them out of Adobe Premiere Pro.

Sponsors

Coincidentally these are the books that I used to teach myself Maya. You should be able to get used copies for less than $5 dollars.

Conclusion

Hopefully you learned a bunch, from taking basic polygonal shapes, moving a few vertices around, mirroring the geometry, and then adding polygons to smooth them out and look more organic. You should be able to make a whole bunch of simple models by following the same workflow. Picking out materials can be an overwhelming decision, but you should have some insight now with the two basic materials: Lambert and Blinn/Phong. Try playing around with those two materials and the corresponding properties such as ambient color and translucency and you can create all sorts of materials: plastics, construction paper, house walls, ceramics, marble floors, wooden surfaces. Animation can be an incredibly time consuming process if not done correctly (and in some scenarios–even if you are doing it correctly), but knowing how to create your own attributes (rigging a model) and automating some of the cyclical processes like flapping wings can save you a ton of time. Imagine if you had to keyframe the left and right wing for every flap?

I hope you enjoyed the tutorial. This is the first tutorial that I have ever written, so any feedback, love, hate, criticism, comments, or questions are welcomed and encouraged! I will do my best to answer them.

The butterfly in motion, a video rendering:

View this in glorious high-definition here

This entry was posted in maya tutorial and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

6 Comments

  1. Posted January 22, 2010 at 6:34 pm | Permalink

    wow, really well done. even as a beginner some of this was review but you combined it with things that are simple but you can do sooo much with (and i’d never think of doing it myself!) THANKS!

  2. .....
    Posted October 25, 2010 at 4:28 am | Permalink

    can you make it alot easyer?

  3. .....
    Posted October 25, 2010 at 4:32 am | Permalink

    it is very cool when finished

  4. Vlad
    Posted November 16, 2010 at 11:32 am | Permalink

    Thx, for the great tutorial! ^^ love it…
    I am a very beginner to maya ^^ And I used your wings technique to make my 8 sec animation (should have been 10, but somenthing f”’t in batch rendering) ^^,

    http://www.vimeo.com/16891406

    Can you please guide me to some good place to learn the camera movement as yours in the butterfly in motion, a video rendering video? A very nice video btw, and thx for sharing the other tutorial site for the envoriment ^^

  5. Posted November 16, 2010 at 12:08 pm | Permalink

    Thanks for the feedback.

    Vlad, I saw your video and I like how large the legs are on your flying creature. Creepy.

    I used a camera that pointed to the butterfly and followed it. I keyed a few frames at the beginning and end of the following sequence and then went in and tweaked individual frames in between. To get a smooth result it’s important make slow and subtle changes to the tweaks. Looking at the graph editor, you’ll probably be aiming for some nice smooth lines and any sudden movement will be noticeable as represented by “crazy squiggly lines”.

  6. maha
    Posted April 21, 2011 at 1:05 am | Permalink

    Hi…..
    stephen

    Thanks for the tutorial. I tried follow ur tutorial for project. But Am facing problem in step 32.
    wings are not flapping even after i followed all the steps correctly till 31
    can u guide me in what would have gone wrong? will be a real help if do so.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>