Recently I had a job that required me to create a looping animation of a flag. I was very fortunate to find such a tutorial on THE AREA.com located here:
The internet is awesome.
The tutorial was invaluable and allowed me to achieve the effect. As I went thru the tutorial I found tools and techniques I wasn’t aware of and thought it would be helpful to put some more details about the process into writing.
Scale is always an important factor when computing any kind of simulation. Make sure your units match the image:
Create a plane in the front viewport using the settings in the image:
In the original tutorial he creates seams running the length of the flag, in this one I’m creating them around the border. I added an edit poly, selected the edges that define the border and chamfered them:
Select the plane and from the modifier panel add cloth. Click add objects and choose the Plane01 object. Match these settings w/the image by choosing satin from the presets menu. This sets the dynamics for the entire flag:
I needed to pin the two corners of the flag. Open the sub-object group section under the cloth modifier. Then select the corners, apply some soft selection, then click “make group” and then preserve. This locks the corners of the flag and will prevent them from the dynamics calculation.
(In the original tutorial a selection set is made out of the vertices that make up the border and are applied the settings of burlap or rubber. This increases calculation times and I didn’t need it for my sim.):
I ended up using two wind space warps linked to dummies. The dummies have noise controllers added to their rotational values for some randomness. I needed more “violent” motion in the flag and that’s why there are two:
Next add the wind forces via the cloth forces button. I also lowered the gravity so the flag would appear larger. I then clicked the simulate button and waited 5 hours for 1000 frames to calculate. (I used a machine w/dual quads @ 2.33 ghz w/8 gigs of ram):
After the sim is complete and looks good add the point cache on top of the cloth modifier. Click record and save the resulting cache file on your network in case you need render servers to see the file. You can then delete the cloth modifier. The size of the max file is much smaller after the cache
file is created and the cloth modifier is deleted:
In the playback type area choose playback graph from the drop down. Go to the last frame of your animation turn on the animate button. Change the frame number to match the length of your animation. This is done so that you can move the animation in track view. Make a copy of the flag:
First thing to do is isolate a section of time for the flag to loop, in this case mine is 200 frames towards the end of the sim. In order to get the flag animation to loop offset the flag copy animation by moving its’ key frames by the amount of animation or in this case 200 frames:
As pointed out by Vitsly a simple morph will not work, he came up w/the brilliant idea to use a “wipe” style morph by using the vol select modifier. Using the settings in the image including the soft selection, turn on the animate button and in this case move the vol select gizmo to the left until there’s no soft selection effect on the vertices, (the vol select should be moving in the same direction as the wind) since we’re not on frame zero a key frame was automatically created @ frame zero, in track view move the key frame @ frame zero to the end of your animation in this case frame 800. This step is crucial because the key frame created on frame zero is the exact center of the gizmo on the object and thus will create an exact loop:
Add the morpher modifier and use the settings in the image and that’s it! Again hats off to Vitsly for a very cleaver solution to a very complex problem!