How to create waving flag animation (nCloth) in Autodesk Maya

How to create waving flag animation (nCloth) in Autodesk Maya

Waving flag in Maya with nCloth build-in system is a simple technique you can accomplish in a matter of seconds. You can use this technique for other concepts such as curtains or really any fabric material.

nCloth in Maya is really powerful. On top of that inside Maya, you have plenty of preset options to choose from of how your cloth dynamics will react.

You may also want to check out how to create a Realistic tablecloth simulation in Maya (nCloth).

Basically, the idea is like that:

  • create two separate geometry (flagpole and flag fabric)
  • for the flagpole, create a passive collider
  • for the flag fabric, create a nCloth node
  • connect the flagpole and flag fabric with transform constrain node
  • playing with the Nucleus node settings to get the right conditions
  • set up an initial stage for your dynamics

You can watch a Youtube video “waving flag dynamics in Maya” which I have uploaded with the whole process. Although keep in mind there are no notes or clarifications on that video of why we do what we do. For that matter keep reading this article.

Modeling part of flag in Maya:

Create the flagpole geometry:

Let’s really quickly create our simple flagpole geometry. We won’t make it complicated. Just create a simple cylinder and a sphere geometry on top of that. I used the following settings for both of them.

flagpole geometry
flagpole geometry

Note: Since we are going to use dynamics in Maya, it would be wise in our first steps not to use heave geometry. Dynamics in Maya can be very slow concerning playback speed if your connected geometry is too heavy. Of course, it depends on your machine as well.

Create the flag-fabric geometry:

Since I am Greek, in our demonstration I suppose it’s fair enough to use the Greek flag. The author of the flag image is deMysticWay at pixabay

Note: I assume you won’t have any problem finding your flag as a free resource. If you have trouble finding your flag, there is a great paid resource platform that if your budget allows it you should definitely check out. Countryflags is a great way to find and download really any flag you need. Despite the pure high-resolution download part, It also provides additional information such as colors used by the flag, aspect ratio, and history information as well.

That being said, let’s create the flag-fabric geometry.

Create a standard polygon primitive – plane with the following settings. Width 9, Height 6, Sub Width 36, Sub Height 24. Also reposition your flag to attach the flagpole, like the image below:

 create the flag-fabric geometry
create the flag-fabric geometry

The way we put those numbers was not random. It actually has a simple theory behind it. The theory of respecting the aspect ratio, let me elaborate. The Greek flag has an aspect ratio of 2:3. So, our width and height for our flag-fabric geometry could be 9 and 6 accordingly, which is a 2:3 aspect ratio. Likewise, the sub width and sub height are 36 and 24 respectively, which is also a 2:3 aspect ratio.

Texture and materials for the flag:

Since this article is focused on dynamics in Maya, and we are not going to render anything, feel free to add simple materials on your own to those objects. I have applied a blinn material for each object.

Now, since in the flag-fabric material, we are going to apply our Greek flag texture, we want our UVs for the geometry to be correct. And the way to do that is by covering the whole area with UV, like the gif below:

flag-fabric fix uvs
correct uv

After that, just apply your flag texture in the color slot for the flag-fabric material, and everything it’s going to be fine.

apply texture map into color slot of the material
apply texture map into color slot of the material

Dynamics part of waving flag in Maya:

In this section, we are going to apply dynamics in our scene for both geometry (flagpole and flag fabric) and then we will connect those dynamics to each other with a transform constrain node. In that way, they will stick together. As a result, our flag fabric will not fall to the ground in the simulation process. Let’s get to it.

Create a passive collider for the flagpole:

Select the flagpole and go to FX module, nCloth – create passive collider. After that two new nodes have been created (nucmeus1, nRigid1).

Create nCloth Maya node for the flag:

Select the flag-fabric geometry and this time create a nCloth node, by going to nCloth – create nCloth. Another node has been created (nCloth1) and also it has been established a connection with the existing nucleus1.

nCloth nodes
nCloth nodes

Let’s really quickly apply the silk preset on the nCloth node of our flag. Select the flag-fabric geometry and in the attribute editor on the nClothShape press and select the silk preset – replace from the list. I found out that the silk preset behaves more naturally for flag materials.

ncloth flag silk preset
ncloth flag silk preset

Note: You can create all sorts of Cloth materials by playing with nCloth attributes. If you are interested in how you can create materials using nCloth, this is an interesting source by official Autodesk Maya on that subject.

If you play the animation simulation, you will notice our flag is falling to the ground. That’s why in the following section we will add a transform constrain node to prevent our flag from doing that.

waving flag in Maya, flag falling down
flag falling down

Note: When you deal with dynamics in Maya, it’s a good idea to switch the playback speed to play every frame.

playback speed, to play every frame
playback speed, to play every frame

Connecting nCloth and passive collider with transform constraint node:

The way to prevent the flag to fall down is pretty simple. Using a transform constrain node, between vertices and another geometry. In that way, we say that those vertices will be sticky to that geometry no matter what. As a result, our flag will be waving except for those vertices, which will be sticky to the flagpole. Let’s get to it.

Select the flag-fabric geometry, go into the component mode, and select all the vertices which are close to the flagpole. After that, select the flagpole and go to the FX module, nConstrain – Transform Constraint.

nCloth, transform constraint link
nCloth, Transform Constraint link

If you play the animation, you will notice this time our flag is not falling down, although is waving but not the right way. We will fix that in the following section.

flag stick to the flagpole

Set up Gravity and Wind in Maya:

Expand your time range inside Maya to something like 0 to 1000 or even more, so you have room to work.

Select the nucleus note and go to the Attribute editor. Leave the Gravity at 9.8 and the Gravity Direction as it is. Set the Wind Speed to 7 and the Wind Noise to 0.5. Play the animation.

waving flag in Maya with the correct forces

Note: We could have added some other forces to affect our flag, such as turbulence, drag, etc. but for simplicity’s purposes we didn’t.

Our flag seems to wave naturally, and I am quite happy. Expect the first part, which seems still and unnatural waiting to have action. The way to solve this issue is by setting an initial stage.

Set up correctly the Initial stage in Maya :

The initial stage as the name suggests is the initial stage for our dynamics in Maya. In our concept, we want our flag to have an action on it from the first frame.

Play the animation – simulation and after a few frames later when the flag is already waving, stop the animation and select the flag-fabric geometry. Go to Fields/Solvers – Initial Stage – Set for Selected. If you play again your animation, now the animation starts from that frame you set previously.

waving flag in Maya final animation

Conclusion:

As you can see, with nCloth build-in system in Maya you can accomplish pretty cool stuff in a matter of seconds. You can use the above technique to create waving flags of all types, and I think the result was quite realistic. Of course, It would be more realistic if we applied more suitable materials to our objects and applied lights and lastly, we used a realistic renderer such as V-ray or Arnold.

Since this article was focused primarily on dynamics with nCloth in Maya, basically I left the realistic part to you 🙂

You can absolutely create a waving flag in Maya with the concept of logo, quotes, images, and of course nation flags and use it as an intro in your video.

Feel free to take a look at a gig of mine on Fiverr, “Realistic waving flag animation“. It’s not a Maya project with the above technique, but I think with a little work you can accomplish the exact same result with nCloth in Maya.

Popular posts

inspire others:

Picture of Vladi Dan

Vladi Dan

Hey there. I am an experienced 3D Artist - Graphic Designer for over 7 years. Of course, the learning process doesn't really end. I am more than happy to share my personal knowledge with you guys. Let's create and learn some cool stuff together. I hope you join me on this creative trip.

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest Posts