CAP Extra Lesson

Flag Tutorial

Objectives:

This lesson provides some techniques from Henry Mbata, who has provided a video and project files. Objectives important to this lesson:

  1. Creating a flag with realistic motion
  2. Adding a texture to the flag
Concepts:

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

  1. Open 3DS Max. If it is already running, reset the scene.
  2. Open the Create menu, and choose Shapes, Line.
  3. In the the Create panel, turn on Autogrid, and set Initial Type and Drag Type to Corner.
  4. 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.
  5. 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
  6. Switch to the Perspective viewport, and open the Create panel.
  7. Create a cylinder that will be used as a flagpole next to the flag.
  8. Click the settings for the Perspective viewport, and select Edged Faces. This will show you the sections of the cylinder.
  9. Open the Modify panel, and name the cylinder Pole.
  10. Set the Pole's sides to 12, radius to about 12, and the height to about 1250.
  11. 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
  12. 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
  13. 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.
  14. Find the Geometry rollout on the Modify panel, and click the Break button.
  15. 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.
  16. Add the Cloth modifier to the flag.

    Configure the cloth modifier
  17. Select the Cloth modifier.
  18. On the Object rollout of the Modify panel, select Object Properties.
  19. 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.
  20. Select the flag object in the list, and click the Cloth radio button to the right of the list.
  21. 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.
  22. 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
  23. 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
  24. Click the plus sign for the Cloth modifier, then select Group from the four options that appear.
  25. 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.
  26. 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
  27. 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.)
  28. 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.
  29. 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
  30. 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.
  31. Select the wind object and set its Strength to 14.
  32. 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.

  1. Select the flag object, then press M to open the Materials Editor.
  2. 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.
  3. 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.
  4. Click the gray button next to the Diffuse material swatch for this sample.
  5. 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.
  6. If you did not do step 2, click the Assign to Object button. Simulate if you like.
  7. 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.
  8. Simulate the animation again and enjoy.