Project 6a: nCloth

Goal Learn the basics of effects, simulations, and nCloth.

Up to this point, you have learned sections of the consecutive animation pipleine; Modeling, Shading, Lighting, Rigging, and Animation. What happens when we run into something that doesn't fit very nicely into our pipeline - something like Fire, Smoke, Crowds, Explosions, Hair, Water, or Cloth? This is where effects come into play. Effects our catch-all term for everything that doesn't fit nicely into the usual animation pipleine.

We can see this in play if we attempt to make something very simple, like a waving flag. Let's try it!

  1. Create a plane with about 20 subdivisions. If you haven't deleted history on your plane, you can easily control the number of subdivisions on the plane by going to the channel box and clicking on Inputs > polyPlane1 and changing the Subdivisions Width and Subdivisions Height up to 20.

    Now, scale and rotate your plane, so it looks like a flag. Create a cylinder, and scale and rotate it too so it looks like a flagpole. If you'd like, add some materials to the flag to give it some color!

    Now comes the fun part. Make 48 frames of motion on the flag, by grabbing a handful of vertices and keying their position. While you're welcome to animate it however you'd like, it may be easier to key all of the vertices on frames 1, 12, 24, 36, and 48, then just spline the rest of the motion. Only spend around 5 minutes on this section, this is intentionally not easy.

    Playblast out a copy of your 48 frames to turn in. You can now delete or hide your current flag.

  2. We can see pretty quickly that this is a really awful way to animate a flag. Adding in rigged bones isn't much better (though you're welcome to try). Traditional rigging systems are designed for characters with bones that act in a very structured way. These systems are much less useful for dealing with freeform elements like "soft bodies", which is an effects term for deformable, collapsable objects, like cloth.

    To deal with this, we use our first simulation system called "nCloth", which is typically used to simulate fabrics. nCloth simulations are a form of procedural animation; you can specify constaints within the system, but the exact details are left up to the computations of the solver node, called the Nucleus. This project will briefly show you the potential of nCloth; feel free to explore it more in the self-driven second half of the assignment.

  3. First off, switch over to the FX menu set in the top left corner.

    Create another plane of about 20 subdivisions, and place a sphere beneath it. In the FX menu set, select the plane and go to nCloth → Create nCloth. Now play the animation. If the plane doesn't reach the sphere, you can either go back to frame one and move the nCloth further down, or increase the length of your current time slider.

    Oh no! The cloth doesn't collide with the sphere. That is because the nucleus doesn't have the sphere in its simulation system yet. We could make the sphere an nCloth object (feel free to try this). If you do, you will notice that now both the sphere and the cloth are falling, and even if the two did collide, the sphere would be made out of cloth and would collapse, which is not what we want.

    What we need to do is tell the nucleus that the sphere is something nCloth objects should collide with, even though they're not nCloth objects themselves. To do this, we make the sphere into an object called a collider. Select the sphere and go to nCloth → Create Passive Collider. Hit Play and watch as the plane deforms around the sphere as you might expect cloth to.

    Each vertex in the mesh becomes a unique point in the simulation of the nCloth. You can make the simulation finer by adding more vertices, but this will slow things down. Try the same process with a cloth that only has 5 subdivisions, or one with 40; both have their own problems and trade-offs. In general, you want to use a low resolution mesh for simulating nCloth and then subdivide it afterward for rendering.

  4. Now we're going to start making the actual flag. Create a new plane for the flag, and cylinder for the flagpole. Feel free to add your shaders to these objects too. Make your flag into a nCloth and hit Play starting at frame 1. With nothing to stop it, the nCloth will drop out of the scene due to gravity.

    We can't just add a sphere underneath it like last time, so how do we fix a part of the flag in place? The answer is called a "constraint". Select the top and bottom two vertices of one side of the plane and go to nConstraint → Transform Constraint.

    Now try hitting Play. The selected vertices should be fixed in place, while the rest of the plane is driven by the nCloth. If you move the constraint, then the vertices will move with it. Try moving the constraint while the nCloth is animating. You will notice that nCloth has trouble dealing with rapid motions.

  5. If you go to the Attribute Editor of the nClothShape1 node, you will notice that it has many, many attributes you can tweak. Experiment with these! If you'd like a general idea of the types of things that can be created with nCloth, Maya provides a set of presets that are useful starting points. At the top of the Attribute Editor click the Presets button and go to tshirt → Replace.

    We have a flag, but no wind. Go to the nucleus node in the Attribute Editor and change Wind Speed to 10. Recall that the nucleus is the "solver" of the nCloth system. It defines the world that all our simulations live in, so it is the place we should change things like gravity, wind, and simulation speed.

    Unfortunately, every time we run our simulation, the flag begins at rest. We want the flag to already be flapping when the simulation begins. To do this, we will set the initial state of the simulation. You can set the initial state of the nCloth by selecting your nCloth, going to the frame where you'd like to have your simulation start, and going to Fields/Solvers → Initial State → Set For Selected.

    Once we're happy with our simulation, we'd like to preserve it so that we can scrub back and forth on the timeline, as well as not need to recalculate the entire simulation every time we view the flag. You can create a preserved simulation called a "cache" of the results by selecting your nCloth, then using  nCache → Create New Cache → nObject. This will then run once through your simulation, and preserve it.

    Once you have your flag all cached and ready, create a 10 second playblast of the flag blowing. Feel free to keep playing around with nCloth settings and show off your results in the playblast.  You can see immediate results changes to settings in the viewport by going to Fields/Solvers → Interactive Playback.

Turn In You will be graded on the following: Turn the following into Collect-It on Catalyst: