If wishes were horses, we'd all be eatin' steak.
[Jayne - Firefly]
|Curtain in breeze, with SoftBodies
How to make a curtain fluttering in a mild breeze? Or, perhaps a more common example, how to attach a flag to a flagpole? This technique can be used for both, and more.
Requirement: Blender 2.37 or later
(Links to example files and animation can be found at the foot of the page)
NOTE: this tutorial was greatly inspired by tuxbots video tutorial on Softbodies, which can be found at the link below. Kudos should go whither kudos is due.
» Video tutorials
In side view, add a plane, subdivide it a few times. This will be the curtain.
This tutorial will not go into texturing, so please note that it will be a very boring curtain unless you make it less so.
Vertex groups are a fairly new addition to Blender, enabling you to for example apply effects to selected parts of an object, as well as the degree to which they are affected.
While still in edit mode, click on the "New" button under "Vertex groups". Call it whatever, or "curtain". Click on "Assign", with all vertices still selected, to assign them all to the new group.
Note the "weight" value. Initally, all vertices will have a "weight" of 1, the maximum value. In effect, they are immobile. This is alright for the top of the curtain, which is fixed to the curtain rod, but the rest of the curtain should be able to flutter. We'll fix that next.
In the dropdown which currently says "Edit mode", select "Weight paint". In the buttons window, you'll see that a panel of controls for "Paint" has appeared.
The red colour of the object indicates that all of it has a maxium weight value. Crank the "Weight" value down to 0.0 (and zoom in on the object in side view for a closer look. Now let's paint part of the object "lighter".
Weight painting is a very intuitive way to change the weight of different vertices. Keep this simple rule in mind when you start: Red = heavy, Blue = light.
You paint with the left mouse button. If you click and drag over the plane, the effect should be immediately obvious. We're looking for a simple gradient effect from red at the top to blue at the bottom. It's not rocket science, though, so don't work too hard. You can always go back to weight painting later on.
It might be a good idea to save the scene before trying out the painting tools. They can be a tad unpredictable at first.
The brush size can be set with the "Size" field. If "Opacity" is not set to max, you will gradually work from the original colour towards the new one with each brush stroke.
Now we have assigned different weight to different vertices, making the top of the object stiff and the rest more and more flexible. How to apply it?
Go to anim buttons (F7), and click the "Softbody" tab. Click on "Enable Soft Body". New buttons appear, controlling how the object is affected by worldly matters such as gravitation.
The first thing to do is to select which "goal" to use. The goal is the vertex group we created before, so click on the arrow button next to "Use goal" and select "curtain" (or whichever name you deemed more funny). Then its time for some tweaking. We'll just look at a few of the options.
Raise the gravitation level to, say, 9.
The "E stiff" value under "Use Edges" is also handy and the effect is entertainingly obvious.
In fact, you can try the effect so far right now, by pressing Alt + a. Notice how the curtain "wiggles" a little. Since the top is secured, all it can do is stretch downwards.
The amount of stretchiness is determined by "E stiff". Try out a low value just for fun and then use 0.8 or something like that. This makes for a somewhat flexible curtain.
Now the curtain isn't really doing much. It's just wriggling a little. We'll add some wind to make things more interesting. Get back to "Object mode" with the dropdown. Add an empty a bit to the left of the plane. This empty will be a source of wind. Think of it as a huffing and puffing wolf, if you will.
With the empty still selected, click on the "Particle Interaction" tab (in Animation buttons) and choose "Wind" among the new buttons that appear. The initial "Strength" value is 0, which is boring. Let's crank it up to 1. (A negative value will, of course, make the wind blow the other way)
BTW, the rings moving from the empty shows the direction of the breeze. If the empty should be pointing in the wrong direction, just rotate it.
Press Alt + a and check out the result.
In my setup, this will create a powerful gale. You can dampen the effect to a reasonable breeze, by entering a "Fall-off" value. I chose 3, but your mileage may vary.
Alt + a to preview again. With luck, you'll smile happily at the spectacle on your screen. If not, try downloading the "Wind" Blend file (link at bottom of page) and have a look-see.
Of course, you can keyframe the strength of the wind, for example. Just open up the IPO Curve Editor, go to a frame, click on "Fstrength" and CTRL + Leftclick to add keyframes for this channel to make a wind that is increasing and decreasing in strength.
The SubSurfs button is, in this as in many cases, your friend. To make the fabric bend smoothly, just click on the "SubSurfs" button and choose a suitable "Subdiv" value.
Finally, when you're happy with the results, you may want to "bake" the effect. This calculates and saves the simulation for swifter playback. It will also make sure that your effect behaves properly when rendering the results. Select the Softbodies object and click on "Bake settings". Just set the number of frames to bake and fire away.