Creating a Seamless Looping Flag Animation

Photo of Kevin Aguirre

Instructor Kevin Aguirre

Share this video
  • Duration: 14:57
  • Views: 3310
  • Made with Release: 16
  • Works with Release: 16 and greater

Create a seamless looping animation using a Cloth Flag, Point Cache Tags, and Point Cache Deformers.

Create a Flag in the wind using the Cloth tools and then store your simulation into a Point Cache Tag. Learn how to offset and blend your Point Caches with the Point Cache Deformers to create a simulation that will seamlessly loop to give you an endless animation.

Less...

Transcript

- Hey everybody. In this video we're going to give a quick tutorial on how to create a seamless looping animation using point caches and point cache deformers. This is very useful when you need to create a perfect loop when working with animation that's not easily looped using just key frames, such as a dynamic simulation or cloth. It's really for when you've got a background element or some kind of element that you want to go on indefinitely, but you don't want to render out all those frames. You can render a portion of it, and just seamlessly loop it. In this example, we're going to go over creating a 10-second animation using just a waving flag. We're going to set up the flag, create the cloth simulation for it, then cache it, and then set up the seamless loop using the point cache tags and the point cache deformers. We're going to first create a plane. This is going to be our flag. I'm going to go ahead and set the axis here to positive Z. So we're looking down the right axis. Then I'm going to reshape this a little bit. I'll set the width to 800, and I'll double up the segments on that with 240. You can also clean this up a little bit. In my interface, I'm going to turn the grid off so I've got a clear view here. Then I'm also going to set under my configure, selection wire frame, to turn that on, just so I can see what the segments look like here. Next thing I want to do is just make this plane editable. I'm going to hit C, make editable command. The next step is going to be creating the cloth simulation. I'm just going to right click up on the plane, and add a cloth tag. And that's going to put the cloth properties on this plane. See the cloth drops out the frame. The first thing we want to do is to just fix a couple of these points. I'm going to grab the two corner points here in the dresser tab. I'm going to hit fix points. Set. It will turn purple there, then you could see hit play, and they're stuck there. Now we can go into the forces tab, and sub some values to create a wind blowing through this flag. We can just set this gravity to nothing here, and then, I'm going to up my wind strength a little bit too. I want my wind blowing along the x-axis there, so I'll make that about 1 or so. Wind direction Z, maybe a little bit. We want to just add some variation. You can play this as it's going, and then start playing with these values a little bit so you can see how the simulation's going to play out. Now, since this is going to be a full 10-second loop, you'll see my timeline right now is only going from 0 to 90. This is where we want to go ahead and set our timeline up for this loop. And the timeline, when you're creating this, is very important. This is all about creating a perfect seamless loop. On the end frame and the beginning frame have to be exactly one frame apart in the animation. My start frame, I'm going to set at 1, and a 10-second animation. This is still defaulted at 30 frames per second. So 10 seconds is going be 300 frames. But what we want to do is add some extra pad onto that too, because what we'll do in the end of this is cross fade over. I say cross fade but it's cross fading the actual point caches. What that will do is give you this seamless animation. We need that extra pad to go between these two point caches. I'm not just going to go to 300 frames; I'm going to give it an extra 3 seconds of pad on that too, and go up to 390. Now I've got my 10 seconds plus 3 seconds of pad. And we could take a look out our simulation here, and see if that's looking all right. Again, you can be creative with some of these numbers. The actual way the flag is moving in this case is not that important, just the idea. Let's set these to 15, 15. Again just playing with these values to get something that's smooth and works. Once we've got our simulation kind of working here, I'll go ahead play this from the beginning. Kind of see you get something, then that's fine. And again, the look of this is not that important right now. But what we can do is, at the beginning, you'll see here. I don't want a flat plane here, because obviously, this is not going to seamlessly loop. I want this to already be in motion like it's already being blown by the wind at the beginning of my animation. What I need to do is find a frame where this already looks like it's fully being affected by the cloth and the wind, and then initialize that as my start frame. I can maybe stop at about here, 170 or so. And I'm going to, in my dresser tab, under innate state, I can hit set. Now, before I do this, you can create a copy of this plane, and just hide it and take-off the cloth tab. If you are working with a model that is a little more intricate than a plane and you don't want to screw up the initial state of it, you can create a duplicate copy for yourself just as a backup. In this case, I'm fine just blowing that away. We'll set a new initial state. I'll set that and then go back to the beginning of my timeline, and now that is my new initial state. I can go ahead and hit play here. Now it's going to look like this is constantly in motion. If we like what we see here in this simulation, I'm going to go ahead and cache this in the cloth tab setting. In the cloth under cache, I'm going to go ahead and hit calculate cache. That will run through the simulation. See, it's very quick. And now, I can drag my slider and that entire flag that is now cached in the cloth tag. Now the cloth tag doesn't allow us to manipulate this cache as far as duplicating it or mixing it with itself. We can't use this cache in the cloth tag for our purposes. What we need to do is now move this cache into an actual point cache tag. I'm going to right click on the plane, go over to my character tags. And then in there you will see cache tag. I'll bring that in. What that's going to ask for is the store state. I'm going to go back to my first frame and just hit store state. It kinda knows what it's looking at there. Then, I'm going to hit calculate. And that's going to run through the entire animation. You'll see, it used the memory here. It puts all that point cache into the point cache tag now. Now, I can go to my cloth tag. Turn off the cloth engine. It's fully disabled now. Now, I can just click and drag. You'll see that cloth because now I can go ahead just delete that cloth tag completely. This is now all stored in that point cache tag. The great thing about this is in the point cache tag, we have this little offset value. This is huge in creating this seamless animation because now what we can do is offset where this point cache is happening, and then kind of adjust the strength between them. First of all, I'm going to come into the basic and just name this Point Cache A. And then I'm going create a duplicate of this. I'll just control and drag. Drag it out. And then, that one, I'm going to call it Point Cache B. Now, I've got two point caches. The way this is set up on the object, it's only going to take the topmost point cache. I can't go between the two tags the way they're set up currently. But what I can do is use the point cache deformers. In the character menu, we have the point cache deformers. I'm not going to bring those in quite yet, but that's what we're gonna use to manipulate these point cache tags. Before I do that, I want to go back into my tag. The idea is to offset these animations so that your end frame is pretty much your first frame. What I'm going to do since both of these caches go from 1 to 390...I've got that extra three seconds of pad that we built in here. What I can do is offset my first one, negative 90 frames. What that's going to do is push the last frame of my simulation to frame 300, which is going to be the end of my 10-second loop. The second point cache tag, now that I've pushed my first one back 90 frames, I'm actually starting the simulation at frame 90 here. The first frame is going be frame 90, meaning, kind of the frame 301, if you will, needs to be frame 90 on the 2nd one, if hat makes sense. What I have to do is now offset my 2nd one so that its frame 90 is on frame 301. So that needs to be pushed back, 210 frames. In the offset, I'm going to set that up to 210 frame offset. You'll see it move right there, meaning it's not going to move until frame 210. Again, because only the first or the topmost tag takes effect there. You'll see if I switched the tags, now the other tag takes effect. By starting this second point cache tag at frame 210, you'll see 90 frames in, it will be at 300. It's a bit confusing to wrap your head around, but it helps to visually see those sequences in your head, and see where frame 1 is going to be or frame 300 is going to be, and where those sequences need to be when you offset them. Now, what we need to do is fade between these two simulations that we've set up. We've kind of put them already in place where the sequences need to be for our loop, but we need to set up the cross fade. Now, they each have their own strength values here, but you'll see on this topmost one, which again starts at 210, if I lower the strength all the way down, it doesn't let the bottom one see through. It just doesn't work that way. What we need to do, again, is bring in these point cache deformers. If I drop that in drop it as a child to the plane, duplicate so it I have two. What I want to do is tie each respective point cache deformer to a tag. Each deformer here is gonna represent a point tag. That's how point cache deformers work. They simply look at a point cache tag and allow you to use that tag's information as a deformer instead of the tag information here. Point cache A, I'm going to drag in the point cache A tag. Point cache B. I'm going to drag in the point cache B tag. These deformers we can now mix together. You see the deformer here has a fall off weight. That's what were gonna use to kind of go between the two. Right now, again, point cache B has taken over. But you'll see if drop the weight now of point cache B to nothing, point cache A is there doing its thing. And it's going to stop there because it ends at 300. This is where we now set up our cross fade to go between these two point caches. I'm going to set my timeline back to 300. Now I'm at my full 10 seconds here. Now I'm going to, just go ahead, and in point cache B, I've got 3 seconds of pad, it starts at 210. At 210, I''m going to key frame its weight, add 0%. And at frame 300, go ahead and key frame its weight at 100%. Over the course of these three seconds, your point cache B deformer is now bringing in that point cache information from the second tag that we've set up and mixing it in with your point cache A. What that does now, if you look at your last frame and your first frame, it should be one frame off. If you wanna double check it, you can go to frame 301, and pop back and forth, and they will be the exact same frame. Now, you don't want your first and last frame to be the exact same because you'll get that little pop in your seamless animation. So you want that one more frame there, or one frame less on your loop. You should see some movement between your first and last frame. Now, if we go ahead and play this, and run this through, you'll see, we now have 10 full seconds of simulation. This is where the second point cache comes into play, and now you see the loop seamlessly in play. The cool thing about the deformers is they don't need to be on the actual object with the planes. You can actually have another plane. If we do this again, I'll just recreate another flag using our same dimensions that we had before, and our same number of segments, 800 by 400, and 40 by 20, and go ahead and drag that out. I can just duplicate these two point caches that we've done, drop them into the second plane, and I've got a second flag. So, all these deformers are doing is pointing to these point cache tags. I can easily create a whole bunch of these flags that are moving. And now with this offset in place, I can offset them so you can have a number of different flags going. So that's it. I hope you guys found this technique useful. Thanks for watching.
Resume Auto-Scroll?