Create Awesome Cloth Simulations using nDynamics in Maya

Tutorial Details
  • Software: Autodesk Maya
  • Difficulty: Intermediate
  • Estimated Completion Time: 2 Hours

Dynamics simulations can be a powerful tool when trying to generate realistic looking effects that would be very difficult to achieve manually. In this tutorial you will learn how to use nDynamics’ passive colliders and ncloth objects, in conjunction with fields like air and gravity, to easily simulate realistic dynamic objects such as a windy flag or a water container.

Republished Tutorial

Every few weeks, we revisit some of our reader's favorite posts from throughout the history of the site. This tutorial was first published in November of 2009.

Final Effect Preview

Step 1

Go to “Create > Polygon Primitives > Plane”.

Step 2

Create a plane that matches the size of a flag and rotate it by ’90′ degrees.

Step 3

Open the Attributes Editor for the plane, name it, and increase the “Subdivisions Width” to ’30′, and the “Subdivisions Height” to ’50′.

Step 4

Your plane should now look like this:

Step 5

Go to “Create > Polygon Primitives > Cylinder”

Step 6

Position the cylinder, and scale it to match the size of a flag pole.

Step 7

Select all the top faces of the pole.

Step 8

With the faces still selected, got to “Polygons > Edit Mesh > Extrude”.

Step 9

Extrude those faces until you get a nice pole shape.

Step 10

Select the top vertex of the pole.

Step 11

Use the move tool to position the vertex.

Step 12

Go to “Window > Rendering Editors > Hypershade”.

Step 13

With “Create mental ray Nodes” active, create a new “mia_material_x”.

Step 14

Open the Attributes Editor of the material you just created, name it, select the preset called “Copper”, and adjust the “Diffuse” and “Reflection” colors accordingly.

Step 15

Apply the material to the pole.

Step 16

Go to “Window > Rendering Editors > Hypershade” again.

Step 17

With “Create mental ray Nodes active”, create a new “mia_material_x”.

Step 18

Go to the Attributes Editor of the material, name it, and decrease the “Reflectivity” value to ’0′.

Step 19

Click on the checkerboard button, to the right of the “Diffuse” color value, to open the “File” browser window.

Step 20

The Attributes Editor should now change. Select the image you want to use to texture the flag.

Step 21

Apply the material to the flag, and with the flag selected go to “Create UV´s > Planar Mapping”.

Step 22

Select the option highlighted below so you can see if the texture looks good.

Step 23

If your texture looks bad like mine, go to “Create UV´s > Planar Mapping (settings)”.

Step 24

This will open a new window where you can change the projection axis to whatever works for your scene, and then click “Project”.

Step 25

Your flag should now display the texture correctly.

Step 26

Select the flag, and in the “nDynamics” menu, go to “nMesh > Create nCloth”.

Step 27

Increase the number of frames of the animation.

Step 28

If you play the animation now, you will see that the flag just falls down. This is because the flag is not attached to the pole.

Step 29

Rewind the animation.

Step 30

Select the flag, and in the “Window” menu, go to “Show > Isolate Select > View Selected”.

Step 31

You should now only see the flag, which will make it easier to work with.

Step 32

Select all of the vertexes that you want to be attached to the pole.

Step 33

In the “nDynamics” menu, go to “nConstraint > Transform”.

Step 34

Select the flag, and in the “Window” menu go to “Show > Isolate Select > View Selected” this will make everything visible again.

Step 35

Select the pole.

Step 36

In the “nDynamics” menu, go to “nMesh > Create Passive Collider”.

Step 37

If you play the animation, you should now see the flag hanging from the pole. This is realistic, but an unmoving flag is not very dynamic, so let’s add some wind.

Step 38

Go to the Attributes Editor of the flag´s “nucleus1”, and in the “Gravity and Wind” section, change the following values:

  • Air Density = 10.000
  • Wind Speed = 8.000
  • Wind Direction = – 1.000 z axis
  • Step 39

    If you play the animation now, it should look pretty good. All you need to do is smooth the polygons by pressing ’3′ on the keyboard (with the flag selected).

    Step 40

    Perfect! We are done with the first section of this tutorial, just don´t forget to save your scene!

    Step 41

    Create a new scene, and go to “Create > Polygon Primitives > Plane”.

    Step 42

    Create a square plane.

    Step 43

    Go to the Attributes Editor of the plane, name it, and change the “Subdivisions Width” to ’50′, and the “Subdivisions Height” to ’50′

    Step 44

    Go to “Create > Polygon Primitives > Sphere”.

    Step 45

    Create a sphere and position it very high above the plane.

    Step 46

    Go to “Window > Rendering Editors > Hypershade”.

    Step 47

    Make sure you have “Create mental ray Nodes” active, and create a new “mia_material_x”.

    Step 48

    Go to the Attributes Editor of the material, name it, and change the following options:

  • Diffuse: Color = Green; Weight = 0.100
  • Reflection: Color = Green; Reflectivity = 1.000; Glossiness = 0.500; Glossy Samples = 30; Metal Material = Active
  • Step 49

    Apply the material to the ball.

    Step 50

    Go to “Window > Rendering Editors > Hypershade”.

    Step 51

    With “Create mental ray Nodes” active, create a new “mia_material_x”.

    Step 52

    Go to the Attributes Editor of the material, name it, and decrease the “Reflectivity” value to ’0′.

    Step 53

    Hit the checkerboard button to the right of the “Diffuse” Color value. This will open the file browser window where you can select the image that you want to use to texture the plane.

    Step 54

    Apply the material to the plane.

    Step 55

    Select the plane, and in the “Polygons” menu, go to “Create UV´s > Planar Mapping”.

    Step 56

    Select the plane again, and in the “nDynamics” menu, go to “nMesh > Create nCloth”.

    Step 57

    Select one vertex from each corner of the plane.

    Step 58

    With the vertexes still selected, go to the “nDynamics” menu, and choose “nConstraint > Transform”.

    Step 59

    Select the ball, and in the “nDynamics” menu, go to “nMesh > Create Passive Collider”.

    Step 60

    With the ball still selected, go to “Fields > Gravity”.

    Step 61

    Increase the number of frames of the animation.

    Step 62

    Position your camera.

    Step 63

    Play the animation.

    Step 64

    The plane should just stretch instead of tearing.

    Step 65

    Rewind the animation.

    Step 66

    Select the faces of the plane that you want to tear.

    Step 67

    In the “nDynamics” menu, go to “nConstraint > Tearable Surface”.

    Step 68

    You should see some dots covering the faces you selected.

    Step 69

    If you play the animation now, your plane should tear naturally. End of tutorial! Hope you liked it!!

    Don’t miss more CG tutorials and guides, published daily – subscribe to Cgtuts+ by RSS.

    Tags: MayaVFX
    • http://spiderads.blogspot.com Old Comic Book Ads Revealed

      Wow, very effective looking!

    • joseph ruano

      XD nice simulation!! thanks i was looking for this.

    • http://www.behance.net/Modisana Modisana

      Brilliant tutorial…. I love the final outcome… would have been more awesome if there was a video version of it as well but thank you for it nonetheless…

    • Emin

      looks good.

    • crumpy

      Thank you very much for the tutorial. It was very helpful.
      I actually like the picture tutorials for 3D stuff, for me it is easier to follow along with.

    • http://www.futuregatesolutions/portfoilo.htm Abdo

      Very nice tutorial…thanks

    • http://visual3d.co.cc Alan Monroig
      Author

      Thanks! to all of you

    • Daniel Grid

      One more cool tut from maya, thanx for sharing Alan, I will definitely follow this tut if I have enough time for it

      • http://visual3d.co.cc Alan Monroig
        Author

        Thank you very Much!! Daniel

    • Chris

      Nice and quick tutorial, but this is way to basic for a site like CGTuts. The steps shown not even explain 1% of the complex nCloth system in Maya and if you need such a tutorial to model a basic flag or tearable cloth, you’re really at the VERY beginning of learning Maya. That, though, is not what CGtuts is for, at least what I think of it. Reading the very good maya help files are sufficitent for such simple stuff!!
      Please focus more on intermediate tutorials, which are mor innovativ and maybe even teach the experienced users some new techiques instead of such newbie stuff!

      Thanks,
      Chris

      • http://visual3d.co.cc Alan Monroig
        Author

        It is basic for nCloth , but it is not basic for Maya in general, there is a lot of people that know Maya in depth but not nCloth, and there is also a lot of people in cgtuts+ that is starting learning Maya and this type of tutorials help them a lot. I wished that when I was starting to learn maya I found a site like this with tutorials for beginners all the way through advance.

        I am sure there is a lot of people that liked this tutorial, and that is what matters!

        Greetings,
        Alan Monroig :)

      • http://kaleb-3d.com Kaleb Aylsworth

        Both valid points. I think we need to have stuff on here that caters to all levels of users, but I will certainly take your comment into consideration Chris, and try to get some more high-level tuts going for Maya soon.

    • http://www.ParticleFlow.net Evan Schaible

      Would a tutorial like this for 3DS Max be in demand at all? If so I can publish a pretty in depth one for next month.

      • M.kane

        It really is a great and in depth tutorial, and I could convert it for cinema 4d too, although cloth dynamics are a little wonky lol.

    • Janice Michell

      I agree……..is very nice and quick tutorial.
      Basic ? Basic for who ? There are many people that they being interested in to learn the possibilities of Maya.
      CGtuts is not only for experts

    • http://www.vfxworkshop.net abhay sharma

      very basic tutorial.
      not even explained a single step.

      ROBOTS!

      Is it the place for basics?

    • jorge resendiz

      This is great Thank you!

      It is not basic! It is great. And perfectly explained

      • http://www.vfxworkshop.net abhay sharma

        ok now you tell me

        why he chose mia_material_x not mia_material ?

        • http://visual3d.co.cc Alan Monroig
          Author

          Because mia_material_x is ready to upgrade if you want to render with passes. But the texturing of the objects like the flag and the pole is not the topic of this tutorial.

    • Logic

      Great tutorial Alan, it was very helpful.
      I still don’t understand why there’s always people complaining about this or that, if they don’t like the tutorial or already know the content they shouldn’t comment.

    • http://www.vfxworkshop.net abhay sharma

      to Alan Monroig

      well that’s my point.
      mia_material is just an example. A little explanation would help to understand.
      And a little line would not deviate your topic.

      • http://visual3d.co.cc Alan Monroig
        Author

        Ok :) I will explain better in my next tutorials, thank´s for the feedback.

        What future tutorial would you like???

        Thanks

        • http://www.vfxworkshop.net abhay sharma

          well thanks for taking it positively.
          I would like any tutorial which helps to understand nucleus system of maya

          thanks.

    • Naga

      it’s really good

      thank u.

    • Agnes Luvisotto

      It’s really an excelent tutorial. I followed the first example and it worked well

      :D

      • http://visual3d.co.cc/ Alan Monroig
        Author

        Thanks! I am glad you like it!

    • Ross

      Nice details in your tutorial. It was very easy to follow. Some of the ones on here skip around, leave stuff out, or don’t even seem like they were proof read.

      Good stuff.

    • Xandi

      Remember :

      “The beginner of today is the master of tomorrow”

      thanks well done ……… Xandi

    • Xandi

      Remember:

      “The beginner of today is the master of tomorrow”

      thanks Alan

      keep up the good work ………. Xandi

    • J

      Alan. you really are a l great teacher. I’ve learned a lot from your tutorial.. they all are awesome! Please keep it up :D

    • MGC

      Nice tutorial…I learn from this one, and I have a question…How can I save the animation like an avi.?…thx

      • http://visual3d.co.cc/blog Alan Monroig
        Author

        Thanks, to save the animation as avi you will need to export the video from Maya as a sequence, and then in a compositing software like after effects you need to render that sequence in the desired format.

    • http://@gmail.com bharath

      its a great job

    • crystal

      Step 15
      Apply the material to the pole.

      Im a newbie here. Can anyone tell me how to apply material to the pole?

      Stucked.

      • http://www.myspace.com/monosconpalas Syd

        just press and hold the right mouse button over the object and go to “assign existing material” and select the one you created before.

    • XTR

      What If I would like the flag to be released from the pole at the end, how would I release the constraint that is holding the flag to the pole? any ideas would help a great deal

    • DennG

      very helpful tutorial
      i made my first animation.. yay ;)

    • Antonio

      Nice tutorial, but i am a really beginner and i don’t have the create mental ray in my maya 2010… is this some kind of swatch plugin? how could i add this? I am really worried couse shading is not my thing…

      Ayway thanks for this tutor!
      ^_^

    • Daniel O

      I’ve tried the second part of the tutorial twice now and the ball just keeps falling throught the cloth/plane. What is wrong?

    • Veinle

      Daniel O You don’t make ball a passive collider

    • Misti

      This is great, and i must ask can you send me this .mb file?

    • Chris

      Thank you so much for this tutorial, it was very very helpful, I will post my video on my channel here http://www.youtube.com/user/criso1994?feature=mhee

    • http://jevillarosa.blogspot.com John

      why does when i play the animation on the flag my texture doesnt stick to the cloth. it just tiles the texture

    • John

      Oh nevermind i got it. i just applied the texture first before applying the ncloth

    • Akshay

      everythhing is fine but when i play it, texture is changed its place and texture is disturb.

    • Akshay

      ok i got my probelm .i just applied the texture first before applying the ncloth

    • http://creativepawar.blogspot.com Happy

      Nice tutorial :)

    • DanCam

      This doesn’t work properly, the flag is acting weird, it doesn’t flap in the wind, it just stay still from the 1st couple of hundred frames and then it goes crazy, folds on itself…

      • DanCam

        You need to play with the nclothshape node. This tutorial misses a lot of info and waste of time for the creation of the pole…seriously, that many step for something that simple?

    • yathartha

      much much much much thanks !
      Nepal

    • Ren

      The flag was very easy to make, thanks. I’ve learned already a lot more of nCloth now than my school ever taught me lol smh… I do wonder, when I choose a preset for the cloth, such as silk, it starts acting stiff, but when I do not choose any preset, it works like a charm?