Cloth Simulation, Part 05: Animate a Flag Flapping in the Wind

Photo of Donovan Keith

Instructor Donovan Keith

Share this video
  • Duration: 07:22
  • Views: 3841
  • Made with Release: 16
  • Works with Release: 16 and greater

Animate a flag waving in the wind with the Cloth tag and the Fix Points command.

Animating a flag waving in the wind can be accomplished in a number of ways in Cinema 4D - but when you want a more realistic result you should probably use the Cloth system. In this video I’ll show you how to create a simple animated flag that’s pinned to a flag pole using the Fix Points and Wind settings in the Cloth Dynamics tag.



There's a bunch of different ways of animating a flag in Cinema 4D, but when you want something more realistic than say the wind deformer, you should try and use the cloth system. In this video, I'm going to show you how to create a simple animated flag that's pinned to a flag pole using the fixed points option as well as the wind settings in the cloth dynamics tab. So I just want to point out a few things in this final scene here. Notice these little white dots that are showing up on the left hand side of our flag. These are fixed points, and those are set in the dresser tab, and we'll be going over how to adjust those. And then I've just got a pretty typical cloth setup and some textures in HDRI for the render. So let's go into our start file, which is a stripped down version of the same scene. Now I've already created our flag plane, and we can preview how many segments we have by using Gouraud lines, and it looks like we have quite a few, but that's actually because we've got our cloth surface and subdivision surface turned on here. In fact, if I look at my sort of archive right here, I've got 60 by 30 segments or so, just enough to have detail in there for the various undulations and waves within our flag. All right, so let's start. Go ahead and select your polygon object here, and I'm going to add a cloth tag to that. So simulation tags cloth. And with all of these tags pretty much whenever you're adjusting the cloth, the first thing you want to do is crank up the number of iterations. Now because we're going to be using wind, we have to take this to a higher than typical level. So I'm going to actually set this all the way up to 100. I'm going to leave stiffness here at 100, and I'm actually turning up the iterations just so Cinema 4D will really respect that stiffness. Flexion, I'm going to take down to 0% because I don't want anything to prevent my flag from bending in the wind. I'm going to kill all bounce because I don't want this to bounce off of things and friction, it's not really going to be important in this scene because it's not really bumping into anything. And mass, as we've done in other examples, I want to take down as low as I can to .01. That will make it easier for the wind to affect us. Now if I press play, again we just get our cloth that is dropping. So let's go ahead and try and resolve that. So first thing's first. I want to select the points that I want to bind to my flag. So I can do that by going into points mode, and I've actually preselected those points, but you can select them again yourself with the live select tool and just go in there and paint select them. And I've selected pretty much those right in the middle. And we've got I think five points total that we're going to be pinning. And in order to pin these points, I now go into my cloth tag. I go into my dresser tab, and I 'm going to choose set next to fix points. Now let's just see what happens here. We've got these pink dots that have appeared, and when I press play, we already have something akin to a flag, and that it is at least stuck to the flag pole. Now it's not perfect. We see that it's colliding with itself, and it's colliding with the flag pole. I'm going to see if we can avoid having to turn on self-collision, though, just by adding some wind to the scene. So click on your cloth tag, and then on the forces tab here, I want to just turn on some wind and just see what happens initially. So I'm going to set my wind strength here to 10 and press play. So now we've got our wind pushing our flag all the way to the back and the direction of our wind is sort of set with this vector right here, X, Y, and Z. So right now it's just going on the Z axis. So I'm going to set Z to zero. So right now we've got wind, but it's not really blowing in any particular direction, so I'm going to blow it on the X direction, one unit. So now it's blowing off to the side. And I also want it to go a little bit stronger than it is right now, so I'm going to up my wind strength from 10 to 30. And now we've got wind. It's really whipping there. Let's go ahead and add a little bit of Y direction as well because when I'm looking at this from my front view, the wind is blowing mightily but it's always sort of down at an angle, so I'm going to set my direction Y to .1 so it's always blowing up just a little bit. So now we've got really intense wind action. And I just want to slow down this whipping action, so I'm going to up my air resistance here to something like 100 and see what happens. It's a little bit better, but it's not quite as smooth as I want. So what happens when we take that to 1,000? More smooth. Maybe 10,000? And that I think actually gives me what I want. Now I still have a lot of noise in my overall movement. It's just a little bit too much energy, so I'm going to add a little bit of global drag, which is just taking energy out of our system every single frame. So I'm setting global drag here to 1%. It's getting rid of the worst of the whipping, and I'm going to see what happens when I take my wind lift and also take that up to 100%. I'm hoping that that will just allow the wind to have a greater impact. And it has changed things the exact mechanics on Y. I'm still not totally certain on, but let's see what happens when we play around with the strength of our turbulence as well. So right now the wind is kicking up and slowing down very quickly. I'm going to just slow the turbulence speed here to .5, and hopefully the amount of up and down will slow down just a bit. And maybe we'll lift our wind drag to something like 25%. So it's all slight changes like this, so now we have our flag whipping in the wind. Let's see what happens when we turn on our subdivision surface to smooth things out, as well as our cloth surface. If I just go back to Gouraud shaded mode, I've got something that looks a lot better. If I just create a new material and kill the reflectance and apply it to my cloth, we'll get a more accurate preview of what it looks like. That specular is really a killer of our cloth. Just to quickly recap, to animate this flag flying in the wind, we used the fixed points option to fix points of our object to our cylinder. Then we turned on the wind settings really cranking up the iterations so that our flag wouldn't distort, and playing around with the air dynamics settings to get some wind effecting our flag.
Resume Auto-Scroll?