IntroductionWelcome| 00:04 | Welcome to Understanding Maya nCloth.
| | 00:07 | My name is Aaron F. Ross.
| | 00:09 | nCloth is Maya's cloth module for
the nucleus simulation framework.
| | 00:14 | In this course, we'll
cover the following topics:
| | 00:17 | employing best practices for modeling
cloth, achieving physically accurate
| | 00:22 | simulations, optimizing performance,
applying constraints to connect cloth to
| | 00:27 | other objects, storing simulations to
disk with nCache, dressing an animated
| | 00:33 | character, generating special
effects, such as falling leaves, and more.
| | 00:40 | It's my pleasure to share
my experience with you now.
| | Collapse this transcript |
| What you should know before watching this course| 00:00 | Before we begin our journey into Maya
nCloth, I need to mention a couple of
| | 00:05 | prerequisites, so that you won't get stuck.
| | 00:09 | This is an intermediate level course,
and we'll be covering a lot of ground, and
| | 00:13 | I'll be assuming that you already know
the basics of Maya; how to navigate the
| | 00:17 | interface, and so on.
| | 00:19 | You'll also need a fast computer.
| | 00:21 | Dynamic simulations are notoriously
calculation-intensive, and a multi-core or
| | 00:27 | multi-processor computer is a very good idea.
| | 00:30 | So if you've got many cores, if you have
got a quad-core or higher machine, then
| | 00:35 | Maya nCloth can take advantage of that.
| | 00:38 | Finally, you need to have
some patience and perseverance.
| | 00:42 | Sometimes the simulations can take
quite a long time to calculate, and you'll
| | 00:46 | need to have ample time to
wait around for that to happen.
| | 00:50 | Additionally, because of the
complexity, you'll need to adjust many
| | 00:55 | different variables.
| | 00:56 | nCloth has a lot of attributes to play
with, and any one of those could have a
| | 01:01 | really large effect on the simulation.
| | 01:04 | Just keep trying, and eventually
you'll get the result that you want.
| | Collapse this transcript |
| Using the exercise files| 00:00 | We're about to jump in and get our feet
wet with Maya nCloth, but first I need
| | 00:04 | to mention a couple of things.
| | 00:06 | You might notice throughout the
course that my Maya looks a little bit
| | 00:09 | different than yours.
| | 00:10 | If you got a latest version of Maya,
which is 2013, you'll be seeing white text
| | 00:16 | on a black background.
| | 00:17 | I prefer the opposite, black text on
a light colored background, because I
| | 00:21 | think that that's easier to read.
| | 00:23 | I'm not going to cover how to set that
up in this course, however, I did cover
| | 00:27 | it in an earlier course, and that's Maya 2011:
| | 00:31 | Creating Natural Environments, and
there is a movie there called Setting Up the
| | 00:35 | Project, and if you're on the Mac,
there is actually another one that says
| | 00:39 | Setting Up on the Mac, and it
describes how to change the interface to this
| | 00:43 | light colored interface,
if that's your pleasure.
| | 00:45 | Now, also, if you are a premium subscriber
to lynda.com, then you have access to
| | 00:49 | the exercise files, and that
includes all the materials for the course.
| | 00:54 | If you've downloaded those, then you
will need to set Maya to that project. You
| | 00:58 | will do that through the File
menu; you will choose Set Project.
| | 01:03 | I've placed those Exercise_Files
right on my Desktop, so here they are now,
| | 01:07 | and I'll just highlight that folder,
and click Set, and then when I go to
| | 01:12 | File > Open, it'll take me to the
Exercise_Files/scenes folder, and here are all
| | 01:18 | the scene files for the course.
| | 01:21 | If you're not a premium subscriber,
then you'll need to create a project, and
| | 01:25 | save your work as you go.
| | Collapse this transcript |
|
|
1. nCloth BasicsUnderstanding the Nucleus solver| 00:00 | Before we begin building an nCloth
scene, I want to spend a few minutes
| | 00:05 | describing the nature of Nucleus.
| | 00:08 | Nucleus is the underlying framework upon
which nCloth is built, and other modules
| | 00:14 | within Maya have been
built upon Nucleus as well.
| | 00:18 | Currently, with version 2013,
we've got nParticles, and also nHair.
| | 00:24 | Today, we're going to be focusing, of
course, on nCloth, but let's talk for a
| | 00:28 | moment about the basic
components of a Nucleus simulation.
| | 00:34 | So I've got a constraint here, which is
attach the flag to the pole, or to near
| | 00:40 | the pole anyway, and I am going to click
here just to select that constraint, and
| | 00:45 | open up the Attribute Editor -- Control+A --
because here we can see all these tabs, and
| | 00:49 | that will help to explain the
process for a Nucleus simulation.
| | 00:55 | I've got this constraint node selected,
but there are also other nodes here.
| | 01:00 | There is an nClothShape node, and that
has all of the physical properties of our
| | 01:07 | cloth: how stretchy is it, how
heavy is it, how thick is it, and so on.
| | 01:13 | And then we've also got over here
another node, which is the nucleus node, and
| | 01:17 | that, if I scroll up to the top you
will see, has got some really basic
| | 01:21 | parameters here under Gravity and Wind,
and that's a dead giveaway that this is
| | 01:26 | the global settings for
the entire Nucleus system.
| | 01:31 | I could have 10 flags all attached to
the same nucleus solver node, and they
| | 01:37 | would all have the same Wind Speed in
the same Direction, same Gravity, and so on.
| | 01:43 | The nucleus solver also have some
important properties down in here in
| | 01:46 | Solver Attributes that let you control the
quality of your simulation on a global scale.
| | 01:51 | We'll be looking at all these in detail later.
| | 01:54 | I wanted to just give an overview of
the basic concepts of Nucleus, and how
| | 01:59 | that relates to nCloth.
| | Collapse this transcript |
| Setting animation preferences| 00:00 | Before we start building nCloth scenes, we need
to just change a couple of quick preferences.
| | 00:05 | Most importantly is the
playback rate of the timeline.
| | 00:09 | It's really critical that we
don't skip frames in the timeline.
| | 00:14 | It's possible that if you have your
timeline settings set to real-time, then,
| | 00:19 | when you try to play back a
dynamic simulation, it will break.
| | 00:23 | Real-time is not what you want. You need it to
play every frame, and not to skip any frames.
| | 00:28 | If it skips frames, then your
simulation is going to break, and the reason for
| | 00:33 | that is that Maya's dynamics
are so-called history dependent.
| | 00:37 | What happens on a particular frame -- lets
say frame 10 -- depends directly upon what
| | 00:42 | happened on the frame before it; frame 9.
| | 00:45 | If the playback engine skips frame 9,
then the data on frame 10 is going to be
| | 00:50 | bogus, and your simulations is going break.
| | 00:54 | We just have to make sure that we
don't play back in so called real-time.
| | 00:58 | We can do that in a couple of ways.
| | 01:00 | One way is to go into the Preferences.
| | 01:02 | Window > Settings Preferences > Preferences,
and in Time Slider, we have got the
| | 01:08 | Playback options here. You'll see
the Playback speed is at currently Play
| | 01:13 | every frame, and that's good; we need that.
| | 01:16 | If we were set to real-time, then again,
we would have problems. That needs to be
| | 01:21 | set to Play every frame. Below that
you will see Max Playback Speed, and I've
| | 01:26 | currently got that set to Real-time.
| | 01:29 | What that means is, in a lightweight
scene the playback engine will not exceed
| | 01:34 | the current time base,
which is 24 frames per second.
| | 01:38 | But in fact, the default is free, which
means that in a lightweight scene --
| | 01:43 | one that's not very computationally
expensive -- the playback rate will be too fast,
| | 01:48 | and you may not notice.
| | 01:49 | It's just important that the
playback speed never exceed 24, or whatever
| | 01:54 | your current time base is.
| | 01:56 | Otherwise, what you see in the viewport
will not correspond to what you get when
| | 02:00 | you render it.
That wants to be set to Real-time.
| | 02:05 | I've also chosen to choose Update view
All, meaning that we will see playback in
| | 02:10 | all the viewports,
regardless of which one is selected.
| | 02:14 | You could also change that setting of
the Playback rate from the timeline itself
| | 02:19 | by right-clicking, and choose Playback
speed > Play Every Frame > Max Real-time.
| | 02:26 | This is the setting that you need 100%
of the time when using dynamics, and any
| | 02:32 | other setting is either going to cause
your dynamic system to break, or for it to
| | 02:36 | play too fast, giving you a
bogus idea of the animation timing.
| | 02:43 | And also, just to make sure that we
know what our current playback rate is, we
| | 02:48 | want to enable the frame rate in the
viewports, and that's done in the Display
| | 02:53 | menu, under Heads Up Display, and I'll
to enable Frame Rate, and now it appears
| | 02:59 | down here in the lower right-hand
corner of the viewport, and if I press play,
| | 03:03 | you'll see that it's giving me a
readout of approximately 24 frames a second.
| | 03:08 | Those are critical settings that you
need to have enabled for all dynamics, and
| | 03:14 | nCloth is certainly dynamics,
| | 03:17 | so we need to have those turned on.
| | Collapse this transcript |
| Adopting a scale convention| 00:00 | The number one most important consideration
when working with dynamics is scale.
| | 00:06 | If your objects are not at the correct
scale for the dynamic simulation, then you
| | 00:12 | cannot reasonably expect your
simulation to work properly.
| | 00:16 | And unfortunately, it's not really an
easy or straightforward process in Maya.
| | 00:21 | I am going to lead you through that process,
and try to explain it the best I can.
| | 00:26 | What I have got here are three table
cloths made from nCloth, and each one is at
| | 00:32 | a different order of magnitude.
| | 00:34 | This one is that a 1 to 1 scale,
this is at a 1 to 10 scale, or 1/10 size,
| | 00:42 | and this one is a 1/100 scale, or 1 to 100,
so you see that that one is really teeny tiny.
| | 00:49 | You have to adopt a scale convention
before you begin to try to build a dynamic
| | 00:54 | simulation. That means you've got to
build your whole world to some known scale.
| | 01:00 | In the world of Maya,
objects have an absolute size.
| | 01:04 | Now, the issue is slightly confused
by the choice of units to measure the
| | 01:09 | absolute size of objects.
| | 01:12 | So let's take a look at our Preferences
under Window > Settings preferences >
| | 01:17 | Preferences, and within here, we've
got the Settings section. And you'll see
| | 01:23 | Working Units here, and it's says Linear
Working Units are set to Centimeter.
| | 01:27 | What that means is that a Maya "Maya unit"
is being represented as a Centimeter.
| | 01:35 | Another way of saying that is that
one grid line is currently being drawn
| | 01:40 | 1 centimeter long.
| | 01:42 | If I change this to meter, then the
spacing between gridlines is now 1 meter,
| | 01:48 | but that doesn't change the absolute size of
objects in the scene; they remain constant.
| | 01:54 | This setting is merely a choice
of how you wish to measure Maya's
| | 01:58 | little miniature world.
| | 01:59 | So you can change this all day long,
and in fact, it will not affect your
| | 02:05 | dynamic simulation at all.
| | 02:07 | So this is where the documentation
kind of leads people astray, because it
| | 02:12 | tells people to model their scene to meters,
| | 02:15 | and if you just set this Linear
Working Unit to meter, and then build your
| | 02:21 | scene, you may or may not actually get
a physically accurate result. There's
| | 02:25 | other variables here.
| | 02:27 | What I recommend is that you choose
whatever unit of measurement is convenient
| | 02:32 | to you -- and the default of centimeter
is actually probably the safest -- and then
| | 02:38 | build your scene according to those units.
| | 02:40 | In other words, my tablecloth was about
100 units from end to end, or 1 meter square.
| | 02:48 | So I am going to leave that as centimeters.
| | 02:51 | As we will see, once we have established
a scale convention, then we can tell
| | 02:56 | Nucleus what scale convention we've
adopted, and then the simulation will
| | 03:02 | actually run properly.
| | 03:04 | One last point of information is that
Maya's dynamics engine, whether it's nCloth,
| | 03:09 | or Rigid Bodies, or whatever, they all
assume that you've built your world at
| | 03:14 | 1/100 scale; not at 1 to 1 scale.
| | 03:18 | So if my object were at 1 to 100 scale, then
I'd build it to be 1 centimeter from side to
| | 03:27 | side, but then kind of imagine in my
head that it's in meter, because you can't
| | 03:32 | actually build a
gigantor scene at 1 to 1 scale,
| | 03:36 | meaning that if you have a very
large scene that's, let's say, the size of a
| | 03:39 | city, it's not possible for you to
build that at 1 to 1 scale; you actually
| | 03:44 | have to make a miniature.
| | 03:46 | So that's why these are the three main
conventions that you will see in Maya
| | 03:49 | scenes: 1 to 1 scale, 1 to 100 scale, which
is what dynamics want you to build at,
| | 03:56 | and 1 to 10 scale, which is kind of a compromise.
| | 03:59 | It's just important that before you
begin building things, you decide what scale
| | 04:04 | convention you're going to adopt, and
then carry that through in the construction
| | 04:08 | of all your assets. Then when you get
to creating dynamics, you can adjust the
| | 04:14 | dynamics engine to correspond to
whatever scale convention you have chosen.
| | 04:19 | I actually build all of my scenes
at 1 to 1 scale, and that's the scale
| | 04:23 | convention that will be
adopting in this course.
| | Collapse this transcript |
| Building polygon primitives| 00:00 | Let's build a kind of a hello
| | 00:02 | world scene, where we just make a
tablecloth, and just drop it onto a round
| | 00:07 | circular table, and that will get us
through the basic processes of nCloth.
| | 00:12 | We want to decide on a scale convention
to begin with, and as I said, I like to
| | 00:16 | build my scenes at a 1 to 1 scale,
because that's what most other programs use.
| | 00:20 | So I just want to verify in my Settings
Preferences, Preferences that my settings
| | 00:26 | are currently Working Units set to
centimeter, and that means that a grid line is
| | 00:31 | currently 1 centimeter.
| | 00:33 | I want to resize the grid itself,
because this is only currently 12 centimeters
| | 00:40 | from center to edge.
| | 00:41 | I'll go up to the Display menu, and
choose the Grid options, and the first one
| | 00:46 | here, Length and Width, is the extent
of the grid in the perspective view.
| | 00:50 | I'll set that to 200 centimeters. Hit
Apply, and you'll see that extends now out
| | 00:55 | to 200 units from the origin, but the
spacing of the grid is too tight for me to
| | 01:02 | be able to see what I'm doing.
| | 01:04 | I am going to change the number of
grid lines to be 1 grid line every 100
| | 01:09 | units, and hit Apply.
| | 01:11 | Now I have got a grid line every 100
units, but it's a little bit confusing,
| | 01:16 | because we are also
seeing subdivision lines here.
| | 01:20 | Confusingly, the Maya subdivision and main
grid lines are the same color by default,
| | 01:27 | so it makes it really hard for
you to know what you're doing.
| | 01:30 | What I recommend is you set the grid
lines and the subdivision lines to be
| | 01:34 | two different colors.
| | 01:36 | I'll just change that grid lines color
to slightly darker gray, and hit Apply, and
| | 01:41 | now you can see what's going on here;
this is a major grid line, and these are
| | 01:45 | minor gridlines, or subdivision lines.
| | 01:48 | Now, what we see here currently now is
a major grid line every 100 units, and
| | 01:53 | a subdivision line every 100 divided by 5,
which is every 20 units, or every 20 centimeters.
| | 02:00 | I'm just going to set the number
of subdivisions to 10, and hit Apply.
| | 02:06 | Now what I've got is a major grid line
every 100 units, and a minor gridline
| | 02:11 | every 100 divided by 10, or every 10 units.
| | 02:15 | If you're not quite sure what you're
seeing here, you know, you can go scrolling
| | 02:18 | down into this Display section, and turn
on numbers on the axes, and hit Apply, and
| | 02:24 | that will be a little bit easier for you
to get a grasp on how big things are by
| | 02:29 | just looking at the grid.
| | 02:30 | So I know that the distance from here
to here is 1 meter, or 100 centimeters.
| | 02:36 | Now I am ready to build my tabletop.
nCloth only works with polygon objects; you
| | 02:41 | can't use NURBS, and you can use subdivs,
although you can smooth polygon objects
| | 02:46 | after they have been built,
| | 02:48 | but you'll always have to start from a
polygon object.Drag out to create that
| | 02:53 | cylinder, release the mouse, that sets
the radius, and then I'll click and drag up
| | 02:58 | to set the height, and I
have got a primitive cylinder.
| | 03:01 | I'll press the 5 key, so I can see shading.
| | 03:04 | I'll just go into the Shape node here,
into this input, and just increase the
| | 03:08 | number divisions a little bit, just so
it's a little bit smoother around the
| | 03:11 | edges. I'll set that to, let's say, 30, just so
it's a little bit smoother. That's my tabletop.
| | 03:18 | Now I need a tablecloth to drop on it.
| | 03:20 | Go back to the Create menu, Polygon
Primitives > Plane, and with nCloth, you'll
| | 03:27 | actually get the best results if
you use two-dimensional geometry.
| | 03:32 | In other words, planar geometry;
something that has no thickness to it.
| | 03:37 | Later in the course, we'll see how you
can create cloth objects that have real
| | 03:41 | thickness, involving using a wrap deformer.
| | 03:45 | But the cloth objects themselves, the
ones that are going to be dynamic, should
| | 03:49 | really be two-dimensional, and flat, no
thickness, so that plane is perfect for that.
| | 03:54 | I just want to go into those Inputs once
again, and I'll set the Width and Height
| | 03:58 | to be 200, so that's a pretty big
plane; that's 2 meters, or 6 feet on a side.
| | 04:04 | Then I have got the number of subdivisions.
This will not deform, because it's
| | 04:09 | got no internal geometry. It has to have some
grid structure to it in order for it to deform.
| | 04:15 | I'm going to go ahead and select
Subdivisions Width and Height, and set those
| | 04:20 | both to a value of 20,
and that should be fine.
| | 04:23 | That's a pretty good level
of detail for a cloth object.
| | 04:27 | Another important point about nCloth is
that you are going to get best results
| | 04:32 | if your polygons are square. That's not
an absolute rule, but if the polygons
| | 04:37 | are long, and skinny, and rectangular, then
that's going to negatively affect the simulation.
| | 04:43 | If I had something like this, I would
not get a very good result from that, or
| | 04:48 | likewise, if I had too few
divisions running in the other direction.
| | 04:54 | My advice is, try to make
them square if possible.
| | 04:57 | Also, try to avoid triangles, or n-gons,
which is a polygon with more than four sides.
| | 05:04 | Just to keep on the safe side, I am going
to delete the construction history on these.
| | 05:08 | I have set the level of detail, and I
want to protect myself from accidentally
| | 05:13 | changing the level of detail later,
which, if I am not careful about what I'm
| | 05:18 | doing, I could actually break my simulation.
| | 05:20 | So to prevent any negative outcomes
from happening, I am going to delete the
| | 05:24 | construction history on my entire scene.
Edit > Delete All by Type > History, and
| | 05:30 | now when I select either one of those
primitives, you will see that there is no
| | 05:34 | more input node, and there's
no more parameters, like Radius.
| | 05:37 | And again, that just to safeguard
myself against breaking the simulation
| | 05:41 | later on.
| | Collapse this transcript |
| Freezing transforms| 00:00 | Before I create nCloth, I want to talk
a little bit about freezing transforms.
| | 00:05 | Ideally, your nCloth objects should
have Scales of 1, 1, 1, and that's pretty
| | 00:10 | much the case for all objects in Maya.
| | 00:14 | If you've used the Scale tool, and
changed the scale of your objects -- maybe I
| | 00:20 | decided I didn't want it to be quite
so large; maybe about 1 meter on a side,
| | 00:24 | rather than 2 meters -- then I could
scale these both down to a value of 0.5.
| | 00:30 | If I do that, then the best
practice is to freeze the transforms.
| | 00:34 | As you probably know, freezing
transforms will restore these values to 0.
| | 00:40 | In other words, whatever the current
values are, those become the new 0,
| | 00:45 | and whatever the current Scale values are,
those get reset to 1, or frozen to a value of 1.
| | 00:51 | Here we go; Modify > Freeze Transformations.
| | 00:55 | I can go into the Option box for that.
| | 00:57 | You can see I can choose to
freeze any one of the transforms.
| | 01:00 | I am going to do all three,
and click Freeze Transform.
| | 01:04 | Now when I select either one of these,
you will see that we've got Translate and
| | 01:08 | Rotate values of 0, and Scale values of 1.
| | 01:12 | This is really helpful, not just to
prevent any possible issues with the
| | 01:15 | dynamics, but also so that we can
always get these objects back to the
| | 01:19 | starting positions.
| | 01:21 | If we've moved them around, or done
strange things to them, we can always
| | 01:24 | get them back to where they were by
simply just setting all their Translate
| | 01:29 | and Rotate values to 0. Simple enough!
| | 01:32 | It's just a best practice to always
freeze the transform before creating
| | 01:36 | a dynamic simulation.
| | Collapse this transcript |
| Creating passive colliders| 00:00 | Now our scene is set up, and ready to
animate. I just want to be able to see it
| | 00:05 | a little bit better.
| | 00:06 | It's a good idea to see the wireframes.
| | 00:08 | In my panel toolbar here, I'm
going to enable Wireframe on shaded.
| | 00:12 | I'm going to hide that toolbar now;
| | 00:16 | the shortcut for that is Control+Shift+M.
Just get that out of the way, because we
| | 00:22 | don't need that now.
| | 00:23 | So, I've got a tabletop,
and I've got a tablecloth.
| | 00:27 | And so that the tablecloth will collide
with the tabletop, I'll need to make the
| | 00:33 | tabletop a so-called passive collider.
| | 00:36 | I'll select that, and I want to go
into the nDynamics menu set in the
| | 00:41 | upper left-hand corner.
| | 00:43 | You'll see there's a menu that says nMesh.
| | 00:46 | You can see, at the very top, we've
got two different options to create.
| | 00:51 | There is Create Passive
Collider, and Create nCloth.
| | 00:55 | I want to choose Create
Passive Collider, and activate that.
| | 00:59 | Now you'll see that with that object
selected, I don't see anything special
| | 01:05 | in the Channel box.
| | 01:07 | But let's open up the Attribute
Editor, Control+A, with that object selected.
| | 01:11 | Now you will see a few things.
| | 01:13 | You will see nucleus 1;
| | 01:15 | that is the master simulation node
that's controlling all the objects.
| | 01:20 | Then we've got an nRigidShape;
| | 01:23 | that's a node type called nRigid,
| | 01:25 | also known as passive collider.
| | 01:28 | Just like everything in Maya, it needs to
have at least two names for the same thing.
| | 01:32 | It's got the menu name, which is human
friendly, and then it's got the node name,
| | 01:38 | which is more for programming
purposes, or coding purposes.
| | 01:42 | In the next movie, we will
create an nCloth for the tablecloth.
| | Collapse this transcript |
| Creating nCloth| 00:00 | Okay, we're ready to create
nCloth for this tablecloth.
| | 00:03 | I've only got 24 frames
in the timeline currently.
| | 00:06 | I just want to expand that little bit.
| | 00:08 | Here's the end of my animation range.
I'll set that to 96 frames, which is four
| | 00:13 | seconds, and I'll select that cloth
object, and go back to the nDynamics menu set,
| | 00:18 | to nMesh, and choose Create nCloth.
| | 00:22 | I want to go to the Option box for that,
just to show you that there is one kind
| | 00:28 | of semi-important
attribute here, which is the Solver.
| | 00:32 | It's possible for you to have more than
one nucleus solver in the same scene;
| | 00:36 | we'll look at that later in the course.
| | 00:38 | You would use that if you've got two
completely different systems that don't
| | 00:42 | need to interact, or maybe one of them
has to have wind on it, and the other one
| | 00:47 | doesn't. In this case, I've only got
one nucleus solver in the scene, and so
| | 00:51 | that's what showing up in this
pulldown list; it just says Solver nucleus1.
| | 00:56 | If I needed to, I could create a new solver
in the process of creating this nCloth shape,
| | 01:01 | but in this case, I don't want that,
because I need it to collide with the tabletop.
| | 01:06 | Go ahead and click Create Cloth, and
you'll see it turn magenta on the wireframes,
| | 01:11 | and that's just an indicator
that it's connected to nucleus.
| | 01:15 | You'll also see, by the way, that there
is a nucleus node here at the origin.
| | 01:20 | You can access the attributes
really easily by just clicking on that.
| | 01:24 | So let's see what this looks like when we
play it back; I'll rewind it, right-click
| | 01:28 | on the timeline just to verify that my
Playback Speed is Play Every Frame, Max
| | 01:33 | Real-time, and I want to make sure that I've
got my Heads Up Display Frame Rate visible.
| | 01:39 | Display > Heads Up, Frame Rate. We'll play
that through, and you can see that it is
| | 01:45 | falling, and it is doing
something, but its moving ultra slow.
| | 01:48 | Give it a few more seconds here;
| | 01:50 | let's give it like 240
frames, which is 10 seconds worth.
| | 01:54 | So in 10 seconds, it's just touching
that tablecloth, and kind of drifting over
| | 01:59 | it; it looks very strange.
| | 02:02 | This is an artifact of an improper scale.
| | 02:05 | I've built my scene at 1 to 1 scale,
but Nucleus assumes that my scene is
| | 02:10 | built at 1 to 100 scale,
| | 02:12 | so what we want to do is we want to fix
that, and we'll do that in the next movie.
| | Collapse this transcript |
| Setting Nucleus Space Scale| 00:00 | We've got our nCloth simulation working,
but as you see, it's not looking correct.
| | 00:06 | It won't even really bend properly.
| | 00:08 | And at first blush, you might think
that this is because maybe the dynamic
| | 00:12 | properties of the cloth are not set
correctly, maybe it's got too much stiffness,
| | 00:17 | or something like that.
| | 00:18 | So you might be tempted to select that,
and go into its attributes, Control+A, and
| | 00:23 | start playing around with these
Dynamic Properties, changing the amount of
| | 00:27 | Rigidity, or the amount of
Compression Resistance, or whatever.
| | 00:31 | But if you were to do that, you'd
actually be barking up the wrong tree, because
| | 00:35 | that's actually not the problem here.
| | 00:37 | The problem is that Nucleus expects me
to build my scene at 1 to 100 scale, but
| | 00:43 | I've built my scene at 1 to 1 scale, and
so currently, nucleus thinks that this
| | 00:49 | tablecloth is actually not 1 meter from
side to side, but 100 meters from side to
| | 00:57 | side, and that's why
it's not behaving correctly.
| | 00:59 | So, I'm going to rewind. I
want to go to the nucleus node,
| | 01:04 | and there is a super important attribute
that's kind of buried way down here at the bottom;
| | 01:08 | you need to dig around find that.
Here it is: Scale Attributes.
| | 01:12 | I want to open that up,
| | 01:14 | and this is probably the most important
attribute in all of nucleus: Space Scale.
| | 01:21 | If Space Scale is 1, then Nucleus
thinks that your world is that 1:100 scale.
| | 01:27 | If you've built your scene to 1 to
1 scale, then you'll need to put a
| | 01:31 | multiplier value in here.
| | 01:33 | But there's a catch; most people would
think that, oh, I've got a scene that's
| | 01:38 | built that 1 to 1 scale. Nucleus thinks
that it's at 1 to 100 scale, so I'll just turn
| | 01:44 | this up to a 100, multiplying it by 100.
| | 01:47 | But in fact, that's actually the
exact opposite of what you need to do.
| | 01:51 | Nucleus thinks that this object is not
100 meters wide, but actually 10,000 meter
| | 01:57 | wide; a 100 times a 100.
| | 01:59 | Okay, well that's totally wrong.
| | 02:02 | The weird thing here is that the Space
Scale needs to be set to not 100, but the
| | 02:08 | inverse of 100,
or 1/100, or 0.01.
| | 02:11 | For a scene that's built at 1 to 1 scale,
the Space Scale needs to be 1/100.
| | 02:18 | There you go. So now
it's playing back correctly.
| | 02:23 | General rule of thumb: if your scene is built
at 1 to 1 scale, set the Space Scale to be 0.01.
| | 02:31 | If your scene is built at 1/10 scale,
set the Space Scale to 0.1, or 1/10, and if
| | 02:39 | you're seen is built at 1/100
scale, then the Space Scale will be 1.
| | Collapse this transcript |
| Choosing an nCloth preset| 00:00 | Alright, we've set our simulation to be
at the correct scale for the scene that
| | 00:05 | we built, and the next thing we want to
do is to choose an nCloth preset, so that
| | 00:10 | we can determine the
dynamic properties of that cloth.
| | 00:13 | I want to select it, and go to Control+A,
attributes, and I want to go to the shape
| | 00:19 | node, and it's just listed as nClothShape1.
| | 00:23 | For any node in Maya, you can have
presets that will store node values.
| | 00:28 | Remember that each one
of these tabs is a node,
| | 00:31 | and we can store all of the
values for that node in a preset.
| | 00:37 | We can create our own presets,
and Maya also ships with presets.
| | 00:42 | And the nClothShape node is one where
we really need presets, because there are
| | 00:46 | many attributes here, and any one of
these could have a really big effect on the
| | 00:52 | end result. They're pretty sensitive.
| | 00:55 | Therefore, it's very important
that we start from a preset.
| | 00:59 | That way we'll know that it's more
or less working, and then we can adjust
| | 01:03 | individual attributes of that
preset in order to fine-tune it.
| | 01:07 | To access the presets, just go ahead and
hold down the Presets button, and you'll
| | 01:12 | see there's lots of them in here.
| | 01:14 | Let's try the tshirt preset.
| | 01:15 | I'm still holding down the mouse, and I
want to go over here to Replace, and what
| | 01:19 | that's going to do is it's going to
replace all the current values with the
| | 01:23 | values that are stored in that preset.
Release the mouse, and a bunch of those
| | 01:28 | attribute values have changed.
| | 01:30 | And now if I play my simulation,
we're getting a different result.
| | 01:34 | Let's try another one. Go
back up to the Presets, and let's
| | 01:38 | try concrete > Replace.
| | 01:42 | So we can actually get rigid
effects from nCloth; interesting.
| | 01:47 | Let's try rubberSheet > Replace, and now if
I play my simulation, that one was a lot
| | 01:54 | stretchier. There is a lot of
deformation to that rubber preset.
| | 01:59 | But what I need to do is really make it
so that it won't slip across that surface.
| | 02:05 | I think what I'm going
to do here is a burlap.
| | 02:08 | Play that back, and that pretty much
did what I wanted, although, as you can see,
| | 02:13 | it's slipping off the table. We're
going to fix that up in the next movie.
| | Collapse this transcript |
| Adjusting nCloth and nRigid attributes| 00:00 | We've got a basic simulation going.
I've chosen the burlap preset for my
| | 00:04 | tablecloth, but what I need to do is
really make it so that it won't slip across
| | 00:09 | that surface, and we can adjust some
simple attributes to make that happen.
| | 00:13 | I'll select the tabletop, and go to
Control+A to get the Attribute Editor, and I
| | 00:18 | want to go to that RigidShape node, and scroll
down a little bit here, and you will see, aha!
| | 00:23 | There it is: Friction.
That's the main thing.
| | 00:25 | What if I gave it a
Friction of 0, and play that back?
| | 00:30 | It's going to slip off of there;
| | 00:31 | it's going to take a little bit of
time to do it, because it's a pretty thick
| | 00:35 | heavy piece of burlap,
| | 00:36 | but with a Friction of 0,
it's not going to stick.
| | 00:39 | It had a default Friction of 0.1;
| | 00:41 | I could turn that up all the
way to a full Friction value of 1.
| | 00:47 | So that does actually increase the
amount of friction, but we have to increase
| | 00:51 | the friction on both of the objects,
because it's the interaction between the
| | 00:55 | two of them that's causing this effect.
| | 00:57 | I want to select the cloth object,
and go to its shape node, and find its
| | 01:03 | Friction attribute as well.
| | 01:05 | So, it's under Collisions > Friction,
so it's got a value of 2.
| | 01:10 | I'm going turn it up
all the way to a value of 4.
| | 01:13 | And you can see that it's still kind of
slipping around, but we've got one more
| | 01:17 | little ace in the hole here, which is
Stickiness. Turn that up, and that's
| | 01:21 | going to cause that cloth to just
really stick to any collider object.
| | 01:27 | In fact, I could have probably used
just the Stickiness alone, but I wanted to
| | 01:30 | take the opportunity to
illustrate how Friction works as well.
| | 01:35 | I'm pretty happy with that.
| | 01:37 | We could play around with some of the other
attributes too. Maybe you want it to kind
| | 01:41 | of flow a little bit better,
instead of kind of being so stiff.
| | 01:45 | In my nClothShape node, I can go
into the Dynamic Properties, and start
| | 01:48 | playing around with things,
| | 01:50 | just being aware that these are very
sensitive attributes, and a small change may
| | 01:56 | have a very large effect. My advice to
you as you're learning how those attributes
| | 02:00 | work is that you adjust
this one attribute at a time.
| | 02:04 | Adjust one thing, play it back;
see what it did.
| | 02:08 | If it did what you want, great.
Leave it.
| | 02:10 | If it did something you didn't want,
then set it back the way you found it.
| | 02:14 | Don't just start randomly changing stuff,
because that's not going to work. You
| | 02:18 | need to be really methodical and
scientific about the process. You're basically
| | 02:22 | running experiment to see
which attributes do what.
| | 02:26 | In this case, you'll see I've got
Stretch Resistance, Compression Resistance,
| | 02:30 | Bend Resistance; those are
all at a pretty high value.
| | 02:34 | Scrolling down a little bit, you'll see
also Mass. I'm going to turn the Mass
| | 02:38 | down a bit; let's try 0.5.
| | 02:41 | Rewind. It's still falling at the same
rate, but it's flowing a little bit better.
| | 02:47 | And I can also reduce some of these
other values, like the Stretch Resistance,
| | 02:51 | and Compression Resistance, which is
kind of the opposite of stretching.
| | 02:55 | That's giving a little bit of a softer result.
| | 02:58 | We can bring the Bend Resistance down
too; maybe value of 1. Play that back.
| | 03:04 | So you could play around with these,
and try to get a better result. I'll just
| | 03:09 | reduce the Damping too.
| | 03:10 | Damping is kind of an overall chill out
factor that's causing the simulation to
| | 03:16 | sort of slow down with each frame, and
there you go; with less damping now, I'm
| | 03:20 | getting a better result, I think.
| | 03:22 | In the following chapters, we'll learn
more about how to fine-tune this, how
| | 03:26 | to work with things like construction
history, and even how to dress characters.
| | Collapse this transcript |
|
|
2. Simulating Dynamic nClothPlanning and preparing| 00:00 | Now that we've got an idea of how nCloth
works, we're going to apply that to a
| | 00:05 | real world situation, which is
making a flag blow in the breeze.
| | 00:10 | To do that, we need to have an
image to apply onto the flag first.
| | 00:14 | I've provided some images here in
the Exercise Files > sourceimages.
| | 00:20 | And if you don't have the exercise
files, you can go and find some images
| | 00:24 | to place onto a flag.
| | 00:26 | The reason we need these in advance
is because the shape of that image will
| | 00:32 | determine the shape of the flag itself.
| | 00:34 | In other words, the aspect ratio of the
image determines the aspect ratio of the
| | 00:39 | actual geometry we're going to be using.
| | 00:42 | Aspect ratio, of course, is the proportion
of the width divided by the height.
| | 00:46 | Again, we need to have that
information before we begin.
| | 00:50 | Additionally, we'll need to set up the
UVs on the flag, and it's a lot easier to
| | 00:55 | do that if you've got an image already
done, and ready to put onto that flag.
| | 00:59 | There we go; we've got them here
in the Exercise Files > sourceimages.
| | 01:02 | If you don't have the exercise files,
then you'll need to go and find something,
| | 01:06 | and put it into your
current project sourceimages.
| | Collapse this transcript |
| Laying out the scene| 00:00 | We're ready to start laying out our
scene to make an animation of a flag
| | 00:05 | waving in the breeze.
| | 00:07 | I've carried over the same scale
conventions and the same grid settings from
| | 00:11 | the previous exercise.
| | 00:13 | Let's just review that really quickly.
| | 00:14 | In Window > Settings/Preferences >
Preferences, under Settings, my current Linear
| | 00:20 | Working Units are centimeters.
| | 00:23 | And I'm going to build my object at 1:1
scale, meaning that my flag, if it were
| | 00:28 | to be one meter wide,
that would be 100 units.
| | 00:32 | And you can see my Grid
settings are set up for that already.
| | 00:35 | We can go check in on that by going to
the Display menu > Grid Options, and you can
| | 00:40 | see I've got a Length and width of 200
units, or 2 meters from center to edge in
| | 00:46 | the perspective view.
| | 00:47 | I've got a grid line every 100 units,
or every 1 meter, and subdivision lines
| | 00:52 | every 100 divided by 10, or every
10 centimeters, or 1/10 of a meter.
| | 00:59 | By the way, I want to mention in
passing that if you are expecting the Grid
| | 01:03 | Options dialog to tell you what your
current grid settings are, unfortunately,
| | 01:08 | that is not the case.
| | 01:10 | It's very common, actually, that you'll
open a scene, and have grid settings that
| | 01:14 | don't match what you see in this dialog,
because the dialogue is actually a way
| | 01:18 | for you to establish new grid settings.
| | 01:22 | And the only reason that these happen
to match right now is because I've got a
| | 01:27 | fresh, brand new scene, and these values
were carried over from the last time I
| | 01:32 | was in this Grid Options dialog.
| | 01:35 | But if I were to open a different scene,
that had different grid options, I would
| | 01:40 | still see these values.
| | 01:42 | This is not a way for you to check
what the current state of the grid is;
| | 01:46 | it's only a way for you to determine what
you want the grid to be when you click OK.
| | 01:52 | Now let's build a flag. I want
to do that in the front view port.
| | 01:56 | So I'll tap the spacebar, hover my
mouse over the front viewport, and tap the
| | 02:00 | spacebar again.
Use the wheel to dolly back.
| | 02:04 | I want to have a flag that's about a
meter tall, or 100 units tall, and I want it
| | 02:09 | to be up in the air, somewhere in this
area here, about 400 units off the ground,
| | 02:14 | or 4 meters off the ground.
| | 02:16 | Go to the Create menu, in Polygon Primitives,
and we'll choose Plane, and I'll go
| | 02:21 | ahead and draw that out
approximately the right size.
| | 02:24 | Once I've got it approximately that size,
I want to go into its Inputs, and I want
| | 02:29 | to change up the Width and Height.
| | 02:31 | Don't scale the object;
| | 02:32 | use the attributes here
to change the proportions.
| | 02:36 | I've got an aspect ratio of 1.5 for my
images. That would correspond to a Width
| | 02:41 | of 150, and a Height of 100.
| | 02:45 | If you're using some other images
other than the ones that I provided, you'll
| | 02:49 | need to figure out what the
aspect ratio of that image is.
| | 02:53 | Some flags are a 1.6 aspect ratio; some
are actually even a 2:1 aspect ratio, where
| | 02:59 | it's twice as wide as it is tall.
| | 03:01 | You'll need to find the pixel dimensions of
your image, divide the width by the height,
| | 03:07 | that will give you the aspect ratio, and
then you can use that to calculate what
| | 03:11 | the width and height of the
actual polygon object should be.
| | 03:15 | If I wanted an aspect of 1.6, if the
height were a 100, then the width would be a
| | 03:20 | 100 times 1.6, or 160.
| | 03:24 | But I want a 150 in this case; that
will match the images I already have.
| | 03:30 | Now we need to set up our subdivisions;
how many divisions do we want here?
| | 03:35 | And we want to kind of
err on the side of caution.
| | 03:38 | If we add too much detail at this
point, then our simulation's going to run
| | 03:41 | really slow, and we'll have some
issues trying to get it to work.
| | 03:45 | We can smooth the nCloth
afterwards at render time.
| | 03:49 | In other words, use a kind of low level
of detail to calculate the dynamics, and
| | 03:54 | then smooth it over at render time, using
a mesh smooth node, or some other way of
| | 03:58 | dropping a subdivision
algorithm on top of the dynamics.
| | 04:03 | If I wanted the polygons to be, let's say,
5 centimeters on a side, then what I'd do
| | 04:09 | is I would just divide these values.
| | 04:12 | So 100 divided by 5 would be 20;
that means I've got 20 divisions.
| | 04:19 | So if it's a 100 top to bottom,
divided by 20, that means each one of these
| | 04:24 | segments is going be 5
centimeters, or 100 divided by 20.
| | 04:29 | Likewise, with the width, if I want it to
be equal, and square polygons, then this
| | 04:35 | would be 150 divided by 5, which is 30.
| | 04:39 | And now I've got square
polygons, and I'm good to go.
| | 04:43 | In the next movie, we'll look at applying
a texture onto this, and getting it to
| | 04:47 | fit properly on the surface.
| | Collapse this transcript |
| Defining materials| 00:00 | Now I want to build a material, and
place it onto the surface of the flag.
| | 00:05 | Go ahead and select that flag, and I
want to press the 5 key to see shading, and
| | 00:10 | I also want to press the 6 key, so that
once I have a texture applied, I will see
| | 00:14 | it in the viewport.
| | 00:15 | To assign a new material, I'm just going to
right-click, and choose Assign New Material.
| | 00:22 | My new material dialog pops up;
| | 00:25 | I don't need any highlights on this, so
I'll use a Lambert shader, or LambertmMaterial.
| | 00:30 | The Attribute Editor opens
automatically, and I've got Lambert2.
| | 00:33 | Let me rename that, and I'll call
this one flag1Lambert, and press Enter.
| | 00:41 | I'll just increase the Diffuse amount
a little bit; let's say, a value of 0.95.
| | 00:45 | That will just make it render brighter.
| | 00:48 | And I want to drop a map
into this Color channel.
| | 00:52 | I'll click here to create a new render
node, and this going to be a file texture,
| | 00:57 | so I'll choose File.
| | 00:59 | Then in the Attribute Editor, I'll need
to browse for that file, and it takes me
| | 01:04 | directly to my current project sourceimages,
and I'll select that first flag
| | 01:08 | image, and click open. So there you go.
| | 01:12 | I've got it placed onto the flag, but you
might notice that it's not quite right.
| | 01:16 | This red stripe here is much larger
than the blue stripe here, and it doesn't
| | 01:21 | match what I see over there.
| | 01:23 | And that's because the UVs on the
flag are not set up correctly by default.
| | 01:28 | UVs, of course, are the texture placement
coordinates, and what Maya does by
| | 01:33 | default is assume that
your object is a square.
| | 01:37 | And in fact, if my flag actually was a
perfect square, then it would fill the
| | 01:42 | available area perfectly,
| | 01:44 | but because my flag is not a
square, it's not fitting correctly.
| | 01:48 | That's easy enough to fix.
| | 01:50 | I'll close the Attribute Editor. I
want to select that flag, and I want to go
| | 01:54 | into the polyPlane1 input node, and
you'll see down here it says Create UVs.
| | 02:01 | And I want the option here
to turn Normalization Off.
| | 02:05 | Normalization is, once again, stretching
your texture to a perfect square, and
| | 02:11 | that's not what I want here.
| | 02:12 | This is a little bit non-standard terminology,
because usually, in most programs,
| | 02:17 | normalization means to stretch the
UVs to fit the object, but in Maya world,
| | 02:24 | normalization means to stretch the
UVs to a square to fill the zero to one
| | 02:29 | texture space. But in this case, I want to
turn Normalization Off. And there we go;
| | 02:35 | now my texture is fitting
properly on the flag geometry.
| | Collapse this transcript |
| Constructing a simulation| 00:00 | Before we convert our flag to
nCloth, we should make a backup of it.
| | 00:05 | Once you make something into an nCloth,
you can actually remove the nCloth, but
| | 00:11 | it's really difficult, and a painful
process if you've done a whole bunch of work
| | 00:16 | on it, and you will lose all that work,
| | 00:18 | and essentially end up having to delete the
object, and start over again. It's a real drag.
| | 00:22 | We need to future-proof our work, and
prevent that problem from occurring in the
| | 00:26 | first place by simply duplicating the
object before we convert it to nCloth.
| | 00:32 | I want to select that plane, and I
want to go to the Edit menu, and go to
| | 00:37 | Duplicate Special options, and I'll
reset the settings, so you can see what the
| | 00:44 | default settings are, but the setting
that we really want is we want to turn
| | 00:48 | Duplicate input graph on.
| | 00:51 | What that's going to do, it's going to
make a new object that has all of the same
| | 00:56 | nodes and attributes
as the existing object.
| | 01:01 | In other words, it'll make a new
polyPlane input node, which will be
| | 01:05 | independent of this one.
| | 01:07 | If you chose Duplicate input connections,
what you'd have is two shapes that were
| | 01:13 | both connected to the same input node,
and that's not what we want in this case.
| | 01:18 | I've turned Duplicate input graph on,
click Duplicate Special, and now I've got
| | 01:23 | pPlane2, and polyPlane2,
which is another input shape.
| | 01:30 | So I can change that. We've got a
totally different object that has the
| | 01:34 | same initial properties.
| | 01:37 | So we just need to organize this. I will
go into my Outliner, and you see I've got
| | 01:42 | pPlane1 and pPlane2.
| | 01:43 | One of these is going to be a backup.
| | 01:45 | I'll just use pPlane2. I'll double-click
on that, and I'll call it flag_backup,
| | 01:50 | and pPlane1, I'll simply call flag.
| | 01:56 | I just want to hide this;
| | 01:57 | I'll select it, go over to the Display,
Layers here, and click on Create new layer
| | 02:03 | containing the selected objects,
| | 02:06 | and then I'll double-click on that.
| | 02:07 | I just want to call this backupLayer.
| | 02:11 | I could have actually saved it out
to a completely different file, and
| | 02:14 | re-imported it if I needed to, but
this is much more straightforward.
| | 02:18 | So we can see that that's actually
happening. I'm just going to move that over to
| | 02:22 | the side, and then turn it off by
toggling the visibility of the layer.
| | 02:27 | We've kind of set it up so that if we
run into trouble, we can always go back to
| | 02:32 | that other flag that happens to have
the exact same properties as this one.
| | 02:36 | Now, we should have a flagpole as well.
In this version of the exercise, I'm
| | 02:40 | not going to actually attach the flag
to the flagpole directly, but I'm going
| | 02:45 | to create a transform constraint, which
will cause the flag to be locked in position.
| | 02:50 | But I need a visual indicator of the
flagpole, and I also want to make it so that
| | 02:55 | it will have something to collide with.
| | 02:58 | I'll tap the spacebar, and in the top
view, I will just zoom out a little bit, and
| | 03:03 | I want to create just a cylinder.
| | 03:05 | Create > Polygon Primitives > Cylinder. At
the origin, drag out the radius, and then
| | 03:11 | in the perspective, or any other view,
I'll click and drag to set the height, and
| | 03:17 | then I'll need to just go into
the Inputs here, polyCylinder1.
| | 03:22 | And I'll set the Radius to 2 centimeters,
and the Height to 500 centimeters.
| | 03:29 | I just need to move that up, do
that in front viewport; position that.
| | 03:35 | And now, the number of
divisions is always important.
| | 03:39 | The Subdivisions Height should remain at 1,
and Subdivisions Axis of 20 is probably fine.
| | 03:46 | So I've got that flagpole; let me rename
it. Double-click up here in the Channel
| | 03:50 | box, and we'll call that flagpole. And
I'm ready to create my simulation, so I'll
| | 03:56 | go to my perspective view, press the 5
key, and then the 6 key, just position
| | 04:03 | that flag a little bit closer to the
pole, and I'll go ahead and create a passive
| | 04:07 | collider on the pole.
| | 04:10 | In the nDynamics menu set, I'll choose
nMesh > Create Passive Collider, and for the
| | 04:17 | flag, I'll select that, and
go to nMesh > Create nCloth.
| | 04:21 | I'll rewind to frame 1, and I'll set my
timeline to, let's say, 120 frames for the
| | 04:30 | end of the animation range.
| | 04:33 | Press Play, and see what I get.
| | 04:35 | And just as we saw with the tablecloth
exercise, the flag is taking forever
| | 04:40 | to fall through space.
| | 04:42 | I built my scene at a 1:1 scale, and Maya
expects my scene to be built at 1:100 scale,
| | 04:50 | but it's easily fixed. I'll select
either one of these objects, doesn't matter
| | 04:54 | which; hit Control+A, so I
can get to the nucleus node,
| | 04:59 | and scrolling down, I'm
looking for Scale Attributes.
| | 05:04 | Open that up, and because this is a 1:1
scale world, the Space Scale attribute
| | 05:11 | needs to be 0.01, and press Enter.
| | 05:16 | Press Play, and see what I get. There
we go; now it's falling through space.
| | 05:21 | I could create a passive collider on
the ground to catch the flag as it falls,
| | 05:26 | but in fact, actually, nucleus has an
implicit ground plane built into it.
| | 05:31 | I can go up here where it says Ground Plane,
and just turn that on, and that way the
| | 05:36 | flag will actually have something to land on.
| | 05:39 | That's the basics of our simulation,
and in the next movie, we'll constrain the
| | 05:43 | flag, so that it will stick to
a certain location in space.
| | Collapse this transcript |
| Creating transform nConstraints| 00:00 | Our flag is currently falling, and it's
falling at the correct speed, because
| | 00:06 | we've set the Space Scale.
| | 00:08 | Now we want to attach it to the flagpole,
or freeze certain parts of the flag to
| | 00:15 | certain locations in space.
| | 00:17 | To do this, we'll use a transform constraint;
that's a flavor of nConstraint, and
| | 00:22 | an nConstraint is a constraint
that only applies to nucleus objects.
| | 00:27 | It's a similar concept to standard
animation constraints, such as, like, an orient
| | 00:32 | constraint, or a parent constraint,
| | 00:35 | but nConstraints, of course,
only work with nucleus objects.
| | 00:39 | What I want to do is select the flag,
and then choose a vertex or vertices, and
| | 00:44 | then apply the constraint.
| | 00:46 | I'll right-click, and go to Vertex
component mode, and I'll just select the
| | 00:51 | top left corner of my flag, and
I'll go to the nDynamics menu set, and
| | 00:55 | choose nConstraint.
| | 00:57 | You'll see there are
a lot of menu items here.
| | 01:00 | These are all just slightly
different variations on the same node type.
| | 01:04 | The nConstraint has lot of different
options, and these menu items let you choose
| | 01:09 | which options you want with a single click.
| | 01:12 | In this case, we want a Transform nConstraint,
which is essentially going to fix
| | 01:17 | vertices to a certain location in space.
| | 01:20 | Go ahead and click on that. Now I've got
a new object in my scene, and I've got a
| | 01:26 | new node in my Attribute
Editor that says dynamicConstraint.
| | 01:31 | And if I press Play, you'll see that
it's trying to hold that flag in place.
| | 01:36 | Couple of things about this; one,
obviously the flag is way too stretchy.
| | 01:41 | I can fix that by changing the preset.
| | 01:44 | The other thing I'm seeing here is
that the transform constraint doesn't
| | 01:48 | have enough influence;
| | 01:49 | it's only affecting that one vertex.
| | 01:52 | We'll fix that in the next movie.
| | 01:54 | Right now we can fix the stretchiness
really easily by just selecting that flag.
| | 01:59 | Go to the Attribute Editor,
Control+A, and go to the shape node.
| | 02:04 | You can click on Presets, and
choose one of the other presets.
| | 02:07 | I'm going to use the tshirt preset,
and I'll Replace all of the attributes.
| | 02:13 | Play that back, and it's not
quite as stretchy anymore.
| | 02:15 | That's pretty good.
We'll fix the rest later.
| | 02:18 | We'll give this a different
range of influence in the next movie.
| | Collapse this transcript |
| Editing constraint membership| 00:00 | Currently the transform constraint is
only affecting one vertex, and that's not
| | 00:05 | giving a very realistic effect.
| | 00:08 | I can extend the influence
of that transform constraint.
| | 00:12 | What I need to do is to select the
transform constraint node, and then select
| | 00:16 | vertices on the flag, and then I
can add those to the constraint.
| | 00:20 | Let's getting really close here,
I'll dolly in, and you can see there is
| | 00:25 | a little cross there, and that's the locator
for the transform constraint node itself.
| | 00:31 | So I have got that selected, and then I
also want to select vertices on the flag,
| | 00:38 | so I'll hold down Shift, and click on
the flag, and I'll right-click, and choose
| | 00:43 | Vertex, and hold down Shift, and drag a
rectangle to select some of these other vertices.
| | 00:50 | Let's say, a grid that's 5 by 5;
that should be plenty.
| | 00:54 | I have now selected both the transform
constraint, and the vertices, and I can go
| | 01:01 | back up to nConstraint,
and choose Add Members.
| | 01:06 | And when I click off the object now
you'll see that the transform constraint has
| | 01:10 | got a lot more vertices, and if I select
that transform constraint either here, or
| | 01:16 | in the outliner, we'll see that indeed
there are more vertices involved now.
| | 01:23 | Let's play that,
and see what it looks like.
| | 01:26 | Alright, well we just added more
vertices to that transform constraint.
| | 01:30 | I also want to add another constraint
node down here at the bottom.
| | 01:35 | I can select the vertices in
advance to make that happen.
| | 01:38 | I'll select my flag, right-click to make
sure I am in Vertex component mode, and
| | 01:44 | drag out a rectangle to select 5 inches
by 5 inches grid there, approximately.
| | 01:50 | And with those vertices selected,
I'll go up to nConstraint > Transform.
| | 01:56 | Now, this time when I do it, the
transform locator, that little cross, is
| | 02:01 | positioned at the center of all of
those vertices, and I actually want to move
| | 02:07 | that over to the corner.
| | 02:08 | I want to grab the Move tool,
and select that little locator.
| | 02:13 | And if you're having trouble
selecting it, then use the outliner.
| | 02:18 | Window > Outliner, dynamicConstraint2, and I want
to move that down, and position it at the corner.
| | 02:26 | Sometimes when you do this, and you play the
simulation back, your object might jump around,
| | 02:31 | but it will only do that once.
| | 02:33 | If I rewind, and play, it didn't do it
to be this time, but sometimes you'll
| | 02:37 | see that your object will actually move,
because you have moved the transform constraint.
| | 02:43 | But don't panic, because if you just
rewind, and play it back again, it will be fine.
| | 02:48 | So we've added those vertices to those
transform constraints; now we want to
| | 02:52 | change the influence, so that it doesn't
just have this huge selection of a block
| | 02:58 | of vertices that don't move.
| | 02:59 | And what we'll do is we'll play
around with the dropoff, or production of
| | 03:04 | influence based upon distance.
| | Collapse this transcript |
| Adjusting strength drop-off| 00:00 | Our transform constraints are working,
but as you see, all of these vertices are
| | 00:06 | being basically glued in place.
| | 00:09 | What we want is a transition where
there will be a great deal of strength to
| | 00:14 | the constraint here at the corner that
falls off, or diminishes with distance.
| | 00:21 | I want to select the transform constraint,
and open up the Attribute Editor,
| | 00:24 | Control+A, if it's not already open. And
you're looking for a section that says
| | 00:29 | Strength Dropoff, and directly
above that is the Dropoff Distance,
| | 00:35 | and these two work in conjunction; you have to
actually adjust both of them to get a result.
| | 00:40 | The Strength Dropoff is currently a
flat line up here, meaning that there is no
| | 00:46 | diminishment of strength over distance.
| | 00:49 | What I need to do is click anywhere
here in this little graph, and create a new
| | 00:55 | point on that curve, and drag it
down to the lower right-hand corner.
| | 00:58 | And what this is doing is it's
reducing the strength of the
| | 01:04 | transform constraint.
| | 01:06 | The left-hand side of the graph
here corresponds to the position of the
| | 01:10 | transform constraint icon, and the
right-hand side of the graph is the strength
| | 01:17 | at the Dropoff Distance.
| | 01:19 | What I'm saying here now is that at 50
centimeters away, we will have Strength of 0.
| | 01:27 | Press Play, and see what happens.
| | 01:29 | We are seeing a little bit of diminishment
of intensity or strength to that
| | 01:34 | transform constraint, and we can tell
here because these vertices here are
| | 01:39 | showing these little dashed lines,
which are springs connecting the constraint
| | 01:43 | to the cloth vertices.
| | 01:45 | What I need to do here is
reduce the Dropoff Distance.
| | 01:49 | Basically, I want to figure out what
this distance here from that transform
| | 01:53 | constraint to the farthest vertex.
| | 01:55 | I'm going to estimate that to be about 15
centimeters. Rewind, and play back, and you see
| | 02:04 | here that that fell completely off
the pole. We can just give it a greater
| | 02:10 | Dropoff Distance, and that will cause
the overall strength to be greater.
| | 02:13 | Of course, I could do other things, like change
the dynamic properties of the cloth itself.
| | 02:20 | That looks okay on that
one, at least for a start.
| | 02:22 | I'll go down here and select the other one.
| | 02:25 | Once again, adjust the Strength Dropoff
curve, so that it's falling off linearly
| | 02:30 | from the position of the transform
constraint to the Dropoff Distance here, and
| | 02:36 | I'll set that to, let's try 15 on that one.
| | 02:39 | It doesn't need to be as strong;
| | 02:41 | the lower constraint can be weaker.
| | 02:44 | So we just have to adjust these values
a little bit until we get that flag to
| | 02:48 | stay where it's intended to be.
| | 02:50 | I'll increase the Dropoff
Distance on the top one a bit;
| | 02:53 | let's give that a value of 30.
| | 02:56 | Press Play, and see what I get.
| | 02:58 | And I could adjust the shape of this
curve too, if that were my intent, you know,
| | 03:03 | I could give that a different shape.
| | 03:05 | But I think the linear transition is
easier for me to comprehend, so I am going
| | 03:10 | to leave it at that.
| | 03:11 | Once I add wind in here, I might
need to adjust those once again.
| | Collapse this transcript |
| Adding Nucleus wind| 00:00 | We have got our transform
constraints basically working.
| | 00:03 | Let's add a little bit of
wind to make our flag blow.
| | 00:07 | I'll increase the end of my playback
range to, let's say, 600 frames, and select
| | 00:13 | any of those dynamic objects, and go to
the Attribute Editor, Control+A, if it's not
| | 00:19 | already open, and find the nucleus node.
| | 00:22 | And near the top, you'll see a section
that says Gravity and Wind, and we have
| | 00:28 | got Wind Speed, and Wind Direction.
| | 00:30 | The Wind Direction currently is set to 1 in
X, so it's positive 1 in the X-axis, meaning
| | 00:38 | that it's going to blow from left to
right in my perspective view currently.
| | 00:44 | Let's increase the Wind Speed.
| | 00:46 | I'll give it a value of 100. Play back
the simulation, and we're getting a little
| | 00:52 | bit of wind. Let's increase the
Wind Speed to 200; press Enter.
| | 00:58 | There we go, that's better. And we
could change the Direction as well.
| | 01:04 | If we wanted it to blow in the
opposite direction, then we would set Wind
| | 01:08 | Direction X to be -1, and that would
cause the wind to blow in the negative X
| | 01:14 | direction, which would be
right to left in this view.
| | 01:18 | Now the wind is blowing the other way.
| | 01:21 | I liked it better the other way,
blowing in positive X, and I'll do that.
| | 01:27 | Cool, we have got some wind.
| | Collapse this transcript |
| Using interactive playback| 00:00 | Here's a really fun and very useful
tool within Maya that will allow you
| | 00:04 | to change attributes while the
simulation is running; it's called
| | 00:08 | interactive playback.
| | 00:10 | To see this most dramatically, I am
going to set the Wind Speed down to 0 to
| | 00:15 | start with, and I'll go ahead and go up
to the nDynamics menu set, to the nSolver
| | 00:23 | menu, and you will see Interactive Playback.
| | 00:27 | And when I activate that,
it starts playing.
| | 00:29 | You can see I have got no wind currently,
| | 00:31 | but if I move this slider up, I am
increasing the Wind Speed interactively in
| | 00:36 | the viewport. So I crank that up to
200. And if I bring it back down to 0, the
| | 00:43 | wind stops. Turn it back
up, the wind starts again.
| | 00:48 | And I can use this to fine-tune my
scenes, and in fact, any attribute can be
| | 00:53 | adjusted while you're running
in interactive playback mode.
| | 00:56 | You do have to prepare for that, though.
| | 00:58 | If you wanted to adjust attributes, you
need to get the Attribute Editor open to
| | 01:02 | the page that you want to use.
| | 01:04 | You also need to make sure you
have enough time in your timeline.
| | 01:08 | I've only got 600 frames.
| | 01:09 | If I was going to be doing a lot of work,
and testing a lot of things, I'd need to
| | 01:14 | increase this to a much larger
value, in the range of thousands,
| | 01:17 | so I would have enough time in the
timeline to play around with those attributes.
| | 01:21 | That concludes our chapter on the
basics of setting up an nCloth simulation.
| | 01:27 | In the next chapter, we'll look at
fine-tuning it, and directing it to produce
| | 01:31 | a particular result.
| | Collapse this transcript |
|
|
3. Directing nClothTuning solver attributes| 00:00 | Now that we've got a basic simulation
running, we need to direct it, and
| | 00:05 | fine-tune it, and make it better.
| | 00:08 | What I want to show you in this movie is
the solver attributes for the nucleus node.
| | 00:13 | So I have got the nucleus node open
already, I have selected my cloth, and hit
| | 00:17 | Control+A to open the Attribute Editor.
| | 00:19 | And in the nucleus tab, if we scroll
down a bit, we'll find a section that
| | 00:25 | says Solver Attributes.
| | 00:27 | And essentially, there are really two
main properties here that we can play
| | 00:31 | with: the Substeps, and the
Max Collision Iterations.
| | 00:37 | Higher values will give you,
quote, more accurate results.
| | 00:42 | However, just increasing the value
alone is not really going to be good enough
| | 00:47 | to fix problems that you have,
but it's a start at least.
| | 00:52 | These default values are quite low, and
if I increase them, what will happen is
| | 00:58 | the simulation will start running more
slowly, because it's working harder, and
| | 01:03 | allegedly, more accurate.
| | 01:05 | The Substeps refers to the number of
calculations per frame, and with higher
| | 01:12 | numbers, we will get a slower playback,
and it'll actually, in a lot of cases,
| | 01:18 | change the behavior of the cloth.
| | 01:21 | And you can see here, this is kind of
curious; I've increased the Substeps, and
| | 01:25 | I've got a worse result.
| | 01:26 | It was better before with lower Substeps.
| | 01:30 | I'll take it back down to 4.
| | 01:32 | That's kind of counterintuitive.
| | 01:34 | We see things like this also with
rigid body dynamics, where if you increase
| | 01:39 | the Solver Attributes to improve the quality,
it sometimes has a paradoxically reverse result.
| | 01:47 | You can see here now that my cloth is
kind of clumped up. We can try to help
| | 01:51 | that along by increasing the number of
Max Collision Iterations, and I'll set
| | 01:56 | that to, let's say, 20.
| | 01:58 | And what that does is it repeats the
calculations more than once in order to
| | 02:05 | find whether the cloth is intersecting
or colliding with anything else.
| | 02:12 | As I've increased the Max Collision
Iterations to 20, that has actually
| | 02:16 | corrected the problem of the cloth
folding in, and getting stuck to itself.
| | 02:21 | You will need to tune these Solver
Attributes for each scene, and the default
| | 02:26 | values are probably okay, but you will
find that it's pretty common you'll need
| | 02:31 | to increase the number of
Max Collision Iterations.
| | Collapse this transcript |
| Checking the simulation with a Playblast| 00:00 | As we increase the quality of the
simulation, the playback will be slower and
| | 00:04 | slower in the viewport,
| | 00:06 | to the point where we may not be
able to correctly evaluate whether the
| | 00:10 | animation is moving at the right
speed. Currently what I've done is I
| | 00:15 | have increased the Max Collision
Iterations up to 40 in order to
| | 00:19 | illustrate the problem.
| | 00:20 | You'll see that my frame rate here is
hovering around 10 frames per second.
| | 00:24 | It's hard for me to evaluate this, and
to be able to tell whether or not this is
| | 00:29 | running at the right speed.
| | 00:31 | What I'll do is just simply make a
Playblast. I'll rewind back to frame 1, and
| | 00:36 | I'll go into the Window menu > Playblast,
and let's go into the Options for that
| | 00:41 | Playblast. This will just
render a temporary movie out.
| | 00:46 | I'm on Windows,
so I want to use the avi format.
| | 00:50 | You actually can use QuickTime;
maybe we'll do that instead.
| | 00:53 | I am going to choose a compressor, and
since this is just a temporary movie, it
| | 00:58 | doesn't really matter what compressor we use.
| | 01:00 | I'll choose H.264,
and just turn up the Quality.
| | 01:04 | Scrolling down a little bit here, the
render size for the Playblast is determined
| | 01:08 | by this Display size option.
| | 01:10 | If it's set to From window, with a Scale
of 0.5, what we'll see is it will render
| | 01:16 | out to be a quarter screen video. In
other words, it will find the size of this
| | 01:20 | window, and then reduce it down to half
of that, which is quarter of the area.
| | 01:27 | Down here, we have the ability to
save the file if we need to, and I'm going
| | 01:31 | to actually opt to do that. Turn on Save, and I
want to give it a name; I'll call this 03_02.
| | 01:40 | What I always do is I give the Playblast
a name that exactly matches the name of
| | 01:45 | the actual scene file.
| | 01:47 | That way I know, if I've got lots of
playblasts, I know which one is which.
| | 01:52 | It's going to save into the
movies directory in my current project.
| | 01:57 | I'll go ahead and click
Playblast, and allow it to play through.
| | 02:01 | Now, I didn't set the range for the Playblast,
meaning it'll just do the entire timeline.
| | 02:09 | If I really need 600 frames, that's
fine, but if I don't, I can actually
| | 02:12 | just hit the Escape key, and that will kill
the Playblast, and save what we have to disc.
| | 02:20 | We've got QuickTime installed here,
so that just goes and launches
| | 02:23 | automatically, and now I can play this
back, and try to determine if my movie
| | 02:27 | looks correct. Is the cloth moving
the way that I want it to, now that I'm
| | 02:32 | seeing it at normal speed?
| | 02:33 | Now, I do want to mention that since I've
got my frame rate displayed here in the
| | 02:39 | window, that frame rate is actually
being captured, but that's the frame rate
| | 02:44 | during the creation of the Playblast,
not during playback of this movie.
| | 02:51 | We could be pretty sure that this
movie is actually playing back at the
| | 02:54 | correct time base of 24.
| | 02:56 | If you're not sure, you can actually
go into the Movie Inspector in QuickTime,
| | 03:02 | and check to see the Frame Rate, and it
says it's a 24 frames per second movie.
| | 03:07 | You will need to do this a lot, because
it's really common that you will not be
| | 03:11 | able to get real-time playback in the
viewport, meaning that your fallback
| | 03:14 | position is to make
lots and lots of playblasts.
| | Collapse this transcript |
| Controlling collision thickness| 00:00 | One of the most important
properties of an nCloth shape is the
| | 00:04 | collision thickness.
| | 00:06 | That's an envelope around the cloth that
determines whether or not the cloth is
| | 00:12 | touching something,
or colliding with something.
| | 00:15 | The collision Thickness is found in the
nClothShape node, in the top section here,
| | 00:20 | which is Collisions.
| | 00:22 | And currently, I've got a Thickness
of 0.8 or so, and that seems to be
| | 00:28 | working okay. I've got no wind in this
particular scene, and I'm just checking to
| | 00:32 | see if the cloth is self-intersecting.
| | 00:35 | And as I look here, it seems okay; I
don't see any areas where the cloth is
| | 00:40 | actually poking through itself. Very good.
| | 00:42 | I'll rewind, and let's
reduce the Thickness down to 0.
| | 00:46 | This is something you'd never
do in production, or in real life.
| | 00:49 | I'm doing that just to make my point,
reducing the thickness down to nothing.
| | 00:54 | Pressing Play, and immediately we see
the difference here. The cloth is
| | 01:00 | self-intersecting,
and poking through itself.
| | 01:03 | And that's a really terrible outcome,
because if that cloth actually passes
| | 01:07 | through itself, ironically, it can go
inside itself, but once it gets in there,
| | 01:12 | it gets trapped,
and it can't get back out again.
| | 01:14 | We can fix that simply by
having a appropriate collision Thickness.
| | 01:20 | You need to see the collision thickness
envelope in order to really know what you're doing.
| | 01:25 | What we can do is go down here where
it's says Solver Display, and there's a
| | 01:30 | pulldown list that currently says Off,
| | 01:33 | and what we want to choose
here is Collision Thickness.
| | 01:36 | We have to have some non-zero
thickness value to see it.
| | 01:40 | And what you get is a mesh object, an
envelope, that completely surrounds your
| | 01:45 | nCloth, and as we increase the
collision Thickness, we'll see that yellow
| | 01:50 | envelope increase in thickness.
| | 01:51 | Any collision object that is another
nCloth, or an nRigid, or passive collider,
| | 01:57 | any nucleus object that comes close to
this cloth will collide with the cloth if
| | 02:04 | it touches this outer envelope.
| | 02:07 | And the Thickness of 1 centimeter here is
fine; it's a little bit more than I had a
| | 02:13 | moment ago, but it's doing
what we want, essentially.
| | 02:17 | When you're finished playing around
with this, you want to turn that Solver
| | 02:20 | Display back off again.
| | 02:22 | I will mention that if you have a
really large Thickness value, that the
| | 02:26 | Simulation will run much more slowly.
If I increase the Thickness to something
| | 02:31 | like 5, and rewind, you might think that
that would help the simulation, but in
| | 02:35 | fact, it's become problematic.
| | 02:38 | The collision thickness is too
great, and we're not getting an efficient
| | 02:42 | nCloth simulation now.
| | 02:45 | So sometimes there is too much of a good thing.
| | 02:48 | In my case here, the optimum
value was a value of 1 centimeter.
| | Collapse this transcript |
| Adjusting dynamic properties| 00:00 | To fine-tune the behavior of an nCloth
Simulation, we'll want to play around with
| | 00:05 | the Dynamic Properties.
| | 00:07 | To do that, we want to have a better
understanding of what those Dynamic
| | 00:10 | Properties are doing.
| | 00:11 | I want to select that nCloth object, and
open up the Attribute Editor, and go to
| | 00:16 | shape node, the nClothShape node.
| | 00:18 | And I want to show you how
nCloth kind of works.
| | 00:22 | It's a spring system, and what it does
is between any two adjacent vertices,
| | 00:28 | there's something called a cross link,
and it acts like a little spring.
| | 00:32 | And that spring can change length.
| | 00:35 | We can visualize those cross links by
going into the Collision section, and to
| | 00:40 | Solver Display, enabling Stretch Links here.
| | 00:45 | And now you'll see those cross links
that are connecting each pair of vertices.
| | 00:50 | The Stretch Links, or cross
links, are enabled by default.
| | 00:54 | It is possible to turn them off, but
that will kind of break your simulation.
| | 00:58 | I want to scroll down to just show
you in the Quality Settings area of
| | 01:03 | the nClothShape node,
| | 01:05 | there's a switch here
that says Add Cross Links,
| | 01:07 | and there's a bunch of options here
about how those are supposed to behave.
| | 01:11 | If I turn this off, and rewind my
timeline, you'll see that all those
| | 01:17 | cross links have disappeared.
| | 01:19 | And if I try to play this, you'll
see that it doesn't give a good result.
| | 01:24 | It doesn't feel like cloth.
| | 01:25 | It feels like some sort of unnatural material.
| | 01:28 | And it's because the cloth is
allowed to basically stretch without having
| | 01:33 | any resistance to it.
| | 01:34 | So I want to rewind, and I definitely
do need those cross links enabled, and
| | 01:40 | rewind again, so we can see them there.
| | 01:43 | Now that I know that they are really
back on, I'm going to turn those Stretch
| | 01:46 | Links back off in the Solver Display
section at the top, in the Collisions area of
| | 01:50 | the Attribute Editor.
| | 01:51 | So now that we kind of understand how it
works under the hood, then these Dynamic
| | 01:57 | Properties attributes will
make a little bit more sense.
| | 02:00 | Stretch Resistance and Compression
Resistance are really the most important ones
| | 02:04 | here, and that's why
they're way up here at the top.
| | 02:07 | Stretch Resistance is the length of
the spring, and if it's a high Stretch
| | 02:13 | Resistance, then the spring is
not allowed to get much longer.
| | 02:16 | So those cross links are not
allowed to expand, or become longer than
| | 02:20 | their initial value.
| | 02:23 | And of course, if I increase the Stretch
Resistance, then I'll get less stretchiness.
| | 02:29 | Let's turn the shading back on here,
press the 5 key, and then the 6 key.
| | 02:34 | And so, if I have a greater Stretch
Resistance -- you can go up to 200, or even
| | 02:39 | higher -- then the cloth will not be
able to stretch as much; it'll be stiffer.
| | 02:44 | But if I have a really low Stretch
Resistance, or turn it almost all the way
| | 02:48 | off, then the cloth will be a lot stretchier,
and that's a really extreme value, of course.
| | 02:56 | You will find that as you increase the
Stretch Resistance, then the simulation
| | 03:00 | will run more slowly.
| | 03:02 | It's working harder, trying to maintain
the length of those cross links, so that
| | 03:07 | they don't stretch too much.
| | 03:09 | What I find is that I do have to
increase that Stretch Resistance to quite a
| | 03:13 | high value of a 100, or even
more, in almost all cases, really.
| | 03:18 | The complement to Stretch Resistance
is Compression Resistance, which is
| | 03:22 | resistance to the links becoming shorter.
| | 03:25 | If I have a high Compression Resistance,
then, of course, those links will not be
| | 03:30 | allowed to become shorter.
| | 03:32 | Generally, I would set them both
to be approximately the same value.
| | 03:36 | Below that, you will see Bend Resistance,
and that has to do with the ability of
| | 03:41 | the vertices to swivel and
rotate around each other.
| | 03:46 | And with a low Bend Resistance, then
what will happen is the cloth will be
| | 03:50 | allowed to fold and crumple, but with a
high Bend Resistance, then it'll be a lot
| | 03:55 | stiffer, and it'll take a lot
more force to get it bending.
| | 03:59 | I'll play that back.
| | 04:00 | And with a Bend Resistance of 200,
what we have is a very thick cloth;
| | 04:06 | it's not really going to deform very much.
| | 04:09 | But if I reduce that Bend Resistance,
then it's going to bend quite a lot.
| | 04:15 | And again, you'll see that
that has an impact on performance.
| | 04:19 | There are some other attributes in here that
we're going to cover later in the course;
| | 04:23 | things like Rigidity, and, Mass, and so on.
| | 04:25 | I'm going to go ahead and
move on to the next step.
| | Collapse this transcript |
| Smoothing nCloth with subdivision surfaces| 00:00 | I've adjusted some of the
Dynamic Properties a little bit,
| | 00:03 | and I'm getting what I think is a
pretty good result as I play that back.
| | 00:08 | And you'll see that I'm getting nearly
real-time playback; it's hovering around
| | 00:13 | 22 frames per second,
and that's not too bad.
| | 00:16 | But the reason why it's so good is because
I've got a low level of detail to the cloth.
| | 00:22 | I've got a grand total of only 600 quadrilaterals,
or 1200 triangles on the entire model,
| | 00:27 | and that's pretty low level of detail.
| | 00:29 | Remember, you can always check your polygon
count by going to the Display > Heads Up
| | 00:34 | Display > Poly Count, and the selected
object here is showing 1200 triangles, or 600
| | 00:40 | faces. Turn that back off again.
| | 00:44 | That's why it's playing
back at near real-time speed;
| | 00:47 | it's because it's a low level of detail.
| | 00:49 | And that's what we want, in fact, for a
cloth object; we really want to have the
| | 00:53 | lowest possible level of detail that
will work, so that our performance in the
| | 00:58 | viewport will be reasonable.
| | 01:00 | Especially when you start piling stuff on,
it gets pretty difficult to work with
| | 01:05 | if your frame rate is 1 frame per second.
| | 01:07 | Of course, if you render this, it's not
going to look that great, because these
| | 01:12 | are straight line edges here.
| | 01:13 | These are just ordinary
polygon edges currently.
| | 01:17 | But our ace in the whole is to
simply smooth the cloth at render time,
| | 01:22 | and there's a couple of
different ways of doing that.
| | 01:25 | The most obvious way, and the way that
is probably the easiest is to simply
| | 01:30 | select the cloth, and press the 3
key on the keyboard, and that enables
| | 01:34 | smooth mesh preview.
| | 01:36 | The 1 key turns it off, and the 3 key
turns it on, and you can see that that's
| | 01:42 | made a difference already.
| | 01:44 | It's smoothed out my cloth.
| | 01:46 | There is it without the smoothing, and
then hit the 3 three key, and there it
| | 01:50 | is with the smoothing.
| | 01:51 | Actually, if I was rendering in mental ray, then
in fact, that's all I would really need to do.
| | 01:56 | It would render just like this.
| | 01:58 | However, if I render with one of
the other renderers, like Maya software,
| | 02:02 | then unfortunately that smooth mesh preview
is not going to be shown in the rendering.
| | 02:08 | To illustrate, I'll get in really close here.
| | 02:10 | And I'll do a quickie render in Maya
software, and if you look closely, you
| | 02:15 | can see that there are some jagged edges,
especially down here; that's pretty clear.
| | 02:21 | I if get in really close on that, and
do another render, so we can see with no
| | 02:25 | ambiguity, the smoothing is not being
shown in the Maya software render.
| | 02:30 | If we need to render in Maya
software, or Maya hardware, or any of those
| | 02:35 | other renderers, then the smooth mesh preview
option is not really going to be available.
| | 02:38 | What can we do instead?
| | 02:40 | Well, I'm going to turn smooth mesh
preview off by pressing the 1 key,
| | 02:45 | and I'm going to do an old school technique
here, which is the old mesh smooth node,
| | 02:52 | and that's going to be
found in the Polygons menu set.
| | 02:55 | Go to Polygons, and I'll choose Mesh,
and Smooth,
| | 03:00 | and this is going to drop
a node on top of the cloth.
| | 03:04 | And what it's done now is it's just
smoothed the cloth at one iteration.
| | 03:09 | And this is actually changing the geometry;
| | 03:11 | it's not just a render preview.
| | 03:15 | Check the performance on that;
not too bad.
| | 03:18 | With that mesh smooth enabled, I'm still
getting a frame rate of about 20 frames
| | 03:23 | per second, so that's pretty impressive.
| | 03:26 | We can play around with the mesh smooth
options. We can select the cloth,
| | 03:31 | and go into the Channel box, and
you'll see in the Inputs polySmoothFace.
| | 03:36 | Remember, in Maya everything
has to have at least two names.
| | 03:38 | There's the menu name, called mesh smooth, and the
node name, which in this case is polySmoothFace.
| | 03:43 | I want to click that to open it up to
show you that we can increase the number
| | 03:48 | of divisions if we need a smoother mesh.
| | 03:51 | Play that back, and see our
performance. Not bad.
| | 03:54 | That looks really smooth, and I'm still
getting a pretty good playback rate of
| | 03:58 | about 15 frames per second.
| | 04:00 | I'll knock that back down to Divisions of 1.
| | 04:04 | If you look really closely, you
might see that there's a couple little
| | 04:08 | glitchy areas here,
| | 04:09 | and what we can do here is we can
play around with some of the options.
| | 04:13 | We've got Keep Border; you can turn
that off, and that's going to smooth the
| | 04:19 | entire cloth, even at the edges.
| | 04:22 | Keep Border is a tricky attribute. It's
enabled by default, and what it's intended
| | 04:27 | to do is preserve the boundary edges,
so that the smooth version has the same
| | 04:34 | silhouette, or profile, or
outline as the original mesh.
| | 04:39 | But in this case, we really want to
make sure that that's off, so that we can
| | 04:43 | properly smooth the edges.
| | 04:44 | Once again, if I turn it back on again
by typing in 1, you can see that we're
| | 04:48 | getting yucky edges here.
| | 04:50 | It's even more obvious if I turn Divisions up
to 2. This really needs to be smoothed here,
| | 04:56 | and again, the answer to that is to turn
Keep Border off. Type in a 0, and there you go.
| | 05:03 | That's the workflow for smoothing an
nCloth object. If you are rendering in
| | 05:07 | mental ray, you can use smooth mesh preview.
| | 05:10 | If you rendering in any other renderer,
then you'll want to drop a mesh smooth node,
| | 05:14 | and adjust the attributes.
| | Collapse this transcript |
| Setting the initial state| 00:00 | Currently our simulation is starting
from a flag that's a perfectly flat plane
| | 00:06 | on frame 1, and we could just choose to
render from, let's say, frame 30 onward, and
| | 00:13 | give that flag a chance to actually
start blowing in the breeze, but that's not
| | 00:18 | really the best option in a lot of cases.
| | 00:21 | What we want is we want the cloth object
to be fully simulated, and in its proper
| | 00:27 | shape already on frame 1.
It's really easy to do that.
| | 00:32 | All we need to do is play the simulation
through until we get to a point that we
| | 00:38 | think looks good, and that will be the
state of the cloth object on frame 1.
| | 00:43 | So if I press Stop here now, and I'm on
frame 200 and something, I can say this is
| | 00:50 | the state I want the cloth to be in
at the first frame of the simulation.
| | 00:55 | Simply go up to the nDynamics menu set,
and with the cloth object selected, go to
| | 01:00 | the nSolver menu, and you'll see there's
a submenu here that says Initial State.
| | 01:06 | And we can do cool things in here.
| | 01:08 | Right now what we want to do is Set
From Current, and that means whatever the
| | 01:14 | current shape of the cloth object is
now, make that the shape at frame 1.
| | 01:19 | I release the mouse, and when I rewind my
timeline, I don't see any change, because
| | 01:25 | now frame 1 has adopted the shape that
was on frame 212, and when I press Play,
| | 01:32 | it's already fully in motion on frame 1.
We're not stuck to that; we can get rid
| | 01:37 | of it, or we can overwrite it if we want.
| | 01:39 | If we want to go back and start, you
know, with a neutral slate once again, we
| | 01:44 | can rewind, go to nSolver > Initial
State, and clear the initial state, and that
| | 01:50 | takes us back to whatever the shape of
the object was when we first added the
| | 01:54 | nCloth. And again, if we want it to be
different on frame 1, some different state --
| | 02:00 | maybe we like this shape better --
we'll just go back up to nSolver > Initial
| | 02:04 | State > Set From Current.
| | 02:07 | The nucleus initial state mechanism
is far superior to that of the rigid
| | 02:13 | bodies, or classic particles, in which
you can set an initial state, but you can
| | 02:17 | never remove it. But with nucleus,
that's been fixed, so that we can remove
| | 02:23 | initial states at will.
| | Collapse this transcript |
| Creating an nCache| 00:00 | We're nearly finished with this simple flag
exercise, and we're ready to render this out.
| | 00:06 | However, we can't really
render it just yet in this state;
| | 00:10 | we need to do something called
creating a cache.
| | 00:13 | A cache is a storage.
| | 00:16 | Basically what we're going to do is
we're going to store the simulation data on
| | 00:20 | disk, and that way when it's
rendered, it will be reliable.
| | 00:25 | We will get exactly the same
result each time it's rendered.
| | 00:30 | So we could use, for example, a render farm.
We could have a hundred machines each
| | 00:33 | rendering at 1 frame, and it
would come out exactly as planned.
| | 00:39 | If we don't cache the simulation, then
it's anybody's guess what's going to happen.
| | 00:44 | The simulation may run differently. It
sounds kind of counterintuitive, but in
| | 00:49 | fact, if you have the exact same scene
file on two different computers, you may
| | 00:53 | get a different result from the simulation,
| | 00:56 | even if those two computers have the
exact same specs, and that's really weird
| | 01:01 | but it is a fact. The reason for that is
that they're just so many variables; it's
| | 01:06 | so complex that it's really not possible
for it to be a 100% accurate every time.
| | 01:12 | There's another problem if you don't
cache your simulations, which is that they
| | 01:16 | will take massive time to render an
uncached simulation. The reason is that
| | 01:23 | Maya's dynamics are history dependent,
and what happens on frame 100 depends upon
| | 01:29 | what happened on frame 99, and if you
don't cache your simulation, what will
| | 01:35 | happen is that Maya will have to calculate
all of the frames leading up to the
| | 01:39 | currently rendering frame for each frame.
| | 01:43 | So if we're rendering frame 100, we're
going to have to calculate all the frames
| | 01:47 | from 1 to 99. Then when we
move on to render frame 101,
| | 01:51 | we'll after recalculate everything from
frame 1 to 100. That means that as your
| | 01:57 | batch render goes on, each frame will take longer
and longer to render until it becomes absurd.
| | 02:04 | The solution to these problems is simple:
| | 02:06 | to get reliable playback, and faster
renders, we'll just create a cache.
| | 02:11 | Before I create the cache, I want to
figure out what my time range is going to be.
| | 02:16 | Currently I've got 600 frames, and
I probably don't need all of that.
| | 02:21 | I just want to create a shot that's, let's
say, 5 seconds long, so I'll rewind, and
| | 02:25 | I'll set my end range to 120 frames
for 5 seconds at 24 frames a second.
| | 02:33 | So I have got 5 seconds worth of animation
here, and I just want to play it out,
| | 02:38 | and make sure everything is fine.
| | 02:39 | I'm not sure I'm 100% happy with the
behavior of these constraints here, but I
| | 02:43 | am going to go ahead and let it go.
| | 02:46 | I'm ready to create my cache, and I have
got the cloth object selected. I've got
| | 02:50 | my timeline set to the appropriate
range, and I'll go up to the nDynamics menu
| | 02:54 | set nCache menu, and you'll see
Create New Cache up at the top.
| | 03:00 | Let's go to the option box for that,
and what you'll see here is the Cache
| | 03:04 | directory, and Cache name.
| | 03:06 | What it's going to do is, inside your
current project, there's a data folder, and
| | 03:12 | it's going to store all the information
in that data folder, and it's going to
| | 03:17 | give it the name of the shape node.
| | 03:20 | If you want to change that up, you can,
but I'm just going to leave it right now.
| | 03:24 | You'll also see File distribution One
file per frame. What that means is we're
| | 03:29 | going to get a 120 separate files,
and that's actually what we want.
| | 03:34 | Then we got the time range, and it's just
set to the Time Slider by default. I'll go
| | 03:39 | ahead and click Create.
| | 03:41 | The simulation has to play
through once to store the cache.
| | 03:45 | Once that's done, now I can actually
scrub through the timeline, and that's
| | 03:50 | something I couldn't do before.
| | 03:52 | Before I created the cache, if I tried
to scrub through the timeline, I would get
| | 03:56 | unpredictable results, or I may even
get an error message that says nucleus
| | 04:01 | evaluation has been skipped because
you've jumped ahead too many frames. And
| | 04:07 | that's all because, once again, the
simulation is history dependent, meaning that
| | 04:12 | what happens on frame 60 depends upon
what happened on frame 59, and if we skip
| | 04:16 | around on an uncached
simulation, then it's going to break.
| | 04:21 | Now, when you've cache your simulation,
then you do want to save the scene as
| | 04:25 | well. Let's take a look at the cache.
I have already got it here. Here's my
| | 04:30 | Exercise Files, and in that project folder,
we go to data, and there's the folder for
| | 04:36 | the nCache. Drill down in there, and you
will see that we've got a file for each
| | 04:41 | frame of animation. And these are really small;
only 8 kilobytes per file. It's because my
| | 04:48 | flag only had 600 quads on it.
| | 04:51 | If your cloth object had a higher level
of detail, then of course the cache files
| | 04:56 | would be larger in size.
| | 04:57 | I want to mention also here that
nucleus is far more efficient at cache sizes
| | 05:03 | than the classic particle system in
Maya, which could end up giving you cache
| | 05:09 | sizes in the range of gigabytes,
but nCloth is really quite efficient.
| | 05:14 | We've created that cache, but we
can delete it at will if needed.
| | 05:17 | We can just select the object, go
back up to nCache, and delete it.
| | 05:22 | We could also disable it as well,
which would just temporarily turn it off
| | 05:27 | without deleting it.
| | 05:28 | You do have to delete the cache if you
want to make changes to your simulation.
| | 05:33 | If I don't delete the cache, then I try
to make changes, then those changes will
| | 05:37 | not be seen. Let's try that; Control+A. I
go to my nucleus node, and turn the Wind
| | 05:43 | off; I'll just hit Wind Speed to 0,
Enter. Rewind, and play back, and apparently
| | 05:50 | my wind is still blowing, and the
reason is that the cache is completely taken
| | 05:55 | over the simulation.
| | 05:56 | I could change any and all attributes
in the nucleus node, or in the nClothShape
| | 06:00 | node, and none of that would be seen in
the viewports, because the cache is doing
| | 06:06 | all the work. It's basically playing
back a movie of the simulation, and if we
| | 06:11 | change any of these attributes, that's
not going to change the cache, and it's not
| | 06:16 | going to change the playback in the
viewport as long as that cache is active.
| | 06:20 | If I need to make changes,
then I should delete the cache.
| | 06:23 | I'll rewind back to frame 1. I have
got currently a Wind Speed of 0. Go back
| | 06:29 | up, and delete the cache, and play the simulation,
and now we have got no wind. It's not optional.
| | 06:37 | If you're going to render your shot,
you have to cache it first, and then you
| | 06:41 | also need to remember, it's very important,
if you make changes to the simulation,
| | 06:45 | those changes will not be seen in the
viewport, or in the render as long as the
| | 06:50 | cache is still active.
| | 06:52 | If you need to make changes, you'll need
to delete the cache, make your changes,
| | 06:56 | and then rebuild the cache.
| | Collapse this transcript |
| Constraining component to component| 00:00 | To get more realism for this flag
animation, I'm going to attach the flag to a
| | 00:06 | rope, which is attached to the flagpole,
and as you can see, there is going to be a
| | 00:12 | little bit of a gap here.
| | 00:14 | It would be nice if we had some fasteners
in there, but this will be good enough
| | 00:18 | to show us how we can constrain one
piece of nCloth to another using a component
| | 00:24 | to component constraint.
| | 00:26 | So to start off, I just want to select
my flag, and disable the smoothing on it.
| | 00:32 | Earlier I added a polySmoothFace1 node,
so I'll go into the Channel box, and set
| | 00:36 | its number of Divisions down to 0;
that just basically disables the smoothing.
| | 00:43 | And while I'm working, I also want to
disable evaluation on the flag, so that I
| | 00:47 | can focus on the rope.
| | 00:49 | I'll go to the Attribute Editor, Control+A,
and in that nClothShape node, up at the
| | 00:54 | very, very top is Enable. I'll turn
that off, and as long as that's off, then
| | 01:00 | this cloth will not be evaluated.
| | 01:02 | Let's focus on the rope now.
| | 01:05 | What I've done is I've made a cylinder that
has only three sides, but has about 30 segments.
| | 01:12 | I don't need very many lines of
longitude here, but I need lots of lines of
| | 01:19 | latitude that are running parallel to
one another, so that this will have enough
| | 01:23 | level of detail to deform.
| | 01:25 | So I'll just go ahead and
create an nCloth on that.
| | 01:28 | So with that selected, I'll go to nMesh >
Create nCloth, and rewind, and play my
| | 01:34 | simulation to see what happens.
| | 01:36 | Okay, so that's good. It's falling
with gravity, as a piece of rope should.
| | 01:41 | Now I'm ready to constrain it to the pole.
| | 01:44 | I'll go ahead and select that, and
right-click, and choose Vertex component mode.
| | 01:48 | I'll select these top three rows of
vertices here, and go up to nConstraint, and
| | 01:54 | do a simple Transform
constraint, like we did before.
| | 01:57 | I want to move that transform constraint
icon up a little bit, so I can see it better.
| | 02:03 | Rewind, and play back, and see
what I get. So it looks like that's
| | 02:06 | actually constraining.
| | 02:07 | Let's finesse that a little bit.
| | 02:09 | In my Attribute Editor, I want to
select that dynamicConstrainShape node, and
| | 02:14 | what I'm looking for is, just
as before, this Strength Dropoff.
| | 02:18 | I'm going to go ahead and create
another point on that, and give that a
| | 02:21 | Linear dropoff amount.
| | 02:23 | What I need to do here is reduce the
Dropoff Distance to, let's say, only 5
| | 02:28 | centimeters. Play it back,
and see what I get.
| | 02:32 | I can increase the overall global strength.
I'll scroll back up here, and you'll
| | 02:36 | see Strength up here.
| | 02:37 | I'm going to set that way up to
100 to make sure that constraint is strong
| | 02:42 | enough. And if it's still not strong
enough, we can play around a little bit with
| | 02:47 | some of these other attributes, like
the Dropoff Distance; maybe I'll increase
| | 02:50 | that to 10. There we go.
| | 02:53 | So that's stuck on there pretty well.
| | 02:54 | I want to repeat that process for the
bottom of the rope, so I'll go back down
| | 02:58 | here, select it, right-click, go into
Vertex component mode, select those bottom
| | 03:04 | three rows, and once again, make an
nConstraint transform, and just move it down,
| | 03:11 | and once again, tweak the Strength
Dropoff curve, change the Distance to maybe
| | 03:17 | lke 5, or let's say 10 centimeters.
| | 03:20 | Play it back, and see what's happened.
| | 03:22 | So that appears to be
actually constrained pretty well.
| | 03:25 | But you can see that my
rope is really stretchy.
| | 03:29 | So I'll select that rope, and I'll
try a Preset first of all. Let's go for
| | 03:35 | standard tshirt preset, Replace
that, and play it, and see what happens.
| | 03:39 | It's still really stretchy.
| | 03:41 | I want to go back down into those
Dynamic Properties, and crank up the Stretch
| | 03:46 | Resistance, and I'm going to turn it
all the way up to, like, a 1000. That's a
| | 03:52 | really high value, but I think I
need a really high value in this case.
| | 03:56 | That's behaving more like
a real piece of rope.
| | 03:59 | So I'll rewind that.
| | 04:01 | Now I'm ready to constrain the flag to
the rope, and what I need to do here is I
| | 04:06 | need to select vertices
on both of the objects.
| | 04:09 | I'll select the flag, right-click, and
go to Vertex mode, and select a range of
| | 04:13 | vertices here, and then I want to go
over to the rope, and right-click on that,
| | 04:19 | and choose Vertex mode, and hold down
the Shift key, and select another three
| | 04:24 | rows of vertices here.
| | 04:27 | So I've made my two selections, and
I'll go ahead and add the nConstraint.
| | 04:31 | nConstraint > Component to Component, and
activate that. And you'll see I don't have
| | 04:38 | any little locator icon or
anything to indicate that.
| | 04:40 | I'll rewind, and play it back, and I don't
see anything now, but that's because my
| | 04:45 | flag is currently turned off.
| | 04:47 | I want to go back into its shape
node, nClothShape node, and reenable
| | 04:53 | evaluation, and play that back.
| | 04:55 | And now we're seeing the constraint.
| | 04:58 | That's pretty good.
| | 04:59 | We need to repeat that
process at the bottom.
| | 05:03 | Right-click and go into Vertex component
mode, select some vertices, right-click
| | 05:07 | on the flag, and go to Vertex component
mode. Hold down Shift, and select
| | 05:12 | these three rows of vertices here, and once
again, add nConstraint > Component to Component.
| | 05:20 | Press Play, and see what I get.
| | 05:23 | I'm pretty happy with that.
| | 05:24 | Now, I want to let you know that it took
me a long time to get the right settings,
| | 05:28 | and tweak this out to make it work, and
you will see that in your own scenes,
| | 05:33 | you'll need to spend massive amounts
of time tweaking things, and getting the
| | 05:38 | exact perfect storm of attribute values
and selections in order to get the
| | 05:43 | result that you want.
| | 05:45 | Here's an example of the kind of problems
that you'll need to solve with nCloth,
| | 05:50 | and you'll need to spend some time, and
some creative thought process to try to
| | 05:55 | find the problem, and fix it.
| | 05:57 | You can see here that my rope is
stretching in really kind of strange ways.
| | 06:02 | Of course, we can play around with
some of these Dynamic Properties.
| | 06:06 | Stretch Resistance is 1000.
| | 06:07 | I'm going to turn the Compression
Resistance up to a 1000 as well, and I'll set
| | 06:13 | Band Resistance to just a value of 1.
| | 06:16 | Rewind that, and play that back, and
you would think that that would be good
| | 06:20 | enough to solve it, but as we can
see, clearly it's not good enough.
| | 06:23 | Rewind that, and what I found through
playing around for quite a long time was,
| | 06:29 | it turns out it was the Mass. Set
that to a value of 2, and then press Play.
| | 06:35 | And once the simulation settles down there,
we're getting a much better result there.
| | 06:39 | And it's probably okay.
| | 06:41 | When we smooth this, and we see it from
a little bit of a distance, no one would
| | 06:46 | know that there was any issue at all.
| | 06:48 | And that concludes our
chapter on directing nCloth.
| | Collapse this transcript |
|
|
4. Optimizing PerformanceDuplicating nCloth| 00:00 | In this chapter, we're going to look at
optimizing performance in various ways.
| | 00:05 | The first thing I want to show you
is how to duplicate nCloth systems.
| | 00:09 | If you spend a lot of time making
something work, then you just want to
| | 00:13 | duplicate that instead of
recreating it, and redoing all that work.
| | 00:18 | Duplication is not really a straightforward
process here, so we have to kind of
| | 00:22 | figure out how it works.
| | 00:23 | If your remember back to much earlier
in the course, I made a backup of this
| | 00:27 | mesh object before I turned it into a
cloth, and it's here on the backupLayer;
| | 00:32 | just make that visible.
| | 00:34 | So that's my original mesh shape
before any cloth was applied to it.
| | 00:40 | This is just a backup. It's a safety.
| | 00:42 | In case I get in trouble, I can
always go back to this mesh object.
| | 00:45 | I am going to re-hide that.
| | 00:47 | So to make a duplicate of an nCloth,
you can't just use the standard, ordinary,
| | 00:52 | plain old Duplicate command.
| | 00:54 | So if I just go to Edit > Duplicate, or
hit Control+D, then essentially what I'll be
| | 00:59 | making is a snapshot, and it won't be dynamic.
| | 01:03 | So when I press Play,
you'll see that's not moving.
| | 01:05 | And if I look at the attributes for
that, Control+A, you'll see that it's just a
| | 01:10 | mesh; it doesn't have any connections
to an nClothShape, or a nucleus node.
| | 01:15 | You'll also notice that, confusingly,
there are actually two mesh shape nodes here.
| | 01:20 | That's the underlying
structure of an nCloth object.
| | 01:23 | It's actually got to have the original
mesh, and the output mesh, which is after
| | 01:28 | all the dynamic simulations have been applied.
| | 01:31 | And it's just a weird quirk of the
Maya software that when I make a duplicate
| | 01:36 | of an active nCloth object, the new
duplicate is going to have two shape nodes as well.
| | 01:43 | Even though we don't need two shape
nodes, we get an extra one for free.
| | 01:47 | Again, don't let that confuse you;
| | 01:48 | if you make a duplicate of an nCloth
object, you actually can't get rid of
| | 01:52 | this extra shape node.
| | 01:54 | So I'm going to delete that,
because that wasn't what I wanted.
| | 01:57 | I want to make a duplicate that is dynamic.
| | 02:00 | Additionally, I want to make sure that
I select not just the flag, but anything
| | 02:04 | that's connected to it.
| | 02:05 | I've got some transform constraints here too.
| | 02:08 | I need to select those as well in
order for this to really work properly.
| | 02:12 | And while I'm at it, I might as well select
my passive collider, which is the flag pole.
| | 02:16 | I'll just select all four of those objects.
| | 02:19 | And instead of standard, plain vanilla
Duplicate, I want to do Duplicate Special,
| | 02:24 | which is under Edit > Duplicate Special,
and we have to go into the Options.
| | 02:30 | Now I'm going to reset the options to show
you what they would look like with no change.
| | 02:34 | This is the default, and if we use the
default in this dialogue, then it will act
| | 02:40 | just like an ordinary, plain Duplicate command.
| | 02:43 | What we need here is to not just make
a snapshot, but to make a dynamic copy.
| | 02:49 | We need to toggle on this switch
here that says Duplicate input graph.
| | 02:54 | Now, what does this mean? The differences
between Duplicate input graph, and
| | 02:58 | Duplicate input connections?
| | 03:01 | The difference is whether you've got a
shared history or not; whether all the
| | 03:05 | input nodes are shared between
the duplicate, and the original.
| | 03:10 | If I chose Duplicate input connections,
I would have a shared history. The two
| | 03:15 | shape nodes would have the same
construction history. They would have all the
| | 03:19 | same input nodes, basically
making a branching structure.
| | 03:23 | What I want here is a completely new history.
| | 03:27 | That way, I can have two completely
different flags that behave differently, so
| | 03:32 | Duplicate input graph.
| | 03:33 | I'll go ahead and click Duplicate Special.
| | 03:36 | When you do this, if you're not parked
on frame 1, you might see some strange
| | 03:40 | result, like I'm seeing here.
| | 03:42 | I do want to make sure I
rewind back to frame 1.
| | 03:45 | The duplicates are currently selected,
so I can go ahead and just move that over.
| | 03:49 | And I'll press Play, and you'll see at
first that they look the same, but they're
| | 03:55 | actually not the same, and if we let
this play long enough, we'll start to see
| | 03:59 | that they kind of deviate.
| | 04:01 | If we wanted to shortcut this process,
what we could do is we could just disable
| | 04:05 | Solver evaluation for one of those,
and play it for a few frames, and then
| | 04:10 | re-enable Solver evaluation, and then
we would have two different flags.
| | 04:14 | I'll go ahead and hit Control+A, and I
want to select just that flag, and just
| | 04:20 | toggle the Enable state off for a
second, and then just play this through for a
| | 04:26 | few frames until we are sure that these two are
not matching any longer, then I can reenable that.
| | 04:33 | And then when I play this back, you
can see that we're not getting the exact
| | 04:37 | same result on these two.
| | 04:39 | And of course, since they are two
independent objects, they could have different
| | 04:42 | materials, and they could have different
properties; I could play around, and make
| | 04:46 | one of them lighter, or whatever.
| | 04:48 | All I really want to do here, just for
clarity's sake, is just to assign a new material.
| | 04:53 | Just really quickly, I'm going to do
Assign New Material, and make that a Lambert
| | 04:57 | material, and I'll rename this, and
I'll call this one flag2Lambert.
| | 05:03 | In the Color channel, I'll click Create
Render Node, and create a new File node,
| | 05:08 | and then browse, and I've got flag2_cmy.
| | 05:14 | Now I've got two completely different
flags, and they started off having the same
| | 05:18 | properties, but the
simulation is going to be different.
| | 05:21 | So that's the process of duplication for nCloth.
| | Collapse this transcript |
| Assigning Nucleus solvers| 00:00 | Sometimes, when building dynamic
simulations, we'll want to have more than
| | 00:05 | one nucleus solver.
| | 00:07 | For example, let's say we wanted one
of these flags to be blowing in the wind,
| | 00:10 | and the other one standing still.
| | 00:13 | The way to accomplish that would be
to have two separate nucleus solvers.
| | 00:17 | When I duplicated the flag in the last
movie, I actually duplicated the nucleus
| | 00:22 | solver in the process, and so it's
actually set up now for two different nuclei.
| | 00:29 | If I select this flag, and hit Control+A,
you'll see it's connected to nucleus1.
| | 00:34 | If I select the other flag,
you'll see it's connected to nucleus2.
| | 00:39 | So in fact, this is already set up.
| | 00:40 | I could turn the Wind Speed down to 0
for nucleus2, and then rewind, and play my
| | 00:46 | simulation, and you'll see that we
only have wind on one of the flags.
| | 00:50 | That's pretty helpful.
| | 00:53 | If you wanted to use just one nucleus
solver for both of those objects, what you
| | 00:58 | would do is you would select the object,
and go up to the nSolver menu > Assign
| | 01:03 | Solver, and then choose the Solver,
and now both of those are connected to
| | 01:09 | nucleus1. So you can see I have
selected that, and we see nucleus1 here;
| | 01:14 | select the other flag, and again, it's
nucleus1. Rewind, and play back, and we are
| | 01:19 | back to they're both
sharing the same wind settings.
| | 01:22 | I got my second nucleus node for
free when I duplicated special.
| | 01:27 | If you want to create a new nucleus
node from scratch, what you would do is
| | 01:32 | you would select your object, and then
go up to nSolver > Assign Solver, and New,
| | 01:39 | and it would create another nucleus
node, and connect the selected object to
| | 01:43 | the new nucleus node.
| | 01:45 | I'm not going to bother doing that now,
because we've basically illustrated our point here.
| | 01:49 | So that's how you can work
with more than one nucleus solver.
| | 01:53 | This can sometimes help you, not
just for special effects, but also for
| | 01:57 | fine-tuning. Maybe the two objects
need to have completely different nucleus
| | 02:02 | Solver settings; maybe we need to go in
here and have different settings for the
| | 02:07 | Substeps and Collusion Iterations.
| | 02:09 | Creating two different nuclear
solvers is the way to accomplish that.
| | Collapse this transcript |
| Using collision layers| 00:00 | As you start adding more and more nCloth
elements in your scene, the performance
| | 00:05 | will start to degrade pretty quickly,
and you'll need to take some special steps
| | 00:09 | to improve the performance.
| | 00:12 | Here I've got six flags, and they're all
sharing the same nucleus node, and they
| | 00:17 | all have the same settings
to their nClothShape nodes.
| | 00:21 | And when I play, you will see that we're
getting approximately 10 frames per second.
| | 00:25 | But we can improve this, and we can
get closer to real-time playback by using
| | 00:30 | something called collision layers.
| | 00:32 | We can set it up so that certain
objects are not allowed to collide with other
| | 00:36 | objects, and that would help with
performance, because it would reduce
| | 00:40 | unnecessary calculations.
| | 00:41 | For example, none of the flags are ever
going to touch one another, so it'd be
| | 00:46 | a smart thing to disable the ability
for the flags to collide with one another.
| | 00:52 | Likewise, each flag will only ever be
able to collide with it's own flagpole, so
| | 00:57 | we can make it so that this flag won't
collide with any of the other flagpoles.
| | 01:01 | This is done using collision layers.
| | 01:04 | If I select any nucleus object, and hit
Control+A to open up the Attribute Editor, I
| | 01:09 | can go to the nucleus node, and you'll
see in the Solver Attributes section,
| | 01:14 | there's something called
Collision Layer Range.
| | 01:17 | And this value determines which collision
layers are allowed to collide with
| | 01:21 | one another. The collision layers are set
on a per nCloth, or a passive collider basis.
| | 01:29 | In other words, if I go to the nClothShape
node, there is a Collision Layer field
| | 01:33 | here, and there is also one for the
nRigid shape, or the passive collider,
| | 01:38 | Collision Layer here.
| | 01:40 | Now, at first you might think that if
you just simply put these two objects on
| | 01:44 | the same Collision Layer, and these two
objects on a different Collision Layer,
| | 01:49 | that would be sufficient to
prevent them from colliding.
| | 01:52 | Unfortunately, in Maya, a lot of
times things just aren't that simple.
| | 01:57 | We need to not only set Collision
Layer values for each object, but we also
| | 02:02 | have to set, in the nucleus node,
this Collision Layer Range value.
| | 02:07 | This gets a little bit weird, because you
would think that if I set the Collision
| | 02:11 | Layer Range down to 1, that would mean
that something on Collision Layer 0 would
| | 02:18 | not be allowed to collide with something
on Collision Layer 1, but in fact,
| | 02:23 | that's not the case.
| | 02:24 | In order to prevent two things from
colliding, their Collision Layer difference
| | 02:29 | must be greater than this
Collision Layer Range value.
| | 02:34 | If the value is 1, then the two collision
layers have to have a difference of greater than 1.
| | 02:42 | So that's the trick to this.
| | 02:45 | I've got Collision Layer 0; I'll just
leave that as the default for these two
| | 02:49 | objects. And then the next one down, I
had to set the Collision Layer to a value
| | 02:56 | that is greater than the Collision Layer Range.
| | 02:59 | If I just set this to a value of 1, this
flag would still collide with his flagpole.
| | 03:06 | This has to be set to the value of at least 2.
| | 03:10 | I'm going to go down the line,
and I'm going to change these all.
| | 03:13 | These two will have a Collision Layer
of 2. The next two will have to have a
| | 03:18 | Collision Layer of 4.
| | 03:20 | Go ahead and set those, and the next
pair has a Collision Layer of 6. So
| | 03:27 | each one of these has a Collision Layer
that is a value that is two greater than
| | 03:33 | the previous Collision Layer.
| | 03:37 | That's all been done.
| | 03:38 | Now I'll go back to my nucleus node.
| | 03:40 | Now let me set the Collision Layer
Range up to the default value of 4, and play
| | 03:45 | that back, and see what we get.
| | 03:47 | We're getting a little bit
of a performance improvement.
| | 03:50 | Remember that before we changed the
collision layers, we had a playback speed of
| | 03:54 | about 10 frames per second,
and now we are getting about 11.
| | 03:57 | What I want to do here is reduce the
Collision Layer Range down to 1.
| | 04:02 | Rewind, and play that back.
| | 04:05 | And now I'm getting a playback speed of
more in the range of 16 frames a second.
| | 04:10 | That's a pretty substantial improvement;
going from 10 frames per second to 16
| | 04:15 | frames per second is significant, and
that could make all the difference in
| | 04:19 | interactivity in a scene.
| | 04:21 | The faster the playback is, the
better you're able to evaluate, and make
| | 04:26 | changes to your simulation.
| | 04:28 | Now, if I set the Collision Layer
Range up to a value of, let's say, 20, then
| | 04:32 | that's essentially disabling all of the
benefits, because now any Collision Layer
| | 04:38 | that is less than 20 from another
Collision Layer will be allowed to collide.
| | 04:45 | Play that back and now I'm down
to 10 frames a second once again.
| | 04:50 | This is my advice is set the Collision
Layer Range to a value of 1, and then
| | 04:56 | make sure that each Collision Layer is
2 greater than the previous Collision
| | 05:01 | Layer, and that will ensure
that none of those are colliding.
| | Collapse this transcript |
| Optimizing nCloth quality settings| 00:00 | Let's take a look at the
nClothShape node quality settings.
| | 00:05 | Previously, we looked a little bit at
the Nucleus global solver attributes,
| | 00:10 | and these settings have to do with how
many calculations are made per frame, and
| | 00:16 | how many times vertices are tested for
collisions, and higher numbers will give
| | 00:21 | you allegedly better results,
but will take longer to calculate.
| | 00:26 | If I play this back, you'll see we're
getting about 17 frames a second currently.
| | 00:32 | But in this version of the flag,
I've made the Stretch and Compression
| | 00:35 | Resistance lower, so that we see some unfortunate
stretching there. We want to get rid of that.
| | 00:41 | I will go to the shape node, and I
want to find the Stretch Resistance, and
| | 00:47 | Compression Resistance, and I want to
crank that up to a pretty high value of 500.
| | 00:52 | The slider only goes up to 200, but I'm
going to crank it up even further, and
| | 00:57 | play that back, and see now
I've got a pretty solid cloth.
| | 01:01 | It's not stretching, or doing anything
strange, but my frame rate has gone down
| | 01:06 | to 10 frames a second.
| | 01:09 | What's happening here is that as we
increase these Dynamic property values to
| | 01:14 | higher and higher numbers, then more
and more calculations must be made.
| | 01:19 | Well, what we can do is we can set an
upper limit on that, so that it won't take
| | 01:24 | as long to calculate, and we will have
faster performance in the viewports.
| | 01:28 | And this can be set on a per object
basis inside that shape node, once again.
| | 01:34 | Scroll down, and you'll find there's
a section that says Quality Settings.
| | 01:39 | And the important attribute currently
here is Max Iterations; that's the maximum
| | 01:45 | number of the times these
Dynamic Properties will be calculated.
| | 01:49 | And the default value is 10,000, which
essentially really means there's no limit
| | 01:53 | to the number of calculations.
| | 01:55 | You won't reach 10,000
iterations very easily;
| | 01:58 | you'd have to crank up all those
values very high to get to that point.
| | 02:03 | So again, with the Max Iterations at
10,000, I'm getting about 10 frames per
| | 02:07 | second in my viewport.
| | 02:10 | I can reduce this down. Let's try a
really low value, like 10, and then we'll
| | 02:16 | rewind, and press Play,
and see what we get.
| | 02:19 | And what we're seeing here is better
performance; we've got now about 15 frames
| | 02:23 | per second, but now it's
getting stretchy. Now why is that?
| | 02:27 | It's because we've set the iterations so
low that the Dynamic Properties are not
| | 02:32 | being fully calculated.
| | 02:34 | We're not able to get a stretch resistance
of 500, because we've kind of limited
| | 02:40 | that ability by knocking the
Max Iterations down so low.
| | 02:43 | What we need to do is just find the
right value that's going to give us
| | 02:48 | a performance benefit, but is not going to
negatively impact the look of our simulation.
| | 02:52 | And I toyed around with this a little
bit earlier, and settled on a value of
| | 02:56 | about 50 seemed to give me
the sweet spot in this case.
| | 03:01 | But again, it's going to be
different for every scene.
| | 03:04 | So now I've got a Stretch and Compression
Resistance of 500, and I'm not seeing
| | 03:09 | any stretching, and I've now got a
frame rate of 13, which is a good compromise.
| | 03:15 | You can set this for every object in
your scene differently if necessary.
| | 03:20 | That's one way to tweak the quality,
and to get better performance in your
| | 03:23 | viewports for nClothShape nodes.
| | Collapse this transcript |
| Displaying nodes in the Attribute Editor| 00:00 | By default, a lot of the nodes that
you would normally expect to see in the
| | 00:04 | Attribute Editor are hidden for nCloth
objects, and that's just to streamline the
| | 00:10 | display, and to hide anything that is
less essential, to make room for more
| | 00:15 | important things, like the nucleus node.
| | 00:18 | If I select the nCloth object, and hit
Control+A to open the Attribute Editor,
| | 00:22 | you'll see that indeed I've got access
to the nucleus node, the shape node, and a
| | 00:27 | couple other nodes, but I don't see
my material nodes, and I don't see the
| | 00:32 | constraint node, for example, that I
know is actually connected to this object.
| | 00:37 | We can make those nodes visible in
the Attribute Editor very easily.
| | 00:41 | We'll just go up to the nSolver menu,
and you'll see there's an entry here that
| | 00:46 | says AE Display; that's Attribute Editor
Display. And we can just enable the node
| | 00:52 | types that we want to see.
| | 00:54 | I'll turn on Material Nodes, and now I've
got my Lambert shader, or Lambert material.
| | 01:00 | Likewise, I can go back up into nSolver >
AE Display, and enable dynamicConstraint
| | 01:05 | Nodes, and now the dynamic constraints
that are attached to this object are going
| | 01:11 | to be easily accessible in the Attribute Editor.
| | 01:14 | Just a simple thing that
will streamline your workflow.
| | Collapse this transcript |
| Displaying the input or output mesh| 00:00 | Let's go a bit deeper
into the structure of nCloth.
| | 00:04 | nCloth is made out of two meshes, in
fac; the input mesh, and the output mesh.
| | 00:10 | When you create an nCloth object,
you'll only see the output mesh; you'll
| | 00:14 | see the end result of this simulation. That's
what we have here with this simple tablecloth.
| | 00:19 | We can display the input mesh, which
is the original object; the original
| | 00:23 | polygon mesh before the simulation.
And to some extent, we can make limited
| | 00:28 | changes to that object.
| | 00:30 | I am going to go ahead
and display the input mesh.
| | 00:33 | I'll select my nCloth object, and go
to the nMesh menu, and choose Display
| | 00:38 | Input Mesh, and it changes color there,
because I actually had two different
| | 00:43 | materials assigned.
| | 00:44 | So now we can make some changes, in fact,
to this input mesh, with some limitations.
| | 00:50 | Certain tools won't work; for example,
the Interactive Split tool doesn't work.
| | 00:55 | But I am going to use the Cut tool, and
we'll just chop off pieces of this tablecloth.
| | 01:00 | I am going to go into the Polygons
menu set, and I'll need to select some
| | 01:04 | faces. Go into Face component mode,
select all those, and I'll go up to Edit
| | 01:12 | Mesh > Cut Faces Tool.
| | 01:14 | I am going to do something a little
bit clever by going into the Options, and
| | 01:18 | enabling Delete cut faces.
| | 01:20 | And then when I drag across here,
you'll see I have not only the ordinary cut
| | 01:25 | line, which is the solid line, but also
that dashed line, and that indicates which
| | 01:30 | side of the object is going to get cut off.
| | 01:33 | So I want to actually spin this
around, so that it's pointing the other way.
| | 01:37 | And when I release the mouse, that object
is cut, and all those extra faces are deleted.
| | 01:43 | So if I want to do it again, then I
would want to go right-click, and go back
| | 01:47 | into Face mode, and select the faces, and
reinitiate that Cut command; it's still
| | 01:53 | here in my Most Recent tool. Click on
that, click and drag, set the orientation
| | 02:00 | of that dashed line, release the
mouse, and all of that gets deleted.
| | 02:05 | And then go back to Object mode,
select that object, and go back to the
| | 02:12 | nDynamics menu set, and nMesh, and I'll go
back to displaying the output, which is
| | 02:17 | called Display Current Mesh. Rewind, and
play my simulation, and then now I've got
| | 02:23 | a tablecloth that's been cut up.
| | 02:24 | However, it won't work in all situations.
| | 02:27 | If you've got constraints applied, then
this isn't going to work, or if you've
| | 02:32 | made any kind of vertex selection on that
nCloth object, then it's not going to work.
| | 02:37 | Let me show you by going to a
different scene file of the flag.
| | 02:41 | I am going to go to
File > Open Scene, and I've got
| | 02:45 | displayingInputOrOutputMesh_flag.
Open that up.
| | 02:49 | I am not going to bother saving this.
And I can still display the input and
| | 02:53 | output mesh, just as before, but I am
going to have problems if I make any
| | 02:58 | changes, because I've selected by vertex
here to apply that transform constraint.
| | 03:04 | I'll go up to nMesh, and Display Input Mesh,
and now here's our original plane.
| | 03:10 | And I could go into Face mode, for
example, and delete some faces, cut a hole in
| | 03:15 | my flag; just press Delete. And it seems
okay, until I go back into Object mode,
| | 03:22 | reselect it, and then attempt to display
the current mesh once again. And notice
| | 03:28 | as soon as I did that, the points on
my constraint have all moved around.
| | 03:32 | So these little purple dots here; those
represent the points that were selected
| | 03:36 | for the constraint, and when I
press Play, it's a disaster.
| | 03:41 | Basically, you can't make topology
modifications on input meshes that have
| | 03:46 | constraints applied.
| | 03:48 | You can't change the number of points
on the object, because the constraint is
| | 03:53 | applied by vertex ID. Every polygon
object in Maya has vertices that are
| | 03:59 | uniquely identified by number,
| | 04:02 | and when you change the number of vertices
on a mesh, then all of the vertex ID
| | 04:07 | numbers get shifted around, and that's
why the constraints no longer applied in
| | 04:11 | the same physical location, because
what was vertex number 2 over here, is now
| | 04:17 | vertex number 2 over there.
| | 04:19 | For very simple situations, you can
make changes to the input mesh, but if
| | 04:25 | you've got constraints, or any kind of
fancy stuff applied, then you can't change
| | 04:29 | the topology of the input mesh.
| | Collapse this transcript |
| Working with construction history| 00:00 | Occasionally, you may have a need to
adjust the construction history of an
| | 00:05 | nCloth object; for example, to
increase the level of detail.
| | 00:10 | Here is an example.
| | 00:11 | I've got a tablecloth here that just doesn't
have enough detail to really be convincing.
| | 00:15 | Now, I did not delete the construction
history when I created that plane. I just
| | 00:21 | built the plane, set the number of
vertices that I want by setting the number of
| | 00:25 | segments, and then made an
nCloth out of it, and it worked.
| | 00:30 | But now I've decided that I don't have enough
detail, and I need to go back and increase that.
| | 00:35 | Normally, what you would do is, of
course, you would just select the object, and
| | 00:38 | then drill down into the Channel box,
or the Attribute Editor to find the
| | 00:42 | primitive node; in this case,
it's a polyPlane primitive.
| | 00:46 | Well, once it's been converted to nCloth,
you can't get access to that very easily.
| | 00:51 | If I hit Control+A to open the Attribute
Editor, you will see that I have got lots
| | 00:56 | of stuff here. I have got my nucleus
node, and I can even see the material node,
| | 01:00 | because I've made that visible, but I
can't get access to the polyPlane node
| | 01:05 | that I know is here.
| | 01:06 | Well, here's how you can get access to that.
| | 01:10 | You'll want to select the
object, and display its input mesh.
| | 01:13 | I am going to go into nMesh > Display
Input Mesh, and having done that, now this is
| | 01:19 | no longer dynamic. This is the original
polyPlane, but strangely, and weirdly the
| | 01:25 | polyPlane primitive node that I know
exists is not showing up in the Channel
| | 01:30 | box, and again, it's not showing
up in the Attribute Editor either.
| | 01:33 | Now, this is to try to protect us, so that
we don't actually mess up our simulations.
| | 01:39 | Similarly to what we saw in the last
exercise, if I change the level of detail
| | 01:43 | on an nCloth object that had vertex
level selections, that would cause the
| | 01:48 | simulation to break, because all the
vertices would shift around on the model, and
| | 01:53 | different areas would be selected.
| | 01:56 | So that's why the input nodes are
hidden by default, is because in most cases,
| | 02:00 | you really shouldn't be
changing the input nodes.
| | 02:03 | But here, because it's such a simple
object, there's no reason why I can't do that.
| | 02:08 | It's not constrained to
anything, and it's just a polygon plane.
| | 02:12 | So how do we get access
to that polyPlane node?
| | 02:15 | We need to display the input mesh, and
then also go into either the Hypergraph, or
| | 02:21 | even better, the new fancy Node
Editor, which exists in Maya 2013.
| | 02:25 | I have got my object selected. Go to the
Window menu, and I can choose Hypergraph:
| | 02:31 | Connections, which is the old school
method, or the Node Editor; let's open that up.
| | 02:37 | The Node Editor is a little bit fancier
version of the Hypergraph that makes it
| | 02:41 | easier to make connections, and
easier to see what you're working with.
| | 02:45 | In order to now display the graph of
the currently selected object, which is
| | 02:50 | a tablecloth, I'll need to click
this button here: display the Input and
| | 02:54 | output connections.
| | 02:55 | Once I've done that, I can see now the
scene graph for that object, and here it
| | 02:59 | is: the polyPlane node. The
one that's been hidden from us.
| | 03:03 | I can select that, and now I've got
access either through the Channel box, or
| | 03:07 | the Attribute Editor.
| | 03:09 | I can change the number of divisions now;
| | 03:11 | let's try 50, and 50.
| | 03:14 | Now I have got a lot more detail on that.
| | 03:16 | I'll select the object, go back to
the nMesh menu, and Display Current Mesh.
| | 03:22 | Rewind, and play back, and there you
go; I have got a much better mesh.
| | 03:27 | Now, there are some quality issues here
that I haven't resolved, but you see the
| | 03:31 | principle here, which is I do
actually have the ability to change the
| | 03:35 | construction history on an
nCloth object, if that history exists.
| | 03:40 | I just have to display the input mesh, and
then open up the Node Editor, or the Hypergraph.
| | 03:46 | One more thing that's kind of
important is the ability to delete the
| | 03:49 | construction history for
performance reasons.
| | 03:52 | Let's say you have done a lot of edits
to a polygon object, and it's got a long
| | 03:56 | history, with lots of cut commands, and
extrude commands, and all kinds of stuff
| | 04:00 | in there, and then you forget to delete the
construction history, and then add an nCloth to it.
| | 04:06 | You are going to have slower performance,
and you'll want to delete the construction
| | 04:10 | history before you apply the nCloth.
| | 04:12 | Well, if you forget to do that, it's
not a problem, because you can delete the
| | 04:16 | construction history after the fact if needed.
| | 04:19 | Currently, I've got a polyPlane node
in there that I want to get rid of.
| | 04:22 | Well, if I use the standard delete
construction hmethod, then that's
| | 04:27 | going to delete my nCloth as well.
| | 04:29 | If I go to Edit > Delete by Type > History,
that doesn't delete the polyPlane node
| | 04:36 | alone; it deletes all of the
input nodes, including the nCloth.
| | 04:40 | So when I press Play, I don't
have a dynamic simulation anymore.
| | 04:44 | Ironically, it's still running slow.
| | 04:47 | I am going to undo that couple of times,
Undo "DeleteHistory", and now I'm back
| | 04:52 | to the dynamic version.
| | 04:54 | If I want to delete the construction
history prior to the application of the
| | 05:00 | nCloth, then there's a command for
that here in nMesh > Delete History, and then
| | 05:06 | play that back, and it's fine.
| | 05:09 | So now there's no longer any polyPlane
node, and I am just left with a raw
| | 05:15 | mesh on my input. And if I go back to
the input mesh, and go back to the Node
| | 05:20 | Editor, and click on display input and output,
there is no longer a polyPlane node there.
| | 05:27 | I have successfully deleted my
construction history after having created
| | 05:31 | an nCloth node.
| | Collapse this transcript |
| Extruding nCloth| 00:00 | nCloth is designed to work
with two-dimensional surfaces.
| | 00:04 | You can use nCloth on a surface that
has some thickness, but it's kind of hard
| | 00:10 | to control sometimes, and what you'll
have happen a lot is that the thickness
| | 00:15 | will not be maintained, and it will
actually sort of collapse on itself.
| | 00:19 | And that's problematic, because
obviously in the real-world, cloth has some
| | 00:24 | thickness, and especially in a close-up
shot, it's not very believable if the
| | 00:27 | cloth is infinitely thin.
| | 00:30 | But we need to calculate the
simulation based upon an infinitely thin
| | 00:34 | two-dimensional surface.
| | 00:36 | And to get the thickness that we
want, we can just extrude the mesh.
| | 00:41 | I'll rewind my simulation back
to frame 1, and select that mesh.
| | 00:45 | We're currently seeing the output of
the simulation; not the input mesh.
| | 00:50 | We want the extrude node to be applied
after the simulation, and that way,
| | 00:56 | we won't add more detail to the input mesh,
which is then feeding into the simulation.
| | 01:02 | In other words, if we extruded it before
the nCloth node, then it would sort of
| | 01:08 | collapse in on itself, and
it would also be much slower.
| | 01:11 | What we want is to apply the
extrude after the simulation.
| | 01:15 | I've got my object selected.
| | 01:17 | I'll just go to Polygons menu
set, and go to Edit Mesh > Extrude.
| | 01:22 | And as always, with the extrude node,
you have to give it some non-zero
| | 01:26 | thickness; you have to remember to
increase the thickness some amount.
| | 01:30 | If you just leave it alone, and don't
increase the thickness, you'll have an
| | 01:34 | extrude of zero, and that will be an
illegal object, which will have two
| | 01:39 | coincident planer surfaces that are
sitting right on top of each other.
| | 01:43 | Currently, it's got a
value of about 1 centimeter.
| | 01:45 | I'll go back to Object mode, and select, play back;
there you go. We have got thick cloth.
| | 01:54 | If we want to change the thickness, we
can just go into that extrude node. I'll
| | 01:59 | get in real close, so we can see that,
and you will see polyExtrudeFace, and
| | 02:03 | that's happening after the nCloth shape.
| | 02:05 | Remember that the Channel box displays
nodes from bottom to top. That means this
| | 02:12 | polyExtrudeFace is stacked
on top of the ClothShape node.
| | 02:16 | We can open that up, and maybe
reduce the Local Translate Z, which is the
| | 02:21 | thickness. Maybe I'll set that to .5.
| | 02:25 | Notice that I extruded my
cloth upward, and not downward.
| | 02:29 | If I had a Local Translate that was
a negative value, then we would get
| | 02:33 | interpenetrations with that
collision object underneath.
| | 02:37 | We can't see that now, but in
some cases, it could be problematic.
| | 02:40 | I am going to reset that back to 0.5.
| | 02:44 | Additionally, there's nothing to stop
us from smoothing this as well after
| | 02:48 | it's been extruded.
| | 02:49 | We can just go ahead and select that
mesh, go into the Polygons Mesh menu, and
| | 02:54 | drop a Smooth node on it, and that
looks pretty good. I have got a pretty
| | 02:59 | convincing tablecloth now,
with some thickness.
| | 03:02 | Later in the course, we'll see how
you can create a separate object that
| | 03:06 | has thickness, and then use a
wrap deformer to connect that to a
| | 03:11 | two-dimensional nCloth surface.
| | Collapse this transcript |
| Increasing efficiency with proxy collision objects| 00:00 | A simple way to improve performance
is to use proxyCollisionObjects.
| | 00:05 | Using a high detail mesh as a collision
object is unnecessary, because it's just
| | 00:10 | going to bog down the system, and
your simulations will run more slowly.
| | 00:15 | Currently, what I've done here is
I've got a dining table that's a high
| | 00:20 | detail mesh, and I've also made a proxy
version that's just made out of simple primitives.
| | 00:25 | This one here; let's check its
Polygon Count. Display > Heads Up
| | 00:29 | Display > Poly Count.
| | 00:31 | It's 30,000 triangles,
so that's kind of heavy.
| | 00:35 | Turn that back off again; Display >
Heads Up Display > Poly Count. And I have
| | 00:39 | put that on a layer.
| | 00:41 | Let me just hide that layer, and show you I
created a very similar version that's
| | 00:46 | just super low polygon, and that's just
there for collisions only; it won't be
| | 00:51 | in the rendered movie.
| | 00:53 | So let's see what the
performance gain will be.
| | 00:56 | Here is my cloth. I am going to go
ahead and make that into an nCloth.
| | 01:00 | nMesh > Create nCloth. Select it, and go
into the Attribute Editor, and for the
| | 01:06 | shape node, I want to choose the Preset
tshirt. Replace, and since this scene is
| | 01:12 | built at 1 to 1 scale, I'll need
to go into the nucleus node, to the Scale
| | 01:16 | Attributes, and set that Space
Scale down to .01; press Enter.
| | 01:23 | Check the simulation to see if it's working
right. It seems to be working okay; good.
| | 01:27 | Now let's see what happens if we
collide with this high detail dining table.
| | 01:34 | We've got it selected, we'll go up to nMesh >
Create Passive Collider, and I'll keep an
| | 01:40 | eye on my frame rate down here.
| | 01:41 | Press Play, and I'm getting something on
the order of about 3 frames per second.
| | 01:50 | Let me extend my timeline a little bit
here, because the best test of this is
| | 01:54 | when the cloth is settled down,
and is no longer in motion.
| | 01:58 | While it's in motion, the frame
rate is going to fluctuate a lot.
| | 02:01 | I am getting 3.6 frames per second.
| | 02:04 | Now let's see what happens if we
collide with the proxyLayer instead.
| | 02:08 | I am going to select that
dining table, and remove the nCloth,
| | 02:12 | nMesh > Remove nCloth.
| | 02:15 | And this is really the only way to do
this unless you want to make a duplicate,
| | 02:19 | and delete the original.
| | 02:20 | Now it's no longer a passive collider.
| | 02:22 | It seems to be working okay, and let me
just hide that temporarily, and make my
| | 02:27 | proxyLayer visible. And this is made out
of four separate objects; I am going to
| | 02:31 | select them all. nMesh > Create Passive
Collider. Rewind, and play that back, and
| | 02:38 | let that settle down.
| | 02:40 | And you see we are getting
somewhere on the order of 5 frames per
| | 02:43 | second instead of 3.
| | 02:45 | So that was an
appreciable increase in performance.
| | 02:50 | For our final rendering, of course, I
want to increase the Friction, or the
| | 02:54 | Stickiness, so that that
doesn't fall off; play that back.
| | 03:00 | And I don't want to see the
proxyLayer at all, so I can just hide its
| | 03:04 | visibility, turn on the renderableLayer,
play that back, and we are good to go.
| | 03:10 | And you can follow this same principle
with anything, whether it be a character
| | 03:14 | that needs to collide with cloth,
or whatever you might need to do.
| | 03:17 | If it's a high detail mesh, you don't
want to use that as a collision object.
| | 03:21 | Make a proxy object that's the same
sort of shape and size, and use that to
| | 03:25 | collide with your nCloth.
| | Collapse this transcript |
| Modeling nCloth garments| 00:00 | A final note about optimization,
and this is a really important one.
| | 00:05 | When you are modeling nCloth objects,
you need to follow certain rules, so that
| | 00:11 | you don't have problems later down the
line, especially when you're going to be
| | 00:14 | clothing an animated character.
| | 00:16 | I have made this simple
robe here for this character,
| | 00:20 | and I just want to point out to you how
I've tried to observe the same rules in
| | 00:26 | modeling this that you would observe
when modeling a character if you're going
| | 00:30 | to be using subdivision surfaces.
| | 00:32 | I have got the 3 key, or smooth mesh
preview enabled here. I'll press the 1 key
| | 00:37 | so we can see the original base mesh.
| | 00:39 | Just like when you're modeling a
character, you want to try to use all
| | 00:43 | quadrilaterals throughout.
| | 00:45 | You want to try to avoid triangles, and
try to avoid n-gons, which are polygons
| | 00:50 | with more than four sides.
| | 00:52 | You won't be able to completely avoid
triangles; as you'll see here, I have got a
| | 00:56 | few of them scattered around.
| | 00:58 | Those triangles are there to try to
fit quadrilaterals together, and to make a
| | 01:03 | graceful transition between
areas of higher and lower detail.
| | 01:07 | I have got an edge loop running down
here, and it needed to split in order to
| | 01:12 | give me enough detail down here
towards the bottom of the robe.
| | 01:17 | Just basically the same rules that you
would observe with character modeling. It
| | 01:21 | should be all quads if possible, no
n-gons, try to avoid poles, which is where
| | 01:26 | you have more than four
edges meeting at a single point.
| | 01:30 | I have got a few poles in here, as you can see,
but this is not bad for an nCloth object.
| | 01:37 | It could be more detailed, but I wanted it
to be simple for the purposes of our lesson.
| | 01:43 | You'll need to model your cloth to
the character, and you'll need to do that
| | 01:48 | while the character is in a neutral
bind pose, like this traditional T-pose.
| | 01:53 | The T-pose is probably the best choice.
| | 01:56 | You can recycle assets, but you may
need to tailor them to the individual
| | 01:59 | character before trying to create the nCloth.
| | 02:03 | It's difficult to change the structure
of a model after you've created the
| | 02:08 | nCloth. As we saw earlier, you can do
it as long as there are no constraints
| | 02:13 | applied, but it's really common
that you'll need to have all sorts of
| | 02:18 | constraints, and other elements
on an nCloth skinned character.
| | 02:22 | That basically finishes our chapter on
optimization, and in the next chapter,
| | 02:26 | we'll look at
integrating nCloth with animation.
| | Collapse this transcript |
|
|
5. Integrating nCloth with AnimationWelding adjacent borders| 00:00 | This chapter is all about
integrating nCloth with animation, and that
| | 00:04 | generally means applying clothing to a
skinned character; a character that's
| | 00:09 | driven by a skeleton.
| | 00:11 | In the first couple examples here, I've
just got a static mesh. This guy doesn't
| | 00:16 | animate; he's just basically a statue,
| | 00:18 | but we'll work our way up
to an animated character.
| | 00:22 | The first thing to do, of course, is to
create nCloth, and since I've got the
| | 00:26 | character selected, I'll go ahead up to
the nMesh menu, and make him a passive
| | 00:30 | collider. Then I'll choose the
robe, and choose nMesh > Create nCloth.
| | 00:37 | Select it again, go to the Attribute
Editor, Control+A, if it's not already open, and
| | 00:43 | I'm just going to choose a different preset.
| | 00:45 | Presets; let's try the tshirt, and
Replace all those attribute values.
| | 00:51 | If I play this now, it won't look like
much; it's going to look kind of strange,
| | 00:55 | and it's because the scale is wrong.
| | 00:58 | My character is modeled at
a 1 to 1 real world scale.
| | 01:01 | We rewind that, go back to the Attribute
Editor, to the nucleus node, and I need
| | 01:08 | to find the Scale Attributes, which is
down near the bottom. Open that up, and
| | 01:12 | you'll see Space Scale. We
need to set that to .01.
| | 01:15 | Remember that a model that's built at 1
to 1 scale will require a Space Scale of
| | 01:22 | .01. Press Enter, play
that back, and there we go.
| | 01:28 | Now we've got cloth
draped over the character.
| | 01:31 | And we are getting pretty good frame
rates here too of about 12 frames per
| | 01:35 | second, and that's not bad considering
the complexity of this. Just to make that
| | 01:40 | little bit prettier, I can press the 3
key, and you can see that that's now
| | 01:44 | smooth; that'll be better when it's rendered.
| | 01:47 | So, for modesty's sake, we want to keep
his robe closed. I am going to go ahead and
| | 01:51 | hit the 1 key, and go back to just the
polygon mesh display instead of this
| | 01:55 | smooth mesh preview.
| | 01:57 | And what I want to do is apply a
constraint that will keep this closed here.
| | 02:02 | So there's two separate borders here;
there's a row of edges here on one side,
| | 02:07 | and another row of edges on the
other side, and I'll use a constraint to
| | 02:11 | essentially sew them together.
| | 02:12 | I want to select the edges. I'll
right-click on the robe, and choose Edge
| | 02:18 | component mode, and this is all actually
one constant border all the way around.
| | 02:24 | I can double-click anywhere on any of
these, and that selects the entire border.
| | 02:30 | But I need to deselect
everything that's not in the front here.
| | 02:33 | I'll hold down Control, and drag a
rectangle to deselect some of these, not
| | 02:40 | forgetting the ones at the bottom too,
because that border goes all way around.
| | 02:45 | Let's do this in Wireframe
mode with the 4 key.
| | 02:48 | Hold down Control, and deselect all of
those. Check your work. Tumble around in the
| | 02:54 | view. Make sure that you haven't
selected any other edges, just those in the
| | 02:59 | very front. Hit the 5 key, and now I
am ready. I can go ahead and issue the
| | 03:04 | command, which is an nConstraint > Weld
Adjacent Borders, and this will only work,
| | 03:11 | of course, if the two sets of
edges are close to one another.
| | 03:15 | We don't want to weld borders that are
distant from one another. I'll go ahead and
| | 03:19 | release the mouse, and activate that.
| | 03:21 | Now you'll see all these little green
dots indicate there's a constraint in effect.
| | 03:25 | I'll rewind, and play my
simulation, and boom!
| | 03:30 | He's been clothed. And we can set this up
in various ways, too. We can make it so
| | 03:35 | we could open or close the robe.
| | 03:37 | You could use that constraint method
also to sew together parts of a garment.
| | 03:42 | Maybe you've modeled the trunk of
the robe separately from the arms.
| | 03:46 | You can sort of just place them next to
each other, and use that constraint in
| | 03:51 | order to sew them together.
| | 03:53 | However, for best results, you're going
to make sure that, just like with any
| | 03:57 | joint you create in a model, that the
number of vertices is the same, and the
| | 04:01 | edge loops sort of line up.
| | 04:02 | But that would be a cool technique, if
you wanted to, for example, have removable
| | 04:06 | zippered clothing,
where you could take parts off.
| | 04:09 | That's just a simple example of how
we can use the nConstraint weld adjacent
| | 04:13 | borders to sew a garment shut.
| | Collapse this transcript |
| Creating a point-to-surface nConstraint| 00:00 | Here's another way that you can constrain an
nCloth object to another mesh in the scene,
| | 00:06 | and it's called a point to Surface
constraint. It's quite easy to use.
| | 00:10 | What you will need to do is select
some vertices on your nCloth object,
| | 00:14 | and I will do that the same way I did
before, by using Edge selection mode. I
| | 00:19 | will go to Edge selection, and double-click
to select that whole border. Then
| | 00:23 | I want to deselect everything except
for the area around his neck; I just want
| | 00:26 | to constrain that area to his neck.
| | 00:29 | I will hold down the Control key, and
draw a big box around everything else to
| | 00:33 | deselect all of those,
| | 00:35 | and double check and make sure that I
haven't accidentally forgotten anything, or
| | 00:39 | missed anything. Just
those in the very front.
| | 00:43 | maybe not this one; I will
deselect that with the Control key.
| | 00:47 | This should be a vertex selection;
| | 00:49 | I will hold down the Control key, and
right-click on one of these edges and convert
| | 00:55 | that selection To Vertices,
| | 00:58 | and now I have got those vertices selected.
| | 01:00 | Then I need to select the object to
which I want this to be constrained. I will
| | 01:04 | hold down Shift, and select the character mesh.
| | 01:07 | And in the nConstraint menu, I want
to choose a Point to Surface, and when
| | 01:13 | I execute that, you'll see we have now these
vertices indicating there's a constraint there.
| | 01:19 | And I'll play the simulation, and you'll
see now that that area is sort of stuck.
| | 01:24 | Now, none of the rest of it is. You can
see here that that rest of that is still
| | 01:28 | free to move around.
| | 01:29 | We can do another constraint here
around his waist to keep his robe closed.
| | 01:34 | I can go back into Vertex mode.
| | 01:37 | Let's look at this in wireframe with
the 4 key, and around his waist here I'll
| | 01:42 | select that edge loop of vertices,
| | 01:45 | and then Shift+Select the
character mesh inside, and now I am ready to
| | 01:51 | apply another constraint.
| | 01:52 | nConstraint > Point to Surface.
| | 01:56 | And you'll see here, as with all nMesh
constraints, there are some springs there,
| | 02:01 | and that indicates that we're trying
to connect that point to the nearest
| | 02:05 | point on the surface.
| | 02:06 | And this is really cool, by the way,
because you don't need to worry about where
| | 02:10 | the vertices are on your constraining surface.
| | 02:14 | In other words, I don't have to bother
with making sure that there's an edge
| | 02:18 | loop just there, or that I have got
just the right number of vertices, or any of
| | 02:24 | that; it just works.
| | 02:25 | I press the 5 key, so we can see shading,
and play the simulation. And those are
| | 02:29 | actually constrained, and it actually
is kind of stuck to his body now, but we
| | 02:34 | can kind of improve that a little bit.
| | 02:36 | First of all, the collision
thickness is a bit thick for the robe.
| | 02:41 | I have got it selected, and I
have gone into the nClothShape node.
| | 02:44 | Let's display, in the Solver Display,
we'll show the Collision Thickness.
| | 02:49 | And just as I suspected, it's
pretty thick here, in this case.
| | 02:52 | I am going to reduce that down to maybe
about .5, or something like that, and now
| | 02:57 | that will fit more snugly against his skin.
| | 02:59 | Turn the Solver Display back off
again, and now if I play my simulation,
| | 03:05 | basically the same result.
| | 03:07 | But now what we want to do is play
around with the constraint attributes.
| | 03:10 | I want to select that constraint, and
if you have trouble selecting it in
| | 03:14 | the viewport, you can use the
outliner. Window > Outliner, and here's
| | 03:18 | dynamicConstraint2.
| | 03:21 | And then in it's attributes, you'll see
in the Connection Density Range, below
| | 03:26 | that section, keep going down until you see
Rest Length Method, and Rest Length Scale.
| | 03:35 | This is how long the spring wants to be.
| | 03:38 | If I give it a lower value, then it will
kind of pull the robe towards his body.
| | 03:44 | I'm actually going to use a constant
value, and I will set that rest length to,
| | 03:49 | let's say, 1 centimeter, and play
that back, and see what I get.
| | 03:53 | It's pulled it in quite snug to his body.
| | 03:56 | And that's how I really would want to do this.
| | 03:59 | If I want to put a belt around this
character's robe, I would model the belt
| | 04:03 | separately, as a separate object,
| | 04:05 | and it would not
necessarily be an nCloth object.
| | 04:09 | I wouldn't want to make the mistake of
trying to make that belt functional. In
| | 04:13 | other words, I wouldn't want to tie it
off; that would be nearly impossible to do,
| | 04:17 | and to make that dynamic.
| | 04:19 | You would just fake it;
| | 04:20 | you would create a belt that looks like
it's actually holding the robe together,
| | 04:26 | but then use a constraint
to do the actual work.
| | 04:29 | Maybe if you've got, you know, tassels on
the belt or whatever, those could be dynamic.
| | 04:34 | So that's the point of surface
Constraint, and it works amazingly well.
| | 04:39 | It's very easy to use.
| | Collapse this transcript |
| Creating a force field nConstraint| 00:00 | Another really useful constraint is
called a force field, and it's just basically
| | 00:05 | a way that you can push nCloth around.
| | 00:09 | I've created a situation here on purpose
where my cloth is actually intersecting
| | 00:14 | with the character, and when I play the
simulation, his body is poking through the
| | 00:19 | cloth. That's obviously not a desirable outcome.
| | 00:22 | Now, I could fix that through
thickness, and various other methods,
| | 00:25 | but this is an illustration of how
force field can save you when you have
| | 00:29 | issues, such as, for example,
elbows poking through cloth, and so on.
| | 00:34 | Or even, just as a special effect, if
you want to use the force field to push
| | 00:38 | things around, you can do that too.
| | 00:41 | To add a force field constraint, you can
select your cloth object, or vertices on
| | 00:46 | the object, and go up to that
nConstraint menu, and choose Force Field.
| | 00:51 | Now what happens is, any of the
selected vertices are now constrained to that
| | 00:56 | force field, and a small spherical manipulator
is created in the middle of the selected mesh.
| | 01:04 | And it's so small that we can't
really see it here relative to our scene.
| | 01:09 | Press the 4 key; there it is.
| | 01:11 | So that's our force field. It's
going to need to be a lot larger.
| | 01:14 | I can reselect it, so I can get access
to it's transforms in the Channel box.
| | 01:21 | If you have trouble selecting that, then
do it in the outliner; Window > Outliner,
| | 01:26 | and in this case, it's dynamicConstraint2,
and I've got a scale factor here.
| | 01:31 | So I'm going to just turn that up to, let's say,
10, and now I've got a nice large force field.
| | 01:37 | I'll rewind, press the 5 and 6 keys, so
I can see what I'm doing, and then let's
| | 01:43 | do this interactively,
because that's more fun.
| | 01:45 | I'll go up to nSolver > Interactive Playback,
and move that force field, and oh my
| | 01:51 | goodness; look at that! How cool is
that? And I can, of course, animate this.
| | 01:56 | It could be linked to
other objects, like skeleton.
| | 02:00 | In this case, all I really want to do is
just push it up there enough so that we
| | 02:04 | don't get any interpenetration
with the character's skin.
| | 02:08 | The force field is a really useful and
versatile constraint that you can apply
| | 02:12 | to many different situations.
| | Collapse this transcript |
| Dressing an animated character| 00:00 | Now we come to the most exciting, and
the most challenging aspect of nCloth:
| | 00:05 | dressing an animated character.
| | 00:08 | You'll find that nCloth is a very complex
system, and because of that, and the
| | 00:13 | many variables in nCloth, it won't
work the first time you just drop an
| | 00:17 | nCloth onto a character,
| | 00:19 | and you will have to devote quite a lot
of time to adjusting the many variables
| | 00:24 | to prevent issues,
such as interpenetration.
| | 00:26 | I've spent a lot of time on this
scene already, until I'm fairly confident
| | 00:30 | that it's going to work.
| | 00:32 | In your own scene, you'll need
to set aside quite a lot of time
| | 00:35 | for experimentation.
| | 00:36 | What's the process here?
| | 00:38 | Well, I've modeled the cloth in the
character's bind pose, which is, of course,
| | 00:44 | the character's pose in which it was
modeled, and then bound to a skeleton, and
| | 00:49 | traditionally, that's the T-pose,
as we see here.
| | 00:53 | And then I've animated the character out
of that T-pose into the first pose of
| | 00:58 | the actual animation.
| | 01:00 | So here, he's simply just
lowered his arms down to his sides.
| | 01:04 | And I took a good healthy 100 of frames
to do that, and during that time, the
| | 01:09 | cloth will simulate, and settle down, so
that it will match the character in the
| | 01:13 | first pose of the animation.
| | 01:16 | I could have modeled the cloth so that
it was in the shape needed for the first
| | 01:20 | pose of the animation, but that would
have been more difficult, and probably
| | 01:25 | caused more problems than it solves,
in this case.
| | 01:29 | My advice is, model the cloth in that
neutral bind pose, and then animate from the
| | 01:34 | bind pose to the first pose of the animation.
| | 01:37 | And then from here, we've only got just
a one second animation of him raising
| | 01:41 | his arms. Very simple, and yet still will
illustrate some of the challenges that we will see.
| | 01:49 | I'll go ahead and select the robe object,
and go up to the nMesh menu, and Create nCloth.
| | 01:55 | The character's body is already a
rigid collider, so you see we're getting
| | 02:01 | pretty good simulation starting off.
| | 02:04 | In order to keep the cloth on the
character's body, we'll add a couple of
| | 02:07 | constraints, just as we
did earlier in the course.
| | 02:10 | I'll go into Edge component mode;
right-click, and choose Edge, and I want to
| | 02:16 | grab the border here.
| | 02:18 | I'll rewind, double-click, and now I've
selected all those border edges. And if
| | 02:24 | I try to unselect edges here with
Control and drag, you'll notice that I'm not
| | 02:30 | able to unselect those edges, and the reason
is that the skeleton is currently visible.
| | 02:35 | Maya always gives priority to selection
of a skeleton, and that prevents us from
| | 02:41 | selecting those edges.
| | 02:43 | So I just want to go over into the layer
editor here, and just hide the skeleton.
| | 02:49 | Then hold down Control, and I can
drag across to deselect those edges.
| | 02:56 | Down at the bottom, as well, I'll need
to do the same; Control and drag a rectangle
| | 03:02 | to deselect some of these.
| | 03:03 | I can go ahead and issue the
command; in the nConstraint menu,
| | 03:08 | I'll weld the adjacent borders.
| | 03:10 | Check my work to make sure I don't have
any constraints in undesired locations.
| | 03:14 | Rewind, and play that back,
and see if it's working.
| | 03:18 | So that part is working.
| | 03:19 | I'll repeat that process to add a
constraint here up at the neckline.
| | 03:24 | Right-click, and go into Edge
component mode. Double-click to select all
| | 03:29 | those edges. Hold down Control, and
deselect everything except for the few edges
| | 03:35 | around his neckline.
| | 03:37 | This one I'll have to convert to a
Vertex selection. I'll hold down Control,
| | 03:41 | and right-click on that edge, and choose To
Vertices, and now that's a vertex selection.
| | 03:47 | I want to select the character; hold
down Shift, and click on the character's
| | 03:51 | skin, and we'll do nConstraint > Point to
Surface, and when I execute that, you'll
| | 03:57 | see we have these vertices
indicating there is a constraint there.
| | 04:01 | Rewind, and play the simulation, and
it's holding onto his body pretty well.
| | 04:07 | Now, let's let this play
through and see what happens.
| | 04:10 | We'll probably see some pretty severe
issues here, because we haven't adjusted
| | 04:14 | any of the nCloth properties.
| | 04:17 | And pretty quickly, you'll see that,
yeah, there are some serious issues, and
| | 04:21 | as soon as he raises his arms up, we're
probably going to see even more severe issues.
| | 04:26 | So, as you can see, with just the default
nCloth properties, it's a real disaster,
| | 04:31 | but we'll fix that up.
| | 04:33 | I'll rewind back to frame 1, select
the cloth, and go to the Attribute Editor,
| | 04:38 | Control+A, and I've already
changed one thing in the nucleus node.
| | 04:42 | Let's go into that nucleus solver node.
| | 04:44 | I just set the Max Collision Iterations
up to 10; I just increased it slightly.
| | 04:50 | Back to the nClothShape node, I want to
choose the silk preset. Click on Presets,
| | 04:55 | and choose silk > Replace.
| | 04:59 | Rewind, and play that back,
and see how it's changed.
| | 05:02 | Just changing that preset
hasn't really helped much.
| | 05:04 | In fact, in some ways, it's caused
more problems, but we're going to
| | 05:08 | resolve those issues.
| | 05:10 | Rewind back to frame 1 once again,
and I'll go up to the very top of the
| | 05:14 | Attribute Editor, and possibly the most
important attribute to change here, in
| | 05:19 | this case, is the Self Collision Flag.
| | 05:22 | These are different methods for
calculating self-collisions, and the most
| | 05:27 | accurate one is Full Surface.
| | 05:29 | I'm going to choose that.
| | 05:30 | I also want to change a couple of these
attributes up here, such as the Thickness.
| | 05:35 | I want to reduce that down.
| | 05:37 | I'll set that to a value of 0.1, rewind,
play back, and see if that's any better.
| | 05:43 | The collision quality is going to be a
little bit better, because we've chosen
| | 05:47 | the Full Surface Flag,
| | 05:49 | but we're still seeing some
pretty severe issues here.
| | 05:53 | What's happening is, because of the
default Compression Resistance, these edges
| | 05:59 | here are not allowed to become shorter,
but they need to become shorter; we need
| | 06:05 | the cloth to compress here
in the area of the armpit.
| | 06:09 | To achieve that, I'll go down into
the Dynamic Properties, and I'll leave
| | 06:14 | the Stretch Resistance at 60, but
I want to reduce the Compression
| | 06:18 | Resistance to nearly nothing: .05,
and that will allow these edges to
| | 06:24 | become shorter. Play that back,
| | 06:28 | and you can see here in the armpit now,
those edges are compressing, and that's
| | 06:33 | going to give us a better result.
| | 06:34 | It's probably not going to be quite
good enough just yet. There are a couple
| | 06:38 | other attributes we'll need to tweak.
| | 06:40 | Let that play through,
and see what happens.
| | 06:43 | That's certainly better.
| | 06:44 | We'll rewind back to frame 1, and
adjust a couple other attributes.
| | 06:49 | I want to scroll down a bit.
| | 06:51 | The mass is only 0.2;
| | 06:54 | I want to increase that a little bit.
Let's set it to a value of 1. And scrolling
| | 06:58 | down just a little bit further, in the
Quality Settings here, we've got the Max
| | 07:04 | Self Collide Iterations, and as the
name indicates, that's the number of times
| | 07:08 | the self collision algorithm is allowed
to calculate, and to get better results,
| | 07:14 | we'll want to increase that.
| | 07:15 | I'm going to set the Max Self
Collide Iterations to a value of 20.
| | 07:20 | Rewind, and play the simulation.
| | 07:24 | We've got good compression, and it
looks like we are okay at this point.
| | 07:29 | Let him go into that rest pose, and I've
got about one second gap there between
| | 07:36 | the settling down from the bind pose to
the beginning of the animation; gave
| | 07:41 | it a second, so that it would
have some time to settle down.
| | 07:45 | I think we're pretty good.
| | 07:46 | I'll turn on the Smoothing here; press
the 3 key, and that doesn't look so bad.
| | 07:52 | Again, it's a time-consuming
process. It's going to involve a lot of
| | 07:56 | experimentation. Don't lose your
motivation in this process. It's easy to
| | 08:00 | get discouraged, because you'll play
around with variables, and sometimes just
| | 08:05 | make the problem worse.
| | 08:06 | My advice is, change one attribute at a
time, play the simulation, see what happens.
| | 08:13 | If it didn't solve your problem, change
that attribute back to where you found
| | 08:17 | it, and try something else.
| | 08:19 | If you change lots of attributes, and
then play the simulation, then you will not
| | 08:24 | be able to scientifically determine
which attribute is causing the problem, or
| | 08:29 | solving the problem.
| | Collapse this transcript |
| Simulating thick cloth with a wrap deformer| 00:00 | As I mentioned earlier in the course,
if you want to have thick cloth, then you
| | 00:06 | can't really apply and nCloth directly
to that thick object, and here's why.
| | 00:13 | What I've got here is an example in
which I've modeled a robe that has
| | 00:19 | some internal volume.
| | 00:21 | It's a solid watertight mesh.
| | 00:24 | And I've applied an nCloth to it,
just to demonstrate the issue.
| | 00:27 | Go ahead and click Rewind, and play
this back, and what you'll see is that the
| | 00:32 | cloth immediately compresses,
and becomes almost two-dimensional.
| | 00:37 | Additionally, it's self-intersected
here. If I select it, we might be able to
| | 00:42 | see that a little bit more clearly.
| | 00:43 | It's actually pushed through itself, and
that's clearly not a desirable outcome.
| | 00:48 | Additionally, if I rewind, and play it
back again, you can see that I'm only
| | 00:53 | getting about maybe 4 frames
a second, or 5 frames a second,
| | 00:57 | and we can do a lot better than that.
| | 01:00 | Really, what we want is an infinitely
thin cloth that's going to calculate the
| | 01:05 | dynamic simulation, and then we want
that to then drive the thick cloth, which
| | 01:10 | we'll actually render.
| | 01:11 | And we'll use a wrap deformer to do that.
| | 01:14 | I've got another scene.
| | 01:15 | I'll go ahead and open.
| | 01:17 | It's thickCloth_2_begin; open
that up, and rewind, and play it.
| | 01:24 | And you can see that's my cloth simulation,
and I've got about 18 to 20 frames a
| | 01:28 | second on that. Definitely a big improvement,
| | 01:31 | simply because this is two-dimensional,
and it's got fewer than half the number
| | 01:36 | of vertices than that thick cloth had.
| | 01:40 | On my layers here, I've got a
robeThickLayer, and I can make that visible.
| | 01:46 | You can see that this is just
the same one we saw before.
| | 01:50 | I want to open up my Outliner, and
you'll see I've got robeThin, and robeThick.
| | 01:54 | We're going to add a wrap deformer to this.
| | 01:57 | What you want to do is select the deformee first,
and that is, in this case, the thick cloth.
| | 02:03 | And then select the deformer; the
thing that's going to be driving this
| | 02:07 | deformation. Select that second,
so I'll Control+Click on robeThin.
| | 02:10 | I want to go to the Animation menu
set, and under Create Deformers > Wrap.
| | 02:19 | Let's rewind the simulation, and play it
back, and you can see that we're getting
| | 02:24 | something; it is actually deforming.
| | 02:27 | But if you look really closely,
it's not doing a terribly good job.
| | 02:31 | Here's the thick cloth, and it doesn't
seem to be really properly bound to the
| | 02:35 | thin cloth, which is here,
and they're not matching.
| | 02:40 | And the reason for this is the wrap
deformer, by default, acts kind of like smooth
| | 02:44 | skin binding, where a single vertex on
the deformee is bound to more than one
| | 02:52 | vertex on the deformer here.
| | 02:54 | What we need here is similar to rigid
skin binding, where there is more of a
| | 03:00 | one to one relationship between
the deformer and the deformee.
| | 03:03 | To accomplish that, I want
to go into the wrap deformer,
| | 03:11 | and the attribute that we want to play
with here is Exclusive Bind, and it's off
| | 03:16 | by default, and that means
act like a smooth skin binding.
| | 03:21 | We want that to be on. Type in a 1, press
Enter, and now it will act like a rigid skin bind.
| | 03:27 | Rewind that, and play it back.
There we go; much better.
| | 03:31 | And of course, I can hide my simulation
layer. Dolly out a little bit, and see
| | 03:38 | what we get. Rewind, play that back,
| | 03:42 | and with that wrap deformer added now,
we're getting about 12 frames per second.
| | 03:46 | That's certainly a lot better
than the 4 to 5 frames per second we were
| | 03:50 | seeing with the non-wrapped
deformer version that we saw at first.
| | 03:55 | And additionally, when we play this back,
the thickness of the cloth is preserved
| | 04:00 | throughout, and we don't see that compression.
| | 04:03 | So that's one of the tricks of the
trade; how to get fast performance for thick
| | 04:08 | cloth that doesn't self-intersect,
using a wrap dseformer.
| | Collapse this transcript |
| Painting attributes by vertex| 00:00 | One really common that you'll need to
do in nCloth is assigning dynamic or
| | 00:06 | collision properties to
certain areas of the cloth.
| | 00:10 | For example, I've got a scarf that's
going to land on this character's neck,
| | 00:15 | and what I need to have happen in this
shot is I want the scarf to blow in the
| | 00:20 | wind, but it needs to
stay on the character's neck.
| | 00:24 | I could assign stickiness to the
entire scarf, but if I did that, then it
| | 00:28 | wouldn't be allowed to blow in the wind.
| | 00:30 | What would happen is, as soon as it
touches any other dynamic object,
| | 00:34 | it would just stick there, and stay there.
| | 00:36 | What I want is to have stickiness
around here in the back of his neck, and no
| | 00:40 | stickiness everywhere else.
| | 00:42 | And I can achieve that using
painting dynamic attributes per vertex.
| | 00:47 | I'm going to open up the Attribute
Editor; with that cloth object selected, I'll
| | 00:52 | hit Control+A. I just want to point out,
in the nucleus solver node, that I have
| | 00:58 | changed the Time Attributes,
Start Frame to frame 100.
| | 01:02 | That means that the
simulation will begin on frame 100.
| | 01:05 | And also, you'll notice that my start
range for the animation range is also 100,
| | 01:12 | and I've done that just so that there
would a run up to allow the robe to settle
| | 01:16 | down on the character's body.
| | 01:18 | And additionally, I've set an initial state
for the robe, so we don't want to remove that,
| | 01:23 | so we will leave that as is.
| | 01:25 | Well, I've paused my playback, and I'm on
about frame 125, and I want to add some wind.
| | 01:31 | I'll give it a Wind Speed of 100, and I
want the Wind Direction to be from behind
| | 01:36 | the character; that's
going to be positive Z.
| | 01:39 | The Wind Direction X, I'll set to 0,
and Wind Direction Z, I'll set to 1,
| | 01:45 | and resume playback.
| | 01:46 | What I expect to see here is that,
indeed, the scarf will blow in the wind.
| | 01:50 | It will actually blow just right
off the character, and just blow away.
| | 01:54 | That's because there is no
stickiness to the scarf currently.
| | 01:56 | I'm going to rewind, and we're going
to paint the stickiness attribute.
| | 02:03 | Just select the object, and go into the nMesh
menu, and you'll see Paint Vertex Properties.
| | 02:10 | And you can paint any, or all of these.
| | 02:12 | What I want is to paint
the Stickiness now.
| | 02:15 | And I want to go into the
Options open up the tool options.
| | 02:19 | And the first time you do it, what you'll
see is your object turns completely white,
| | 02:23 | and that means that the current attribute
that we're painting into -- stickiness --
| | 02:27 | has got just the default
value of 100%, or a value of 1.
| | 02:32 | And that's a multiplier, that multiplies
with the per object attribute, as we'll see.
| | 02:38 | What we want to do now is we'll go
ahead and paint into these areas here,
| | 02:44 | where we do not want any stickiness.
| | 02:47 | I want to set the value down to 0, and
I can change the size of my brush, just
| | 02:52 | like with all the artisan tools.
| | 02:54 | I can hold down the B key, and reduce
the size of the brush, and just paint.
| | 02:59 | And I'm painting a value of 0, or Black, in
these areas that I do not want to be sticky.
| | 03:05 | Just take a moment to do that. Same thing
here; no stickiness. We just want it to
| | 03:11 | stick just only around his neck line.
| | 03:15 | Okay, so that was easy.
| | 03:17 | Now I need to go back into the Attribute
Editor, Control+A, and I had to have some
| | 03:22 | value to the Stickiness here
for this to work. Set that to 1.
| | 03:27 | And if we look, actually, down in here,
you'll Collision Properties Maps, and if I
| | 03:31 | open that up, you'll see this
Stickiness Map Type is set to Per-Vertex.
| | 03:35 | That happened as soon as I opened up that
menu item to get the tool settings here.
| | 03:40 | I could've also selected the option
here, and then opened the tool settings.
| | 03:45 | I'll rewind, play that back,
and see what I get.
| | 03:51 | There we go; much better.
| | 03:52 | We've got a lot of wind, but the scarf is staying
stuck to the character's body, and to the robe.
| | 03:59 | That is exactly the result
that we're trying to get.
| | 04:01 | That's all there is to it, and you
could paint any of those attributes using
| | 04:05 | that same technique.
| | Collapse this transcript |
| Painting attributes by texture| 00:00 | In addition to painting attributes
by vertex, you can also use textures to
| | 00:05 | accomplish the same thing.
| | 00:07 | We could use the command within here
that says Paint Texture Properties, and
| | 00:13 | paint the Stickiness. That would give
us basically the same functionality as
| | 00:17 | painting by vertex, except we would
be creating an actual file texture
| | 00:22 | through the 3D Paint tool.
| | 00:23 | What I am going to show you instead
of that is something a little bit more
| | 00:27 | interesting, I think, which is using a
ramp that we can just procedurally assign
| | 00:33 | the stickiness based upon
the UVs on the scarf here.
| | 00:38 | So I have got it selected, and in my
nucleus, you'll see Wind Speed of a 100, and
| | 00:44 | Wind Direction of 1 in Z. And when I
play it, we can expect that it's just
| | 00:50 | going to fly right off the character's
body, because of the wind, and because
| | 00:54 | there's no stickiness.
| | 00:56 | In order to see what I'm doing, I want
to assign a material. I just want to
| | 01:00 | right-click, and choose Assign New Material.
This way I can see the ramp that I am working on.
| | 01:06 | And I want to assign just a standard Lambert.
| | 01:08 | I am going to give it a name; I'll
call it stickinessLambert, press Return, and
| | 01:15 | for the Color here, I want to a ramp. I'll
click on Add Render Node, and I want a rampTexture.
| | 01:23 | And if you have hit the 6 key in the
Viewport, then you can see that ramp; 5, and 6.
| | 01:28 | This is just going to be black and
white. Delete one of those little flags
| | 01:34 | there. Change that color white. This
other one here, we'll change to black.
| | 01:41 | And you'll see that the texture is
wrapping around in this direction.
| | 01:46 | So I go up here; it says V Ramp. I
what U Ramp, in this case. There we go.
| | 01:52 | Now the texture is wrapping around the
direction I want. And I'll just set this
| | 01:56 | up so that we'll have white here behind
the back of his head. Make another black
| | 02:02 | flag by just clicking here in this
black area, and reposition these.
| | 02:08 | And if I did that this way, then we
would have a gradual transition between a
| | 02:12 | very sticky, and a very non-sticky area,
but I want a more sudden transition.
| | 02:19 | And if I want to be really particular
about it, I could set these to exact values,
| | 02:22 | like that could be .5 for that white one,
and this could be maybe .6, and this one
| | 02:28 | perhaps .4. And now we have just got the
stickiness only in that one area. Maybe I
| | 02:35 | will extend that just a little bit.
Let's give this .65, and give this one .35;
| | 02:41 | give it a little bit more stickiness there.
| | 02:46 | That's just the texture.
I've set up the ramp.
| | 02:49 | Now what I want to do is assign this
ramp that I've created to the stickiness
| | 02:53 | attribute. Select that scarf, go to
shape node, and open up the Collision
| | 03:00 | Properties Maps, and you will see
Stickiness Map Type is already set to texture;
| | 03:05 | that's the default, in fact, and if
there is no texture here in this slot, then
| | 03:09 | there will be no effect.
| | 03:11 | I want to take the texture that I
created, and place it in the slot.
| | 03:14 | I don't want to click to Add Render
Node, because that would create a new
| | 03:19 | render node. I want to use
the one I already have.
| | 03:22 | To do that, I'll open up the HyperShade. Window >
Rendering Editors > HyperShade. I'll go to
| | 03:29 | the Textures tab, and here's the ramp
that I made, and I'll just hold down the
| | 03:34 | middle mouse button, and drag that
over here onto the stickiness map.
| | 03:38 | Now here's the thing: you can't drag it
onto the field itself. You need to drag
| | 03:43 | and drop it onto the name, until you see
that dashed line around everything there,
| | 03:49 | and then release the mouse.
My ramp is assigned.
| | 03:51 | It won't do anything
| | 03:53 | if I have 0 Stickiness up here, so I'll
need to set the global Stickiness value
| | 03:57 | to 1, because that ramp color is acting as a
multiplier, and multiplying by 0 gives you nothing.
| | 04:05 | Let's test that; see what we get.
Rewind, play it back; we got lots of wind,
| | 04:12 | and once again, just as with painting
by vertex, the scarf is sticking to
| | 04:17 | the character's body just around
his neck, and the area that has no
| | 04:21 | stickiness is blowing freely.
| | 04:23 | Of course, I would want to reassign a
different material to this. I can just
| | 04:28 | reassign back to Lambert 1.
| | 04:31 | The material that I created at first,
which was called stickinessLambert, was just
| | 04:35 | only there for visual purposes, so I
could see where the stickiness ramp was
| | 04:40 | landing on the surface of the scarf.
| | 04:42 | This is a versatile technique, and of
course, we could apply that to any one of
| | 04:47 | these collision properties, or the
dynamic properties maps here as well.
| | Collapse this transcript |
| Animating nConstraint attributes| 00:00 | Nearly anything in Maya can be animated,
and nucleus constraints are no exception.
| | 00:06 | One common thing that we might want to
do is enable or disable an nConstraint
| | 00:11 | over time in order to connect or
disconnect the cloth to some other object.
| | 00:16 | That's what we'll do here.
| | 00:17 | I've got two constraints.
| | 00:19 | I've got a point to surface constraint
around the neckline, and I've got a weld
| | 00:22 | adjacent borders constraint
down the center of the robe.
| | 00:25 | I'm going to open the Outliner; Window >
Outliner, and you'll see I've got two
| | 00:30 | dynamic constraints here.
| | 00:31 | I'm going to select both of those,
and I want to key the Enable attribute.
| | 00:36 | You'll see it here: Enable,
| | 00:39 | and right now it's on. I want to key it
on. Rewind back to frame 1, select the
| | 00:45 | name, and then right-click,
and Key Selected.
| | 00:48 | Now I've got a keyframe there
| | 00:50 | on frame 100, which is the
beginning of my simulation.
| | 00:54 | I'll let that play through for a second,
until it settles down, and then around
| | 00:59 | frame 130, or something
like that, I'll turn it off.
| | 01:03 | Set that to 0 to turn it off, and
you'll notice that the icons for the
| | 01:08 | constraint have disappeared. Press Enter,
then select the name, right-click, and
| | 01:14 | choose Key Selected.
| | 01:16 | Now I've got a second
keyframe here at frame 136.
| | 01:20 | Rewind, and play back, and as soon as we
hit frame 136, the constraints are disabled,
| | 01:26 | and the robe is allowed to
fall off the character's body.
| | 01:29 | Pretty simple technique, but very useful.
We could reverse that process as well.
| | 01:34 | We could set up a simulation in which
some piece of cloth needed to land at
| | 01:39 | a certain location, and stick there
permanently. We could use constraints to
| | 01:43 | achieve that.
| | Collapse this transcript |
| Working with nCaches| 00:00 | One of the coolest features of Nucleus
is the ability to save out multiple
| | 00:05 | caches per object. That means that
we can save variations on the same
| | 00:11 | animation, we can swap those out,
we can blend them, we can even animate
| | 00:15 | the blending, we can even go in and
paint certain areas to use one cache, and
| | 00:22 | other areas to use another cache.
| | 00:24 | In this scene, what I have got is a
character who's just draped with a scarf, and
| | 00:29 | when I press Play, you'll see that the
scarf is just going to settle down for a
| | 00:34 | second. It takes about one second to
come out of its initial state. You'll see
| | 00:38 | that a lot with nCloth is, even though
you set an initial state, you'll still need
| | 00:42 | to have about one second run
up while that cloth settles.
| | 00:47 | But after that one second run up, then
it should be more or less static, because
| | 00:50 | there are no forces acting upon it; there's
no wind, and there's no animation on the figure.
| | 00:56 | So we're going to create our first
cache with no wind. I'll select that scarf,
| | 01:01 | and go up to the nCache menu,
and choose Create New Cache.
| | 01:04 | I want to go into the Options here,
and I want to actually give this a name.
| | 01:09 | nClothShape2, which is the name of the
cloth shape node, _noWind. That way I'll be
| | 01:17 | able to know which is which later.
| | 01:19 | Go ahead and click Create, and that will
take a couple of minutes to calculate.
| | 01:26 | Now that first cache with no wind has
been calculated, and I can scrub through the
| | 01:29 | timeline to observe the results.
| | 01:32 | You'll see that there is a little bit
of movement there, and that's actually
| | 01:35 | because of the simulation
properties on that nCloth.
| | 01:40 | If I had time, I would sort
that out, and make that better.
| | 01:43 | But for the moment, we're really just
interested in adding multiple caches.
| | 01:48 | Now I want to add wind. Reselect
that scarf, and hit Control+A to open up
| | 01:53 | the Attribute Editor,
| | 01:55 | and go to the nucleus node, and I want to
find Gravity and Wind, Wind Speed, and Direction.
| | 02:01 | I'm going to set the Wind Speed to
100, and the Wind Direction is already set
| | 02:05 | to positive Z, which means it's going
to be blowing from behind the character.
| | 02:10 | Now, if I press Play here, we won't
see any change, because, of course, that
| | 02:14 | cache is still in effect.
| | 02:16 | We can disable the cache. We can go into
nCache > Disable All Caches On Selected.
| | 02:23 | And then when we rewind, and play back,
we will see the effect of lots of wind.
| | 02:28 | This version of the scene file has a
stickiness vertex property here, just as
| | 02:34 | we did earlier, in an earlier movie, so
that this area here is sticky, and the rest
| | 02:40 | of the scarf is not.
| | 02:41 | That's plenty windy; I think we're good.
| | 02:44 | We're going to build another cache now,
with new simulation properties. With the
| | 02:49 | scarf selected, go back up to nCache >
Create New Cache, and go into the Option box,
| | 02:56 | and we need to just give this a unique
name: nClothShape2_Wind, and click Create.
| | 03:03 | And we get a dialog asking us, do
we want to add and blend, or replace
| | 03:08 | the existing cache?
| | 03:09 | Well, of course, I don't want to replace the
existing cache. I want to click Add and Blend.
| | 03:14 | It won't actually blend right away,
because we disabled the other cache.
| | 03:18 | What this is going to do is actually
just add a new cache, and we can play
| | 03:23 | with blending later.
| | 03:24 | Go ahead and let that simulate, and
once again, that'll take a couple minutes.
| | 03:31 | That second cache has finished simulating,
and it's stored to disk, and I can
| | 03:35 | scrub through the timeline, and check
the results, and make sure that it's more
| | 03:38 | or less what I want.
| | 03:40 | And I think I'm happy with that. Now
let's look at combining the two caches,
| | 03:46 | or choosing one of the other of them.
| | 03:49 | Whenever you add a new cache, and you
get the dialogue, and you click on Add and
| | 03:53 | Blend, what it does is it creates a
cache blending node, and we don't have
| | 03:58 | access to that blending node through the menus
here. It's only found in the Attribute editor.
| | 04:03 | You'll want to select your cloth,
hit Control+A to open the Attributes,
| | 04:07 | and then select one of the tabs here;
we're looking for something called
| | 04:11 | cacheBlend. There it is; cashBlend1.
| | 04:15 | And you can see here ClothShape2_noWind,
and ClothShape2_Wind, and they both
| | 04:21 | currently have a value of 1.
| | 04:22 | And as I scrub through here, we're
not actually seeing any blending.
| | 04:26 | Well, we can go back up to
nCache > Enable All Caches,
| | 04:31 | and once we've done that, we actually
have a blend between the two, because they
| | 04:37 | both currently have a value of 1.0.
| | 04:40 | To choose between one or the
other, we'll just set these values.
| | 04:44 | If I want a windy version, I'll set
noWind to 0, press Enter, and that's my fully
| | 04:51 | windy version. Or if I want no wind, I
can set this to 1, and set this one to 0,
| | 04:58 | scrub through, and I have
got the no wind version.
| | 05:02 | If they're both set up to 1, we'll
get a half and half between those two.
| | 05:07 | And we can animate these as well.
| | 05:10 | We can change these values over time,
so that we'll have a transition between
| | 05:14 | two different caches.
| | 05:15 | Let's say I want, on frame 100 here, to
have no wind. Go ahead and turn my wind
| | 05:22 | cache down, and I want
to key both of these.
| | 05:25 | I'll right-click, and say Set Key, and right-
click on the name up here, and choose Set Key.
| | 05:31 | Scrub through, and I want to figure
out when I want that to start blowing;
| | 05:35 | maybe around frame 140.
| | 05:38 | And I want to key these again, just to
make sure that those values are maintained
| | 05:42 | between frame 100, and frame 140.
| | 05:44 | I'll right-click, and Set Key,
and again, right-click, and Set Key.
| | 05:49 | And I want some amount of transition
time; maybe a 1 second transition. I'll bring
| | 05:54 | this forward to, let's say,
frame 164, or something like that,
| | 05:58 | and then just swap these values out.
| | 06:00 | Set the noWindCache value to 0, set the
WindCache value to 1, and then key them
| | 06:06 | both. Right-click, and key
selected; right-click, and Set Key.
| | 06:11 | And now when we scrub through here,
you'll see that we have no wind up until
| | 06:16 | frame 140, and then it
gradually transitions up.
| | 06:20 | We could go into the Graph Editor,
and change the transition, but at this
| | 06:25 | point, I think we're good. We've got
a good example of how to play with
| | 06:29 | caches for Nucleus.
| | Collapse this transcript |
| Painting cache weights| 00:00 | To finish our chapter on integration
with animation, we'll look at painting cache
| | 00:06 | weights. This is a really interesting idea.
| | 00:09 | We can have more than one cache per
object, and we can paint where we want a
| | 00:14 | particular cache to have effect.
| | 00:17 | In this scene, I've got a scarf
that's got two caches on it already. Just
| | 00:22 | carried that over from the previous
exercise. There's a cache that has wind, and
| | 00:26 | a cache that has no wind.
| | 00:27 | If I select it, and go to the Attribute
Editor, Control+A, we can look through these
| | 00:33 | tabs here, and here it is: cacheBlend1.
| | 00:36 | And you'll see they're both up at full
strength, with no keyframes on them. And I
| | 00:40 | know that, of course, because these
fields are in white, indicating there is no
| | 00:44 | incoming connection.
| | 00:45 | Now we want to open up this tool in
the nCache menu, Paint Cache Weights Tool,
| | 00:53 | and we need to go into the Option
box to get those tool options up.
| | 00:58 | So we've got our caches listed up here.
We've got WindCache1, and noWindCache1.
| | 01:04 | Currently, they both have full influence,
and I know that because they're both
| | 01:08 | showing as fully white. I'm going to
hide everything, except for that cloth. I
| | 01:13 | am going to hide the skeleton, and geometry, so
we can just focus in on this, and paint on it.
| | 01:18 | What I want is I want one side of the
scarf to be blown by the wind, and the
| | 01:22 | other side not blown by the wind,
| | 01:25 | and I can do that by
painting a grayscale value.
| | 01:29 | We've got a Value slider here. The default
is actually 1; I am going to turn that
| | 01:33 | down all the way to 0,
| | 01:35 | and I'm going to paint in order to determine
which areas will be affected by which cache.
| | 01:40 | As I hover my mouse across the surface,
you'll see I have got a nice big brush.
| | 01:45 | If you need to change the size of the
brush, hold down the B key, and drag your
| | 01:50 | mouse cursor from left to right
to change the size of the brush.
| | 01:54 | I want the left side of this scarf to
be not windy. I'll go ahead and select
| | 01:58 | noWindCache, and I'm going to actually paint
black on this side. That means this side
| | 02:05 | will not be affected by noWindCache.
| | 02:08 | Let's paint that whole thing.
| | 02:12 | And since it's two-dimensional, I
probably don't you worry too much about
| | 02:16 | the back side, but here you go, look, it's folded
in on itself, so I better paint that backside.
| | 02:21 | Just take a moment to do that.
| | 02:24 | And I want the area around
the neck slightly selected;
| | 02:27 | I want that to be effected by no wind.
| | 02:31 | Set the noWindCache value to 1.
| | 02:34 | So that area that's in black now
will not be affected by the noWindCache.
| | 02:42 | Now go to the WindCache, and once again,
paint with black, and I'll just paint the
| | 02:47 | inverse; this is the area that
will not be affected by the WindCache.
| | 02:54 | Same thing here, make sure I
get everything on the back sides,
| | 02:59 | and I am painting a value of 0, or black.
| | 03:03 | Tumble around in the view.
Let's paint that whole thing,
| | 03:08 | and this area up here, I don't want
that to be affected by the wind either.
| | 03:12 | And now we want to check these. I can
just switch these two, and what I want to
| | 03:16 | see is basically a negative image.
| | 03:19 | And there's a little bit of an
overlap there, so I'll just fix that up.
| | 03:22 | Let's say I want this one
to be a little bit windier,
| | 03:26 | so I'll paint some black here on
that noWindCache. There we go.
| | 03:34 | I'll deselect the tool. I'll turn
my Geometry back on, and the Skeleton.
| | 03:40 | Rewind, and play that back, and there
you go. We've got wind on one side, and no
| | 03:46 | wind on the other side.
| | 03:48 | We could do this with as many caches as
we want, but two caches here are sufficient
| | 03:52 | to illustrate the process.
| | Collapse this transcript |
|
|
6. Simulating Special Effects Simulating many objects| 00:00 | nCloth is not just for cloth. You
can do all kinds of interesting special
| | 00:04 | effects, such as this one with
leaves blowing off of the tree.
| | 00:08 | So let's dive into it.
| | 00:11 | Here's a Maya scene that has a
single Paint Effects tree in it.
| | 00:15 | I'll play that back for you,
| | 00:17 | and you'll see it's got some turbulence
on it, so that it appears that it's
| | 00:20 | blowing in the wind,
| | 00:21 | but the leaves are not able to fall.
| | 00:24 | If you want to learn how to build Paint
Effects trees, and other forms of Paint
| | 00:28 | Effects then you can look at some
of our other titles on lynda.com.
| | 00:32 | Specifically, I have got
a title called Maya 2011:
| | 00:35 | Creating Natural Environments, and it
goes into customizing Paint Effects
| | 00:39 | in pretty good detail.
| | 00:40 | But we need this to be a polygon
object in order to turn it into nCloth.
| | 00:45 | I'll go ahead and select it, and go up
to the Modify menu, and choose Convert, and
| | 00:50 | we're looking for Paint Effects to Polygons.
| | 00:53 | And now it's been converted into polygons.
| | 00:57 | Now we're ready to
convert the leaves into nCloth.
| | 00:59 | I'll select the leaves, and see that
that's a separate object now, and we can go
| | 01:05 | into the nDynamics menu set, to nMesh > Create
nCloth, and rewind, and play the simulation.
| | 01:13 | And you'll see that the leaves are no
longer are connected to the branches, and
| | 01:16 | additionally, they're
falling, but falling super slow.
| | 01:20 | By now, if you've seen the rest of the
course, then you know what the problem is
| | 01:24 | here, which is that there's a mismatch
between the nucleus scale, and our object scale.
| | 01:31 | We want to select the nCloth, hit Control+A
to go to the Attribute Editor, and we
| | 01:37 | want to find that nucleus node,
| | 01:39 | and we want to find Scale Attributes. Set
the Space Scale down to .01, because my
| | 01:45 | scene is built at 1 to 1 scale.
| | 01:48 | Additionally, while I'm here, I am going
to reduce the Max Collision Iterations
| | 01:52 | down to maybe just a value of 1. That
will just speed up calculations a little
| | 01:57 | bit. We're not really too concerned
about collisions in this particular case.
| | 02:02 | And scrolling up a bit too, I just
want to turn the Ground Plane on,
| | 02:05 | and also give it some wind;
I'll give it a Wind Speed of a 100.
| | 02:10 | And it's blowing in positive X,
which is fine.
| | 02:13 | I rewind, and play that back. Wow!
| | 02:17 | That's really neat.
| | 02:18 | So let's play around
with this a little bit.
| | 02:21 | First of all, we could give this a
little bit of friction, or stickiness, so
| | 02:24 | that when the leaves fall, and land
on that invisible ground plane, they'll
| | 02:27 | actually stay there.
| | 02:28 | I'll go to the shape node, and it's got
a Thickness of 10; that's a bit much, so
| | 02:34 | I'll give it a Thickness of, let say, 1.
| | 02:36 | Scroll down a bit, and you'll see
we had Friction, and Stickiness.
| | 02:41 | Let's give it a Stickiness of, let's say, .5.
Rewind, and play that back, and see what happens.
| | 02:47 | So when they land, they kind of just
drift a little bit. Maybe I'll increase the
| | 02:51 | stickiness just a bit; we'll give
that a stickiness of 1, and try again.
| | 02:59 | That's pretty cool.
| | 03:00 | They seem to be falling pretty fast.
I'll rewind, and scroll down, and just
| | 03:05 | reduce the Mass a bit.
| | 03:07 | In the Dynamic Properties,
it's just got a Mass of 1.
| | 03:11 | Let's give that a Mass of .3.
| | 03:14 | They should stay aloft a
little bit longer because of that.
| | 03:17 | Later we'll go back, and we'll play
around with these other attributes, and try
| | 03:21 | to make that better.
| | 03:22 | But for now, we're more concerned about
getting them stuck to the tree, so that
| | 03:25 | they will fall off not all in one go.
| | 03:29 | And to do that, we'll add a dynamic
constraint. Select the leaves, Shift+Select
| | 03:35 | the branches, go up to nConstraint,
| | 03:37 | and this time we want a
Component to Component constraint.
| | 03:41 | Go ahead and execute that,
| | 03:43 | and as soon as you do that, you'll see
that you have lots and lots of links. We
| | 03:47 | need to dial that down a bit.
| | 03:49 | We'll also play it, and see what we get.
They're all stuck to the tree once again.
| | 03:54 | You'll notice now that my frame rate
has gone down to about half of what it was
| | 03:58 | a minute ago, because there's
so many constraint links here.
| | 04:02 | So let's fix that up.
| | 04:03 | I'll go to the dynamicConstraintShape
node, and I'm looking up near the top for
| | 04:09 | the Connection Method,
and it says Nearest Pairs.
| | 04:12 | What that means is, it's trying to find
the nearest vertices to the constraint
| | 04:19 | object, but that's not really working
here. We're going to go ahead and chose
| | 04:24 | Within Max Distance; that's
obviously a distance-based destination.
| | 04:28 | If I rewind, and play that back now
with a max distance of .1, they're not
| | 04:34 | constraint any more. You'll see we
got a major performance hit too.
| | 04:40 | Rewind, and let's set that Max Distance
to, let's say, 50 centimeters. Press Enter,
| | 04:45 | and now you'll see we have
links in the right places.
| | 04:47 | And we play that back, and
that's actually helped the performance.
| | 04:52 | They're not falling off, because
they're kind of stuck on there permanently.
| | 04:55 | What we want to do is reduce the Glue
Strength. Scroll down here a little bit.
| | 05:01 | You've got the ordinary Strength here,
which is the overall strength for the
| | 05:05 | constraint, and then there's Glue Strength.
| | 05:07 | We can give that a little bit lower
value, which will cause the wind to actually
| | 05:11 | blow those leaves off the branches.
| | 05:13 | Give it a Glue Strength of,
let's say, 0.9.
| | 05:18 | Rewind, and play that back,
| | 05:20 | and we're almost there. You'll see that
they're falling, but they're falling all
| | 05:24 | at once, once again.
| | 05:26 | The last thing we need to do to make
this work is to select the branches, and
| | 05:31 | when we created the constraint, Maya
converted this to an nRigid object, so
| | 05:38 | that's now passive collider,
but Collisions are disabled.
| | 05:43 | So I just want to turn that on. Enable
collide for the nRigidShape node of the branches.
| | 05:49 | Rewind, and play that back, and it'll
blow around for a few seconds, and then
| | 05:55 | slowly those leaves will
start to drift, and land.
| | 06:00 | And that doesn't look so bad.
| | 06:02 | If we don't like this display, if
this is kind of bugging us with all these
| | 06:06 | little points on here, we can just
select the constraint node, go in here, and
| | 06:11 | just disable the display.
Here we go; Display Connections.
| | 06:16 | So I could playblast this
now, and it wouldn't look so ugly.
| | 06:21 | So in just a few mouse clicks, really,
we've got leaves blowing off of the tree.
| | 06:25 | Can you imagine how difficult that would be
if you wanted to animate each leaf separately?
| | 06:31 | That would take ages. It would
take eons to do this by hand.
| | 06:35 | But with nCloth, it's a breeze. It takes
just a few seconds, really, as long as you
| | 06:40 | know what buttons to press, and now you do.
| | Collapse this transcript |
| Adjusting lift and drag| 00:00 | We'll now dig a little bit deeper into
the nClothShape node to adjust the Lift
| | 00:04 | and Drag on the leaves, to make
them move the way that we want.
| | 00:09 | To do that effectively, we really need to be
able to see real time playback in the viewports.
| | 00:14 | As I was developing the scene files
for this course, I discovered what appears
| | 00:18 | to be a bug in this version of Maya, in
which even if I disabled the constraint,
| | 00:24 | and the rigid node, and collisions, I wasn't
getting any performance benefit from doing that.
| | 00:30 | I need the leaves to move in real time,
and the only solution I was able to find
| | 00:35 | was to in fact delete the rigid
and dynamic constraint shape nodes.
| | 00:39 | So we're going to have to do that as a
workaround. We'll delete those, and then
| | 00:44 | the leaves will fall in real time. We
can figure out what values we want for
| | 00:48 | the Lift, and Drag, and then write them down,
reopen the scene, and reapply those values.
| | 00:55 | So I'm deleting the nRigid shape, and
dynamicConstraintShape. I've selected those in
| | 01:01 | the Outliner, and press the
Delete key on the keyboard.
| | 01:06 | Rewind, and play back, and it's very, very
important that I see those move in real time,
| | 01:10 | so I am just checking that I'm not
seeing that bug happened anymore.
| | 01:14 | So now we can start playing
around with the attributes.
| | 01:18 | I want to select those leaves, and I
want to go back to the nucleus node, and
| | 01:24 | increase the wind a bit. I am going to
crank that wind up. I have only got at a
| | 01:28 | 100 now; I am going to
cranked that up to 1000.
| | 01:31 | And additionally, I had reduced the Max
Collision Iterations down to 1. I'm going
| | 01:35 | to bring that up to 4, and
rewind, and play that back.
| | 01:40 | You'll see the wind is blowing those leaves
away a lot more strongly now. Play that back.
| | 01:45 | Wow!
| | 01:47 | That's really neat.
| | 01:49 | Now, Lift and Drag are going
to be found in the shape node.
| | 01:51 | I'll go into that nClothShape node, and
scroll down, and we've got, near Mass,
| | 01:58 | we've got Lift, and Drag.
| | 02:00 | These are supersensitive attributes.
| | 02:03 | If I turn them down to 0, we'll see a bit
of a change here. Rewind, and play that back.
| | 02:08 | And you'll see that interestingly, now
with Lift and Drag set to 0, the wind
| | 02:14 | is having no effect.
| | 02:16 | The Drag attribute controls how
much the wind will affect the leaves.
| | 02:21 | If I set Drag to, let's say, .001, that's going
to produce some air resistance on those leaves,
| | 02:29 | but not much. Let's try .05.
| | 02:31 | There we go, so that's the default value 0.05.
| | 02:38 | If I wanted them to move less under
the influence of the wind, obviously, I can
| | 02:43 | reduce this Drag amount, say, .01.
| | 02:47 | So, Drag is the air resistance.
| | 02:50 | Lift is the tendency of the leaves to
remain aloft; to actually stay in the air,
| | 02:57 | and if I reduce the wind down to 0 in
the nucleus node, and play it back with no
| | 03:06 | Lift, and no Drag, and no wind, then the
leaves just fall straight to the ground.
| | 03:10 | And I'll give it a little bit of Lift; let's
try the default of 0.5, rewind, and play back,
| | 03:17 | and you'll see that they
actually kind of scatter around.
| | 03:21 | And they're moving
according to their own shape.
| | 03:23 | Each one of these is a tiny little
piece of cloth that can actually bend.
| | 03:27 | And I haven't tried playing around with
the rigidity, or the bend resistance of
| | 03:32 | the cloth, and so they're
kind of free to flutter around.
| | 03:36 | I think what I want here is a
lower value to the Lift, like a .001.
| | 03:40 | And now they scatter. That's
a lot more elegant, I think.
| | 03:47 | Again, these values are
incredibly sensitive.
| | 03:50 | Let's try a Drag of .02, and a Lift
of .001, and then re-enable the wind.
| | 04:03 | Let's try wind of a 100.
| | 04:05 | I'll rewind, and play that back.
| | 04:09 | So you see with a low Drag,
and low wind, we don't get much.
| | 04:15 | But if I either increase the wind, or
increase the Drag, it'll cause the leaves to
| | 04:20 | blow over to the side more.
| | 04:21 | How about a drag of 0.1?
| | 04:25 | Play that back, and see what we get.
| | 04:27 | And they're getting pushed over
a little bit more to the right.
| | 04:30 | I am just going to crank up the Wind
Speed. We'll just fine-tune this; maybe 500.
| | 04:36 | Rewind, and play back, and I think
that's a naturalistic look, with leaves
| | 04:42 | scattering in the wind.
| | 04:44 | Now, because of the bug that I
mentioned earlier, where I wasn't getting
| | 04:47 | real-time playback, I need to write
down these values, and then plug them into
| | 04:51 | the scene. I have got a Wind Speed of
500, and in my shape node, I've got a Lift
| | 04:58 | of .001, and a Drag of 0.1.
| | 05:02 | So I have written those down.
I'm going to reopen my scene.
| | 05:07 | I have got Recent Files; I can just
reopen that same scene, and of course, I
| | 05:11 | don't want to save.
| | 05:13 | And now that I know what values I
want, I can go ahead and plug those in.
| | 05:18 | Select the leaves. I have got a Lift of
.001, a Drag of .1, and a Wind Speed of 500.
| | 05:29 | Additionally, I'd also increased the Max
Collision Iterations a bit to, let's say, 4.
| | 05:35 | And now we're going to be
back to a slow playback here.
| | 05:39 | We'll need to playblast this in
order to see the end result, otherwise
| | 05:43 | it'll just take too long.
| | 05:44 | Select the Constraint node, go in
here, and just disable the display.
| | 05:50 | And we'll do Window > Playblast, and let's
go into the Options for that playblast.
| | 05:55 | Save it out, click Playblast,
and allow it to play through.
| | 06:01 | This has just rendered a temporary movie.
| | 06:06 | My playblast is finished calculating.
Let's see what we get when I press Play.
| | 06:11 | You can see that those leaves are
drifting over more towards the right, and that
| | 06:15 | feels a bit more natural
than what we had at first.
| | 06:18 | I think my tree has got too much
turbulence on it, but we can't blame nCloth for
| | 06:23 | that. That's the settings I
had in the Paint Effects brush.
| | 06:26 | So that's how we can adjust Lift, and Drag.
| | Collapse this transcript |
| Applying wind shadow| 00:00 | Here's another really cool feature of
Nucleus: we have the ability to block the
| | 00:05 | wind coming from the nucleus node.
| | 00:08 | What I've done here is I've got my flag
with some wind on it, and I've built just
| | 00:12 | a simple plane to act as a barrier, to
illustrate how the wind shadow works.
| | 00:18 | Currently, we're not seeing any wind
shadowing. The flag is blowing in the wind.
| | 00:22 | I'll select my object that
I want to block the wind.
| | 00:25 | Let me go ahead and make that into a
passive collider. So that's the precondition;
| | 00:31 | it's got to be a passive collider.
| | 00:33 | It could also be an nCloth,
but that would be overkill.
| | 00:37 | Rewind, and play that back, and it's
currently not blocking the wind at all.
| | 00:41 | I'll go ahead and select it, hit
Control+A to open up the Attribute Editor,
| | 00:46 | and in the nRigidShape node, you'll
see a section that says the Wind Field
| | 00:50 | Generation, and we need to increase
this attribute: Wind Shadow Distance.
| | 00:56 | What that means is, what's the area around
the object in which the wind will be blocked?
| | 01:02 | And with the value of 0,
then it's not blocking at all.
| | 01:05 | If I gave it a low value of 1, for
example, then it would only affect nCloth
| | 01:11 | objects that were 1 unit away,
| | 01:14 | and if we play this again,
we will not see any change.
| | 01:18 | In this case, because I've got a world
that's built at 1 to 1 scale, this
| | 01:22 | will have to be a really high value,
like a value of, let's say, 500. Rewind, and
| | 01:28 | play that back, and you'll see now the
wind is being blocked by that plain.
| | 01:32 | Well that's pretty cool, but it gets
better, because we can animate this, as long
| | 01:38 | as this object moves around, it
can actually block the wind, or not.
| | 01:43 | And we can see that really obviously if
we just go into interactive playback mode.
| | 01:47 | I have got my plane selected, I
have got the Move tool active, go to
| | 01:52 | nSolver > Interactive Playback, and
I've got 6000 frames in my timeline.
| | 01:58 | There it is, with the wind enabled, and
then if I simply move this out of the way,
| | 02:03 | the wind will kick in again.
That's pretty neat.
| | 02:05 | Now I put it back, and it blocks the wind.
| | 02:10 | Now, of course, if it were on the other
side of the object over here, then it
| | 02:15 | wouldn't be able to block the wind,
because the wind is actually blowing in
| | 02:19 | positive X. Just like in the real world,
that's not going to block the wind. And
| | 02:23 | of course, we'd animate that as well. It
doesn't have to be interactive playback;
| | 02:27 | we could animate this position either up
and down, or forward and back. Any way to
| | 02:31 | get that farther away
from the nCloth object.
| | Collapse this transcript |
| Connecting nCloth to fields| 00:00 | Maya fields are forces that can operate
on dynamic objects, including nCloth, but
| | 00:06 | also including particles, and rigid
and soft bodies, as well as Maya fluids.
| | 00:12 | What we are going to do here is we are
just going to make these leaves fly off
| | 00:17 | the tree as if they are
kind of exploding outward.
| | 00:19 | If I press Play, you'll see that there's
nothing fancy going on with those leaves
| | 00:23 | there; just nCloth objects that
have basic properties. There's no wind or
| | 00:28 | anything in the scene currently.
| | 00:30 | I'll select those leaves, and go up
into the Fields menu, and choose Radial.
| | 00:36 | A radial field will push or pull
dynamic objects in all directions: towards, or
| | 00:43 | away from the field location.
| | 00:46 | I'll move that field upward, so that it's
this kind of near the center of the tree.
| | 00:51 | If I play my simulation, I won't see any
change just yet, because the field options
| | 00:56 | need to be adjusted. With that field
currently selected, you'll see I have got
| | 01:00 | the attributes open
here in the Channel box.
| | 01:03 | The main one I need to do here is I need
to turn off Use Max Distance. That means
| | 01:08 | that it's only able to affect objects
that are as far away as the Max Distance
| | 01:13 | value, which is currently
only 20 centimeters.
| | 01:15 | I want to turn Max Distance off; set
that to 0. Rewind, play back, and you'll see
| | 01:22 | that those leaves are flying outward.
| | 01:23 | There is also an Attenuation factor
here; that's really not going to affect it
| | 01:28 | that much, but I'll turn
it off, just because I can.
| | 01:31 | Attenuation is the influence of
the field up to the Max Distance.
| | 01:36 | If Attenuation is 1, then the field will
have full effect at the location of the
| | 01:41 | Field icon, and it will drop off
linearly as it reaches the Max Distance value.
| | 01:47 | But with Attenuation turned off, and Max
Distance set to 0, the field will affect
| | 01:53 | all of the leaves equally. Play that back.
| | 01:56 | Now, you'll notice that the leaves are
currently accelerating away from the tree,
| | 02:02 | and that's because the leaves have
inertia, and what's happening is that the
| | 02:07 | radialField is being applied on every
frame of the animation, and that's adding
| | 02:12 | to the existing momentum that's
carried over from the previous frame, and the
| | 02:16 | end result is that the objects accelerate;
with each frame, they pick up more and more speed.
| | 02:21 | All we need to do to correct that is to
keyframe the Magnitude, so that it will
| | 02:27 | just kind of kick the
leaves outward, and then shut off.
| | 02:30 | I'll rewind to frame 1, and
Magnitude is currently 5.
| | 02:35 | I don't know what it will need to
be once I keyframe these values,
| | 02:38 | so I'll probably have to go into the
Graph Editor and fix it, and it will
| | 02:42 | probably need to be a greater magnitude,
| | 02:44 | but I'll use this as a starting value.
I'll right-click, and choose Key Selected,
| | 02:47 | and then on frame 1, I have got a
keyframe with a magnitude of 5. Play that back.
| | 02:53 | And then I want to go 2 frames later. If
you only keyframe the field on for one
| | 02:59 | frame, then really, nothing will happen.
| | 03:01 | I'll just go forward two frames to
frames 3, and then set the Magnitude value to
| | 03:07 | 0. Select the name, and right-click, and
Key Selected. Rewind, and play that back,
| | 03:13 | and see what we get. Okay!
| | 03:15 | Well, that's a start, but I
think that needs some work.
| | 03:18 | I will need to go into the Graph Editor.
| | 03:21 | So with that field still selected, I'll
go into Window > Animation Editors > Graph
| | 03:25 | Editor, and you will see the Magnitude
curve here. Select that, press the F key
| | 03:31 | on the keyboard to frame that curve,
and instead of having this auto tangents
| | 03:36 | interpolation, I want to select these
keys, and choose step tangents. That way,
| | 03:40 | we'll have a value of 5 to the
magnitude for the full two frames duration.
| | 03:47 | Rewind, and play that back. That's a
little bit better, but I think what it needs
| | 03:51 | is just maybe a greater Magnitude.
| | 03:54 | Go back to the Graph Editor, select
that first keyframe. It's at frame 1. I'll
| | 03:58 | give it a Magnitude of,
let's say, 20. Rewind; boom.
| | 04:04 | Well that's the effect I was
trying to achieve is exploding leaves.
| | 04:08 | As you can see, fields are easy to use,
and if you've already learned how fields
| | 04:14 | work, then you can apply that
knowledge directly to Nucleus.
| | Collapse this transcript |
| Simulating rigidity| 00:00 | Another of the many uses of nCloth is
to create in rigid, or semi-rigid objects.
| | 00:06 | In this short exercise, we'll
make a bouncing ball using nCloth.
| | 00:10 | I've got a blank empty scene here, with
my scene unit set to centimeters. Go up
| | 00:15 | to Create menu, and choose
Polygon Primitives.
| | 00:19 | And I don't actually want to use a
sphere, because the sphere has two poles on
| | 00:23 | it, with lots of little tiny polygons.
| | 00:25 | Instead, I want to use a Platonic Solid,
because the faces will all be the same size.
| | 00:31 | Go ahead and click on that, and then
drag out on the grid. Press the 5 key,
| | 00:35 | so we can see shading.
| | 00:37 | Go to the input nodes, and let's set the
Radius to about 20. Get in closer on that.
| | 00:43 | And the Solid Type, I want to chose
Icosahedron, which is a 20 sided Platonic Solid.
| | 00:50 | And that's not a sphere, obviously, but
we can just drop a polygon mesh smooth
| | 00:56 | node on that, and round it out.
| | 00:57 | I'll go to the Polygons menu set, and go
to Mesh > Smooth, and in the polySmoothFace
| | 01:06 | node, I'll set the Divisions to 2.
| | 01:09 | And now I have got a spheroid.
| | 01:10 | It's not a perfect sphere, but
it'll behave much better with dynamics.
| | 01:17 | Move that up to about maybe a meter off the
ground, and then I'll make that into an nCloth.
| | 01:24 | Go to the nDynamics menu
set, nMesh > Create nCloth.
| | 01:29 | And if I press Play, of course, it's going
to move really slowly, once again, because
| | 01:32 | I've built my scene at real world scale.
| | 01:35 | I'll select the ball, go to the Attribute
Editor, Control+A, go to the nucleus node,
| | 01:41 | and I want to find the Scale Attributes
section, and set Space Scale to .01.
| | 01:47 | While I'm here, I will also want to just
increase the Max Collision Iterations a
| | 01:51 | little bit to, let's say, 8, and turn on
the Ground Plane. Rewind, and play that.
| | 01:58 | Okay, so we've got a
crumpling piece of cloth.
| | 02:02 | Next thing we're going to do is we're
going to choose a different preset.
| | 02:05 | Go to shape node, and click on
Presets; hold that down, and we'll do a
| | 02:09 | waterBalloon, and Replace all the values.
| | 02:12 | And you'll see that, for example, these Pressure
settings have changed. Rewind, and play that.
| | 02:19 | So we've got a water balloon.
What we want is a rubber ball.
| | 02:23 | To accomplish that, we'll just add some
Rigidity. Scroll up a little bit, and you
| | 02:29 | will see, here we go: Rigidity.
| | 02:32 | And I want to set that to a value of,
let's say, 5. Rewind, and play that back,
| | 02:38 | and wow! Wev'e got a ball.
| | 02:40 | Now, we want that to bounce a lot more.
We'll increase the bounciness factor.
| | 02:46 | Go up to the very top of that page,
and I actually want to turn off the Self
| | 02:50 | Collide option, because it's just going
to do a lot of unnecessary calculations,
| | 02:55 | and it could actually bog down the
machine, or make it appear to freeze.
| | 03:00 | And I've got the Bounce here.
| | 03:02 | Let's set the Bounce to a value of 20, and
I'll increase the Friction a little bit.
| | 03:07 | Let's just make the Friction of value of
1; that way it will not swirl around on
| | 03:12 | the ground too much.
| | 03:14 | And let's end range of, let's
say, 72 frames in my timeline.
| | 03:19 | Rewind, and play that back, and
whoa! I've got a bouncing ball.
| | 03:22 | Now, in this case, it seems to be a
little bit overactive bouncing ball. The
| | 03:25 | Bounce factor is apparently causing it to
bounce up higher each time, so let's try 15.
| | 03:34 | Still too much, so 12.2 we'll call it.
| | 03:40 | So that's how we can do a bouncing
ball using rigidity in Maya nCloth.
| | Collapse this transcript |
| Scaling time with nCache| 00:00 | I've created this little bouncing ball
animation with nCloth, and I want to use
| | 00:05 | that to illustrate a cool
trick you can do with nCache.
| | 00:09 | To make this happen, I'm going to select
that ball, and go up into the nCache menu,
| | 00:13 | and Create a New Cache.
| | 00:14 | I'll just play through;
take a second to do that.
| | 00:17 | Now I can scrub across in the timeline,
and with that ball selected, I can go
| | 00:22 | back to the Attribute Editor, and I'm
looking for the cache node. Here it is:
| | 00:26 | nClothShape1Cache1. And there are a lot
interesting things you can do in here.
| | 00:32 | What I'm really concerned with here
is the timing of the animation, and that's
| | 00:35 | accomplished through this Scale attribute.
| | 00:38 | This doesn't change the size
of the object in the scene,
| | 00:42 | but it changes how the cache is
interpreted in terms of scale of the world.
| | 00:48 | If we reduce the Scale here to .5, then
the cache is going to consider that that
| | 00:55 | object is now half as big, and
that means it'll move twice as fast.
| | 01:01 | So it only took 36 frames
instead of 72 to go through its motions.
| | 01:07 | If it had a Scale of 2, the simulation
is going to act as if the object were
| | 01:12 | twice as large, meaning it would take
twice as long to reach its destination.
| | 01:17 | If I press Play here, you'll see it's
moving at half speed. I can extend my
| | 01:23 | timeline a little bit here, and I
can really slow down to 1/5 speed by
| | 01:28 | giving it a Scale of 5.
| | 01:31 | And this is pretty amazing,
because the cache is being interpolated;
| | 01:35 | there is a lot of
missing data in between frames.
| | 01:38 | I originally only had 72 frames of
cache data, and Maya is very cleverly filling
| | 01:44 | in the gaps. I've taken that 72 frames,
and stretched it way out to 5 times that
| | 01:49 | much, and then Maya is interpolating
all the in between cache frames for us.
| | 01:55 | That's a pretty cool trick can do,
| | 01:56 | especially if you're having problems
with your cloth not moving at the right
| | 02:00 | speed. You can cache it, and then
go in here, and change the Scale.
| | Collapse this transcript |
| Warping objects with Input Mesh Attract| 00:00 | Another interesting feature of nCloth
is called Input Mesh Attract, and what it
| | 00:05 | does is it attempts to restore the
cloth to the original shape of the model. And
| | 00:11 | it can be used for doing interesting
things, like applying secondary jiggle
| | 00:16 | animation to character skin.
| | 00:17 | Here we're going to do a very
simple version of Input Mesh Attract.
| | 00:21 | I've got a little delta wing fighter
here, and I've just got some very simple
| | 00:26 | animation on it; it's just moving across
the space over the course of 2 seconds.
| | 00:30 | I'll select it, and convert it to an
nCloth; nMesh > Create nCloth. And if I press
| | 00:35 | Play, of course, it's going to move
really slowly, once again, because I've built
| | 00:39 | my scene at real world scale.
| | 00:41 | Let's select it, go into the Attitude Editor,
Control+A, and select the nucleus node,
| | 00:46 | and reduce the Space Scale to .01.
Rewind, and play back, and you'll see it's now
| | 00:53 | falling as if it were a small piece of
cloth, about the size of, like, a tea towel.
| | 00:57 | Well, now we're going to
play with Input Mesh Attract.
| | 01:01 | Go back into the Attribute Editor, Control+A,
and in the nClothShape node, Input Mesh
| | 01:07 | Attract. It's here, and you will find
it in the Dynamic Properties section.
| | 01:11 | I'm going to set that to a value
of, let's say, .5. Press Return, and I'm
| | 01:17 | going to reduce this damping factor down
to 0; we want the full effect here. Rewind,
| | 01:22 | and play that back, and you can see
we've got a weird little warp effect. Let's
| | 01:27 | see what that looks like from another angle.
| | 01:30 | And as you can see, it is attempting
to restore the shape back to the
| | 01:35 | original model.
| | Collapse this transcript |
| Tearing nCloth| 00:00 | The final effect I'd like to share with
you is tearing nCloth, and it's actually
| | 00:04 | quite easy to do; it's
implemented through a constraint.
| | 00:08 | Here what I've got is a piece of heavy
denim cloth, and it's got two transform
| | 00:13 | constraints of the corners,
just to hold it in place.
| | 00:15 | I'll play that simulation, so you can
see what is doing before the tearing.
| | 00:21 | I want to tear it straight down the
middle, and so I'll select these vertices,
| | 00:26 | select the plane, right-click, and
choose Vertex, and then select those
| | 00:31 | vertices down the center.
| | 00:33 | And I want to go into the nContraint
menu, and choose Tearable Surface.
| | 00:40 | So I'll rewind, and play that back, and
you'll see it tears straight away on frame 1.
| | 00:46 | Once you apply that tearable constraint,
it's going to permanently change the
| | 00:51 | topology of the output mesh, and you'll
never be able to get it back to a state
| | 00:56 | in which it was a single mesh.
| | 00:58 | This has implications if you're
using vertex level dynamic properties.
| | 01:04 | In other words, if you're painting by
vertex, then if you tear, it's going to
| | 01:08 | change all that, because you've changed
the topology, and it's going to cause
| | 01:12 | your vertex properties to go haywire.
| | 01:14 | What that means is, if you need to
apply dynamic properties locally to certain
| | 01:20 | areas of the mesh, then you'll need to
do that through textures, and painting,
| | 01:26 | rather than by vertex.
| | 01:28 | So, this is going all at once. We
want that to be delayed. We'll make that
| | 01:34 | happen a little bit later.
| | 01:35 | I've got the constraint currently selected,
and here in the Attribute Editor, I
| | 01:40 | have got the dynamicConstraintShape
visible, and the relevant attribute here is
| | 01:45 | the Glue Strength. And if that were set
to a value of 1, then it would never tear.
| | 01:50 | I'll play this through until we reach,
let's say, frame 24, and keyframe the Glue
| | 01:56 | Strength at a value of 1 on frame
24. I'll right-click, and Set Key.
| | 02:02 | And then I will go a few frames later;
maybe about 12 frames later to frame 36,
| | 02:09 | and I'll set the Glue Strength to 0, right-click,
and Set Key. Rewind, and play it back.
| | 02:16 | There is going to be a transition between
frame 24 and frame 36 in which the cloth tears.
| | 02:25 | And it tears according to the
amount of stress on it caused by the
| | 02:28 | stretching here. Pretty cool.
| | 02:32 | That's all there is to tearing a piece
of nCloth, and that completes our title on
| | 02:37 | understanding Maya nCloth.
| | Collapse this transcript |
|
|
ConclusionGoodbye| 00:00 | That wraps up our course in
Understanding Maya nCloth.
| | 00:04 | I hope you've enjoyed this as
much as I've enjoyed making it.
| | 00:07 | If you want to further your
studies, practice makes perfect.
| | 00:11 | There is one place I want recommend
you can go to check in for the latest news
| | 00:16 | for Maya, and especially for Maya
dynamics, and that's the official Autodesk Media
| | 00:21 | and Entertainment Web site.
It's area.autodesk.com.
| | 00:26 | There are some very good
developer blogs in there; specifically
| | 00:30 | Duncan Brinsmead's blog.
| | 00:32 | He is one of the Maya developers
who has done a lot of work on nCloth.
| | 00:37 | That's a good place to go to
see the latest tips and tricks.
| | 00:40 | I would like to extend my thanks to you for
watching this training program, and say goodbye.
| | 00:45 | Goodbye!
| | Collapse this transcript |
|
|