CAP Extra Lesson
This lesson provides some techniques from Henry Mbata, who has provided a video and project files. Objectives important to
- Creating a flag with realistic motion
- Adding a texture to the flag
Henry Mbata, called Henry the Jedi, has provided a video of his process for creating a realistic flag. He has also provided the project files for download on his website, henrythejedi.com.
Assignment: Henry's Flag
Create the flag shape
- Open 3DS Max. If it is already running, reset the scene.
- Open the Create menu, and choose Shapes, Line.
- In the the Create panel, turn on Autogrid, and set Initial Type and Drag Type to Corner.
- In the Front viewport, draw four lines, which will be the sides of a flag. In the image to the right, the vertical lines are about five major grid lines apart, and the horizontal lines are about two and a half major grid lines apart. Place the vertices on grid intersections and this will be much easier.
The lines should all connect. Try to make them straight lines, but don't worry, about small errors. You correct them in the next step. (Note that one vertex is the wrong place in the image on the right.)
Place the end point of the last line on the start point of the first line. When 3DS Max asks if you want to close the spline, select Yes. The flag is a single line at this point, probably called Line01. Rename it, calling it Flag.
- Open the Modify panel and select Vertices. Click the Move button, then select the corners of the flag as needed, to move them so the lines are all straight.
Create the flagpole
- Switch to the Perspective viewport, and open the Create panel.
- Create a cylinder that will be used as a flagpole next to the flag.
- Click the settings for the Perspective viewport, and select Edged Faces. This will show you the sections of the cylinder.
- Open the Modify panel, and name the cylinder Pole.
- Set the Pole's sides to 12, radius to about 12, and the height to about 1250.
- With the pole still selected, right-click the select and move button. On the Move Transform dialog box that appears, set all x, y and z values to 0.
Adjust the flag
- Switch to the Front viewport. Select the flag object and move it so the top of the flag is just a bit below the top of the flagpole, and the edge of the flag next to the pole is just touching the pole at a tangent. This is important: the edge of the flag needs to touch the pole, or you won't be able to attach it to the pole easily.
Add modifers to the flag
- Make sure the flag is selected. Open the Modify panel, if it is not open, and click the vertices button. Press ctrl-A to select all vertices of the flag.
- Find the Geometry rollout on the Modify panel, and click the Break button.
- Open the Modifier list, and add the Garment Maker modifier to the flag. (This was not covered in our texts.) You will see a pattern of triangles applied to the flag surface.
- Add the Cloth modifier to the flag.
Configure the cloth modifier
- Select the Cloth modifier.
- On the Object rollout of the Modify panel, select Object Properties.
- In the Object Properties panel, click the Add Objects button. Add the pole to the Objects in Simulation list. (The flag is already in this list, since the cloth modifier is attached to the flag.) Note that both objects are tagged as Inactive at first.
- Select the flag object in the list, and click the Cloth radio button to the right of the list.
- Select the pole object in the list, and click the Collision Object radio button, near the bottom of the Object Properties panel. Click OK to save the property settings.
- Select the flag, and click the panel button that says Simulate. You should see the flag fall down. Not what we want, so click Erase Simulation.
Adjust the time for the animation
- Click the Time Configuration button. In the Time Configuration panel, set End Time and Length to 500 frames. Click Rescale Time, OK, and OK.
Attach the flag to the pole
- Click the plus sign for the Cloth modifier, then select Group from the four options that appear.
- Change to the Front viewport, and select all the vertices of the flag that touch the flagpole. (This should be one vertical line of vertices.) Click the Make Group button (on the Modify panel, in the Group rollout), name the group, and click OK.
- Click the Sim Node button in the Group rollout. Click the Select by Name button (or press H). Select the pole object, and click the Pick button.
Test simulation, and add wind
- Select the Cloth modifier, and click the Simulate button again. This time the flag stays attached to the pole, but it still falls down where it is not attached. (There is no wind yet.)
- Open the Create menu, and choose Space Warps, Forces, Wind. Drag in the Front viewport to create a Wind space warp to the left of the flag and a bit below its midpoint.
- Click the Rotate button, then click the Angle Snap Toggle button. Rotate the wind gizmo so the wind arrow points parallel to the long axis of the flag, and a little toward the top of the flag.
If that did not make sense, you are not thinking three dimensionally. You need to rotate the Wind in the X plane so its arrow points along the flag's X axis. You need to rotate the Wind in the Y plane so it provides a little updraft. (20 to 30 degrees above horizontal may be good.)
Apply the wind to the flag
- Select the flag object. Click the Cloth Forces button in the Object rollout. Choose the wind object from the Forces in the Scene list, and click the button with the greater-than symbol on it to move the wind object to the Forces in the Simulation list. Click OK.
- Select the wind object and set its Strength to 14.
- Click the Erase Simulation and Simulate buttons again.
The lesson continues to apply a diffuse texture and a bump map to the flag. The steps above are sufficient to make the flag wave. The next steps make it look like the flag our guide wants.
- Select the flag object, then press M to open the Materials Editor.
- Unlike our texts, Mr. Mbata first assigns a material to the flag by dragging the first sample and dropping it on the flag. That's fine, it works in either order. Do this now.
- Click the Show Material in Scene button. You want to do this if you add one or more maps to a material slot. Otherwise, you do not see the material on the object in the viewports.
- Click the gray button next to the Diffuse material swatch for this sample.
- Double click bitmap in the panel that appears, and browse for the www-HenryTheJedi-com logo file. It's in the folder for this lesson on the classroom server. Select it and click Open.
- If you did not do step 2, click the Assign to Object button. Simulate if you like.
- The other texture supplied for this lesson is a bump map for the flag. Open the Maps rollout for the material slot. Click the map button for Bump. Double click bitmap in the panel that appears, and browse for the second texture on the folder for this lesson. Select it and click Open.
- Simulate the animation again and enjoy.