Previously a production blog for my final year project ( you can still find the old posts of WIP images) YOu have stumbled across a collection of knick knacks and tutorials for 3D CG...

Sunday, October 18, 2009

Should i make a simulation apron......

Outlining the Shirt

1. In one of the orthographic views, create these curves according to the image below.

  • It may help later on if you create these curves in a single direction (clockwise or counter-clockwise).
  • These curves form a closed loop. They are not attached to each other but rather where one curve ends, another begins (a little Zen philosophy for Maya). Figure 2 shows exactly how many curves you need to create (twenty-six).
  • If you created the curve end to end without any breaks, just insert a few knots here and there and detach them.
  • If you're wondering about the cuts on the sides of the torso, don't worry. They are there for creating a dart in the cloth.
  • Why there are so many curves? Its because we need to create seams later on and creating seams uses the curves the cloth object is created with, not the cloth itself.

2. Select all the curves and duplicate them. With the new set of curves still selected, pull them forward about 2 units (Translate Z=2). This set will be used to create the front of the shirt. Add another curve to make the collar opening and delete the curves that cross the collar.

3. Select the curves for the backside and put them in a layer and hide them for now and name the layer backside_curves. Select the front curves and put them in a layer called frontside_curves.


Creating the Panels

1. Next we're going to create the panels. Each panel must be created with a closed loop but cannot use the same curve twice. Duplicate the curve between the sleeve and the armpit (Figure 4). Select the four curves that make up the sleeve and in the Cloth menu select Create Panel (Figure 5).

2. After you create the panel, name it panel_FR_sleeve. The channel box lists only one attribute called Resolution Factor for the panel_FR_sleeve. Keep this guy in mind later on when we deal with cloth resolution issues.

3. Continue on creating panels and naming each one. Remember not to use a curve that was used previously for another panel. If you're not sure if a curve was already used, select it. If a panel turns pink, then that means that curve is being used for that panel and you need to duplicate the curve (Figure 6). Once you have finished creating all five panels (panel_FR_sleeve, panel_FR_armpit, panel_F_torso, panel_FL_sleeve, panel_FL_armpit) you should have something that looks like Figure 7.

  • If for some reason you need to change the shape of the curves, you'll need to disable the solver for all panels (Simulation > Disable Solver) and move around the Control Vertices.
  • When you're done adjusting the curves, be sure to enable the solver again (Simulation > Enable Solver).

4. Select all the panels and put them in a layer called panels and hide it for now.

5. Unhide the backside_curves layer and hide the frontside_curves layer and repeat steps 4-7. Name each panel with the panel_B... instead of panel_F.... I use these naming conventions for back (B) and front (F).

6. Unhide the panels layer. So far we should have something that looks like Figure 8.


From Panels to a Garment

1. Select a panel and hit Create Garment. Repeat this step until all panels have garments.

  • If for some reason you need to move the garment(s) around, you'll need to disable the solver (Simulation > Disable Solver). Select the curves, not the cloth object, and move it to its new co-planar location. When you're done moving the curves, enable solver again (Simulation > Enable Solver).
  • You can also move the garment by selecting the Cloth Mesh (right-click the garment) and move as needed. Once you have finished moving/sculpting the garment, hit Simulation > Save as Initial Cloth State. This second technique is very useful if you're trying to costume fit a round location (belly, beasts, etc.).

2. In Figure 9, you see that there are several INPUTS in the Channel Box called cpSolver1, time1 and ten cpStitchers.

3. Our next task is to connect all these individual cloth objects into one piece. This is done by creating seams. Seams are created by selecting the curves that are next to each other as I mentioned earlier in step 1. Select the two curves (that are sitting on top of each other) between the FR_sleeve and the FR_armpit and hit Create Seam. Name each seam as you create them (seam_FR_sleeve, seam_FR_armpit, seam_FL_sleeve, seam_FL_armpit).

  • If you run into problems with the seam causing the cloth to connect badly, you may have to go back and recreate the panel from scratch. Try selecting each curve in a clockwise or counter-clockwise motion and recreate the panel, garment and everything else normally.
  • Sometimes you may need to seam the garments together in different orders for the cloth to be completed seamed together. Experiment with different seaming orders and note your results.

4. Now we should be ready to close up those darts. Select the two curves that make up the ‘hole’ and Create Seam.

5. Next select each curve on the front and back sets and create seams between them to close off the cloth object. This step will take a few tries depending on the order you seam it shut. Once completed, your shirt should look something like Figure 10. Name the cloth object Shirt.

6. Next I should talk about creasing the seams. Each seam has two attributes: Crease Angle and Crease Stiffness. Crease Angle creates the look of two pieces of cloth sewn together. The values to use for Crease Angle should be between –180 and 180. Adjusting the Crease Angle lets you control more likes on the cloth object like lapels. Crease Stiffness tells the seam how much to resist being pulled flat. For the darts on both front and back, I used a Crease Stiffness value of 0.5. For the sleeve seams I used the Crease Angle of 45 and Crease Stiffness of 1.

7. Change the cpStitcher's Base Resolution to 400.


Collision Time!

1. Next create a simple poly body to use a collision object for the Shirt. Refer to Figure 11. Name the polygonal object Cloth_collide. With the Cloth_collide object still select, go Cloth > Create Collision Object. Set the Collision offset to 0.15 and Collision Depth to 0.4.

  • These numbers will vary from model to model but the general rule of thumb is that the Collision Offset should be half or less of what the value is for Collision Depth.
  • Collision Offset is the distance the cloth must stay away from the collision object. Collision Offset is affected by size of the model. So if you have a small character (10 units or so) you should decrease the default value (which is 1). Collision Offset is not affected by the Solver Scale however.
  • Collision Depth is the distance the cloth object can penetrate the collision object and still be repelled but once its past this it won’t try to repel the cloth object.
  • Collision Priority (use with multiple collision objects) determines which collision object takes priority in simulations. So if you have a character with a long skirt attempting to sit in a chair, you can tell the cloth which collision object has collision priority of which one not to penetrate.
  • Important note: The surface normals of the collision object should be facing out. If any of the collision object normals are facing inwards, it will pull the cloth in.

2. On the shirt, there is an attribute called cpSolver1. In cpSolver1, change the following attributes: Solver Scale = 10 and Relax Frame Length = 1. Relax Frame Length makes the cloth act more rubber-like or gives it bounce.

3. Now we’re ready for the big simulation. Rip off the Simulation panel and leave it open as a floating menu because you'll be going back and forth with testing and running simulation after simulation to get that shirt to fall just right. Go to Simulation and hit Start Simulation. This will start the solver and drape the shirt across the Cloth_collide object. Once the shirt has fallen to a position that looks pretty good, hit Stop Simulation. From here on, you’ll have to tweak the numbers to get the desired results. Every time you make an adjustment to the Shirt or Cloth_collide object, you should delete your Cache (Simulation > Delete Cache). Once you find a simulation that drapes pretty well, hit the Save as Initial Cloth State. This will keep the shirt in the solved pose from here on out.

4. Once you have the shirt simulated just the way you like, you should animate the Cloth_collide object to test the shirt completely. Animate the Cloth_collide object forward, back, up, down and some twisting motions (in other words, all the motions you body may do).

  • For a more thorough test of the shirt and Cloth_collide object, add more divisions to the Cloth_collide object, create a skeleton to act like the spine and smooth bind the Cloth_collide object. Animate the Cloth_collide object with torso twists, forward/backward spine bends and left/right spine bends.


Tips on Cloth Animations

  • The curves used to create the panels should not to be connected.
  • Closed loop curves does not mean attached. That simply means the end vertices are sitting on each other. Where one ends, another begins.
  • Maya will not solve properly if you don’t have your playback speed set for every frame. This is not an issue if you just use Start Simulation instead of hitting the play button.
  • Start out your Base Resolution low (300 or so) and work your way up.
  • If you have a few vertices that continue ‘jump’, it may be a resolution issue. Up the resolution 25-50 increments at a time to see if that corrects the jumpy vertices. If not, Disable Solver, right-click the shirt and translate the vertices away from the area they are having issues with. Hit Update Cloth State. Enable Solver, Delete Cache and start another simulation.
  • If you have a hard time locating the offending vertices, in the cpSolver attribute, turn on Output Statistics and Maya will output the return values of each simulation in the Script Editor history.
  • To reduce the vertices from popping, try adjusting the Velocity Cutoff Min attribute between 0 and 2. If necessary, you can keyframe this attribute during animation to help with the popping.
  • To set keyframes without scrubbing through the simulation, use the middle mouse button and click on the keyframe where you want to key.
  • Figure 12 shows the results of the darts we included in the sides of the shirt.
  • Another fun tool is the Paint Cloth Properties Tool. From this menu, you can paint a greyscale value to almost every attribute available to cloth. I’m not going to cover those in this tutorial because there are so many choices to choose from and combinations to get the exact feel that you want. Just remember, painting these properties will add to your simulation time.
  • One attribute that I do paint is the bendAngle attribute with a weight between 0.1 and 0.23. This will cause some interesting wrinkles. It takes a little practice (and a lot of patience) to learn how to paint a wrinkle.
  • Be sure to save your cloth cache also (Attribute Editor > cpSolver1).
  • You can also adjust the Velocity Cutoff Min, Velocity Cutoff Max and Velocity Dampening. These three attributes tell the shirt how fast to react to the overall motion of the shirt. Maya comes with a few samples of shirt setups (value settings for various cloth types) in extras/cloth/properties directory.

No comments:

Post a Comment