IntroductionWelcome| 00:04 | Welcome to Creating
Simulations in Maya Dynamics.
| | 00:07 | My name is Aaron F. Ross, in this course
we'll be looking specifically at Maya's
| | 00:12 | Rigid Body Dynamic System.
| | 00:14 | This is a physics engine built into Maya;
| | 00:16 | it can save you a lot of time when
animating collisions and other phenomena that
| | 00:20 | would be too difficult or time-
consuming to keyframe by hand.
| | 00:24 | In this course, we'll
cover the following topics:
| | 00:27 | understanding the importance of
scale, generating physically accurate
| | 00:31 | simulations, working with gravity and
other forces known as fields, adjusting
| | 00:37 | physical properties such as
friction and bounce, baking a simulation to
| | 00:42 | editable keyframes, and applying
constraints to connect and limit the behavior
| | 00:47 | of dynamic objects.
| | 00:49 | Let's take a look at what
Maya Dynamics can do for us.
| | Collapse this transcript |
| Prerequisites| 00:00 | Before we launch into Maya Dynamics,
there are just a couple of prerequisites I
| | 00:04 | need to mention in order to get you started.
| | 00:07 | First of all, this is an intermediate
level course, meaning that you're assumed
| | 00:11 | to have some experience with Maya already.
| | 00:14 | In other words, you should be able to
navigate the program, build objects and animate them.
| | 00:20 | Second of all, you should
have a pretty fast computer.
| | 00:23 | Dynamics Simulations can take quite a
while to calculate and if you've got a slow
| | 00:27 | computer it really is not
going to be much fun to work with.
| | 00:30 | Additionally, if you've got a multi-
core or multiprocessor computer, that's a
| | 00:35 | very good thing, because Maya is
multithreaded and it can take advantage of
| | 00:40 | multiple cores or multiple processors.
| | 00:43 | Finally, you need to have a healthy
dose of patience and perseverance.
| | 00:48 | It's well known that Dynamics can
be slow to calculate because they are
| | 00:51 | calculation intensive.
| | 00:53 | Also, sometimes simulations might not
work the way you want them to and you'll
| | 00:58 | need to do quite a bit of detective
work to try to figure out what the problem
| | 01:02 | is. However, once you've got some
experience under your belt, you can usually get
| | 01:06 | the results that you want, and it will
almost always be faster to do that than
| | 01:11 | to animate an entire scene by hand.
| | 01:14 | And those are just some of the
prerequisites before we begin our journey
| | 01:17 | into Maya Dynamics.
| | Collapse this transcript |
| Using the exercise files| 00:00 | We're almost ready to start
working with Maya Dynamics.
| | 00:03 | I just want to mention at the top that I
have slightly hot-rodded the Maya interface.
| | 00:08 | Not a lot; you'll certainly be
able to find your way around.
| | 00:11 | The main difference you'll see is
that I'm using black text on a white
| | 00:15 | background, and the default interface of Maya
is currently white text on a black background.
| | 00:22 | And to me, that's more difficult to
read and it just slows me down. Therefore,
| | 00:26 | I'm using the old-school black text.
| | 00:29 | Now I'm not going to cover how to
set up Maya for that interface in this
| | 00:34 | training course, however I did cover it in a
previous training course which is Maya 2011:
| | 00:40 | Creating Natural Environments.
| | 00:42 | And in fact there are two movies Setting Up
the Exercise Files and Setting Up the Mac.
| | 00:48 | The other thing I want to mention is
that if you are a Premium subscriber to
| | 00:52 | lynda.com then you can download the
Exercise Files for the course and once
| | 00:57 | you've done that you'll need to point Maya at
that project folder, and that's a simple process.
| | 01:03 | Of course, we can go to the
File menu and choose Set Project.
| | 01:07 | And I've got the Exercise Files here on
my Desktop so all I need to do is just
| | 01:11 | select that and click Set.
| | 01:13 | Then when I go to Open a Scene
it will take me directly to that
| | 01:18 | Exercise_Files>Scenes folder and these are
all the Maya ASCII scene files for the course.
| | 01:24 | If you're not a premium subscriber
to lynda.com and you don't have the
| | 01:28 | Exercise Files, then I recommend
that you create a project folder for the
| | 01:33 | course, that way you can put all
the assets in that one project folder.
| | Collapse this transcript |
|
|
1. Building a SimulationUnderstanding the rigid body solver| 00:00 | Let's take a moment just to
understand the basic concepts of Maya's Rigid
| | 00:05 | Body Simulation System.
| | 00:08 | It's a physics-based simulation that's
designed to animate objects that are near
| | 00:14 | the scale of the human body.
| | 00:17 | It wouldn't work well for things that are the
size of an atom or the size of a planet.
| | 00:22 | It's very useful for calculating
collisions and other physics-based simulations
| | 00:27 | that would be too difficult to animate by hand.
| | 00:30 | And when they say, "rigid body," they
mean that quite literally. This type of
| | 00:34 | simulation only works with objects that don't
change shape over the course of the animation.
| | 00:41 | So in other words, no deforming
surfaces are allowed: only objects that
| | 00:46 | don't change shape.
| | 00:47 | You can use polygons or NURBS to build
your R0igid Body Objects, but you will
| | 00:52 | need to keep the level of detail down very
low-- in fact, much lower than you're used to.
| | 00:59 | Because in fact this Rigid Body
Simulation System within Maya dates back
| | 01:03 | actually to the very earliest days of Maya,
and because of that, it has some limitations.
| | 01:10 | We will have to work around those
limitations as we go forward, and to actually
| | 01:14 | build and construct our scenes so that
we don't overload our system and that
| | 01:19 | we'll actually be able to see a dynamic
playback in our viewports in real time.
| | 01:25 | Again, the polygon count or vertex
count in the case of NURBS will need to be
| | 01:29 | kept very, very low.
| | 01:32 | As always your mileage may vary.
| | 01:34 | Attribute values may be different.
| | 01:36 | In other words, I may put in the value
of 100 but on your system with your
| | 01:41 | version of Maya and your scene-- even
if it's the same scene-- you may actually
| | 01:46 | have to use different attribute
values to get a similar result.
| | 01:50 | But I'm here to show you the ropes to
lead you through all those difficulties so
| | 01:55 | that hopefully you will have some good
results with your dynamic simulations
| | 02:00 | using the Maya Rigid Body Solver.
| | Collapse this transcript |
| Setting animation preferences| 00:00 | When working with Dynamics in Maya, you
have got to set up your preferences just
| | 00:04 | in a certain way so that your
simulation will play back properly.
| | 00:08 | We need to get that sorted out before
we even begin to think about building
| | 00:12 | anything or making it move.
| | 00:13 | I am going to go ahead and play my
simulation here and it seems to be playing
| | 00:18 | okay and it seems to be a bit slow,
but it is playing and it's fine, but I'm
| | 00:24 | just going to take the precaution of
setting my preferences, so that there will
| | 00:27 | be no unexpected negative
results later down the road.
| | 00:30 | I'm going to go into the Window menu to
Settings/Preferences>Preferences and go
| | 00:36 | into the Time Slider section and
you'll see here in the Playback section, we
| | 00:41 | needed to just tweak
these settings a little bit.
| | 00:44 | I like to view the animation in all the
viewports, not just the Active view, so
| | 00:49 | I'm going to activate Update View in All.
| | 00:51 | But more importantly down here, we've
got our Playback Speed, and the default is
| | 00:57 | to play every frame with no
limit on the maximum speed.
| | 01:01 | What we need for Dynamics is a
slightly different variation on this.
| | 01:06 | We do want the Playback Speed to be
"Play Every Frame", but we don't want to
| | 01:12 | exceed the current time base-- which is
actually 24 frames a second currently.
| | 01:18 | In a lightweight scene, your
simulation may actually run faster than normal
| | 01:24 | unless you activate Max
Playback Speed>Real-time.
| | 01:29 | Playback Speed>Play Every Frame means
that literally Maya will not skip frames
| | 01:33 | when it's doing the simulation.
| | 01:35 | It will play frame 1, 2, 3, 4, 5 and it
won't skip frames in order to keep the
| | 01:42 | overall frame rate of 24 frames a second.
| | 01:45 | This is very important because Maya's
Dynamics are so-called "history dependent."
| | 01:51 | What that means is that what happened
on any given frame is directly dependent
| | 01:56 | on what happened exactly one frame before that.
| | 02:01 | In other words, on frame 10, I need to
have information for what happened on frame 9.
| | 02:07 | And if we skipped frames
then that information is lost.
| | 02:11 | We can never skip frames in a simulation.
| | 02:14 | The simulation will just simply
break if we allow that to happen.
| | 02:18 | The Playback Speed must be at Play Every
Frame to make sure that we don't skip any frames.
| | 02:23 | Additionally, we don't want to exceed the
time base of-- in this case-- 24 frames a second.
| | 02:29 | Click Save.
| | 02:31 | By the way, there is a faster
way to change the Playback Rate.
| | 02:35 | You can just simply right click on your
Timeline and choose Playback Speed, here
| | 02:40 | we go, Play Every Frame, Max Real-time,
and that's the setting that you always
| | 02:45 | need to have when working
with Dynamics, 100 percent of the time.
| | 02:50 | Finally, I also want to enable the
Frame Rate in my viewports and I need to do
| | 02:55 | that so I'll know if it's
playing back too fast or too slow.
| | 02:59 | I'll simply go up into the Display menu
and choose Heads Up Display>Frame Rate.
| | 03:05 | And once that's on, I'll see in the
lower right-hand corner of each window a
| | 03:09 | frames per second readout.
| | 03:12 | I'm currently getting about
seven or eight frames a second.
| | 03:17 | This Frame Rate readout here is
actually only reliable in a full screen window.
| | 03:23 | So I'll hover my mouse over here and tap
the Spacebar and make that window bigger.
| | 03:28 | And now I'm pretty sure that this
is the actual Frame Rate I'm getting.
| | 03:34 | It does vary depending upon how
close the objects are to one another.
| | 03:39 | So we've set our Preferences, I'm just
going to go ahead and choose File>Save
| | 03:43 | Preferences, to make sure that
that's stored for the next exercise.
| | Collapse this transcript |
| Choosing a scale convention| 00:00 | Before we even begin to think about
building a Dynamic Simulation, we have to
| | 00:06 | adopt a scale convention.
| | 00:08 | That's universal for all Dynamics,
not just Rigid Body Dynamics.
| | 00:12 | Before we animate it, before we even
build models, we need to think about how
| | 00:16 | big they need to be.
| | 00:18 | If your objects are built at the
correct scale, then your Dynamic Simulation
| | 00:22 | will run accurately.
| | 00:25 | If they're built to a different scale,
you'll get a wildly different result.
| | 00:29 | You need to make sure you do this properly in
order to get good results in your simulation.
| | 00:34 | Of course, you can tweak it after
you've made it physically accurate.
| | 00:39 | That's a good workflow to follow.
| | 00:41 | To make things physically accurate--
how do we do that in the first-place?
| | 00:45 | We have to build our scene to a scale
convention and I've got three examples here.
| | 00:50 | I have got my bowling pins at 1:1
scale such that each bowling pin is about
| | 00:56 | 40 centimeters tall.
| | 00:57 | That's a 1:1 scale model.
| | 00:59 | Then I've got a 1:10 scale model where
each bowling pin is an order of magnitude
| | 01:05 | smaller, about 4 centimeters in height.
And right here at the origin, I've got an
| | 01:11 | itty-bitty teeny tiny set of bowling
pins where each one is only about 0.4
| | 01:17 | centimeters in height and these
are built at a scale of 1:100th.
| | 01:22 | So why would we need this?
| | 01:24 | Why wouldn't we just go ahead
and build everything at 1:1 scale?
| | 01:27 | That seems like an obvious thing to do.
| | 01:30 | In a lot of programs that is exactly
what you would do, but Maya is not that
| | 01:34 | program, at least not always.
| | 01:36 | Maya wants to actually make you
build your scenes to 1:100th scale.
| | 01:43 | Scale in Maya is not
straightforward and it doesn't make a lot of sense
| | 01:47 | compared to some other programs, but I
am going to show you how it works and we
| | 01:52 | will figure it out.
| | 01:53 | I am going to go into
the Window menu and go into
| | 01:56 | Settings/Preferences>Preferences, and
go directly to the Settings section and
| | 02:03 | you'll see the Working Units.
| | 02:05 | Working Units is currently set to
Centimeters and that is the default.
| | 02:09 | With the default grid settings,
what I will see here is I've got a grid
| | 02:13 | that's 12 centimeters from center to edge and
I've got subdivisions every one centimeter here.
| | 02:19 | Well, this is actually kind of weird,
because the Dynamics engine thinks by
| | 02:26 | default that each one of these grid
units is a meter, not a centimeter.
| | 02:32 | So you've chosen Centimeters as your
Working Units, but the Dynamics engine
| | 02:39 | always assumes that your
world is built to 1:100 scale.
| | 02:45 | If I change this to some other setting
like Inch or Foot, that doesn't change
| | 02:51 | the size of objects in the scene.
| | 02:53 | I am just going to put it back
to Centimeter and click Save.
| | 02:57 | What matters is not what you've
chosen in that Preference dialog, but what
| | 03:02 | matters in fact is what is the
absolute size of the objects.
| | 03:07 | So if you choose centimeters as your
units of measurement, that's an easy-breezy
| | 03:12 | solution; you just build
your objects at 1:1 scale.
| | 03:16 | However, if you do it at 1:1 scale as
I've done here, then we'll have to take
| | 03:20 | some extra steps, for example
the gravity won't be strong enough.
| | 03:24 | However, if you build your scene at 1:
100th scale, if you make an itty-bitty
| | 03:29 | teeny-tiny version of your scene, then
Maya will correctly calculate the physics
| | 03:36 | simulation for that.
| | 03:37 | I am going to be building my scenes
at 1:1 scale, but going forward in your
| | 03:42 | own scenes, you can adopt that
convention of 1:1 and then you will need to
| | 03:47 | increase the strength of gravity or you
could build your scenes at 1:100th scale
| | 03:52 | and the workflow for that is leave
the Working Units as centimeters, but
| | 03:58 | literally just pretend in your mind
that they're meters, because that's what
| | 04:02 | the Dynamics engine is doing.
| | 04:04 | That seems really counterintuitive, and it is.
| | 04:07 | But that's how you have to do it, if you
want to build it 1:100th scale, but the
| | 04:12 | main thing is you need to adopt a
convention in advance and you need to know
| | 04:16 | what that convention is, and the
standard ones are 1:100th, 1:10th, and 1:1.
| | Collapse this transcript |
| Laying out the scene| 00:00 | Let's take a quick look at laying
out a scene for a Dynamic Simulation.
| | 00:05 | In the vast majority of scenes most of the
geometry does not participate in the simulation.
| | 00:11 | Only things that are actually going to
be touching each other and colliding are
| | 00:15 | going to need to be dynamic and
everything else you probably just want to put
| | 00:18 | that on the layer and
reference it to make it untouchable.
| | 00:22 | That's what I will do.
| | 00:23 | I am going to open up the Window>Outliner
and you'll see down here I've got some groups.
| | 00:29 | I've got the alleyGroup which is the
one lane that's going to be dynamic and
| | 00:34 | then I've got a bunch of other groups here.
| | 00:36 | I have selected all those just by
dragging my mouse across them and in the
| | 00:40 | Channel Box, in the Layer Editor here,
I am going to click the button to create
| | 00:45 | a new layer and add the
selected objects. And there it is.
| | 00:48 | They are in Layer 1 and I can
toggle that visibility on and off.
| | 00:51 | I will double-click that layer and
rename it roomLayer, and click Save.
| | 00:58 | I just want to add all the
other non-dynamic geometry as well.
| | 01:01 | I've got a box for the room.
| | 01:03 | I'll hold down Ctrl+Shift and I will
select some of these other elements here
| | 01:07 | that are important for rendering, but
not for the Dynamics, and then right-click
| | 01:12 | on my roomLayer and add the selected objects.
| | 01:14 | I can toggle that on and off.
| | 01:16 | You will see I've done
that for the lights as well.
| | 01:19 | I will just click here in this box a
couple of times until I see the letter R,
| | 01:25 | meaning that, that layer is currently
referenced and I can't accidentally select
| | 01:29 | it or do anything to it.
| | 01:31 | I just want to make sure that I've
placed all the non-dynamic objects onto a
| | 01:37 | layer so that I can quickly reference
or hide them in order to focus on what's
| | 01:42 | important in this case, which
are of course, the dynamic objects.
| | Collapse this transcript |
| Modeling proxy objects| 00:00 | We are still in a bit of preparation
mode, getting our scene ready in order to
| | 00:04 | apply Rigid Body Dynamics.
| | 00:06 | As I mentioned it in an earlier movie,
there are some limitations to the polygon
| | 00:10 | count for Maya's Rigid Bodies.
| | 00:13 | You can't just create an object of any
arbitrary level of detail and expect that
| | 00:17 | to calculate as a Dynamic Simulation.
| | 00:21 | In fact, even just moderate levels of
detail are going to completely overwhelm
| | 00:25 | the Rigid Body Solver.
| | 00:28 | In order to get good results, what you often
need to do is model so-called "proxy objects."
| | 00:34 | A proxy object is a very low level of
detail object and that proxy object will
| | 00:39 | be the one that has the Dynamics
applied to it and there will additionally be a
| | 00:44 | high level of detail object which will
be renderable and the renderable
| | 00:48 | object can be constrained to the proxy.
| | 00:51 | That way you get the best of both worlds.
| | 00:53 | The proxy object calculates the Dynamics.
| | 00:55 | It's very simple and it's fast.
| | 00:58 | The high level of detail object looks good.
| | 01:01 | For any Dynamic Simulation, you're
going to have to think about this.
| | 01:05 | You may need to build
multiple versions of your object.
| | 01:09 | So I am just going to run through the
process of very quickly making a bowling
| | 01:13 | pin using Revolve.
| | 01:14 | If you have never used Revolve before,
it's not hard, it's quite simple.
| | 01:19 | I want to go into my side view
here and just display the grid.
| | 01:24 | The shortcut to turn that Panel toolbar
on and off is Ctrl+Shift+M. So here in my
| | 01:31 | side view, I want to get
ready to make a bowling pin.
| | 01:35 | So I will tap the Spacebar and zoom out
a little bit with the Wheel and I know
| | 01:40 | that it's going to be about 40 centimeters tall.
| | 01:42 | Well, it's hard for me to count those directly.
| | 01:46 | I would just want to go into the Grid
Options, Display>Grid Options and I am
| | 01:51 | going to set my Length and Width here to
100 centimeters, a Grid line every 10
| | 01:58 | centimeters, and then subdivide it by 10,
and additionally, I want to choose a
| | 02:04 | different color for the Grid
lines and Subdivision lines.
| | 02:08 | With these settings, basically, I'll
get a major Grid line every 10 centimeters
| | 02:13 | and a minor Grid line or a Subdivision
line every 10 divided by 10 or every 1
| | 02:19 | centimeter and if you scroll down a
little bit too, you can also turn on numbers
| | 02:23 | on the axes if that helps you visualize.
| | 02:25 | Now I click Apply and click Close.
| | 02:28 | Now I can see very clearly, okay, this is 0
centimeters, 10 centimeters, 20, and so on.
| | 02:34 | I want to make a Revolve and to
do that I'll use a NURBS curve.
| | 02:39 | I also want to Snap to Grid while I am at it.
| | 02:42 | I will turn on Snap to Grid up here and I will
go to Create menu and choose the CV Curve Tool.
| | 02:49 | And for a Revolve, it's really important
that the first point and the last point
| | 02:53 | have to be exactly on that center
axis as seen in the side view.
| | 02:58 | So I am going to click a couple of times
on the origin here to make two points there.
| | 03:04 | You want to do that really slowly;
| | 03:06 | don't go too fast, you want to
click super slow, once and twice.
| | 03:11 | If you click too fast, then Maya
is just going to interpret that as a
| | 03:15 | double-click, but if you do two slow clicks,
then it'll interpret that as two points.
| | 03:20 | All right!
| | 03:20 | So I am going up here and up at the top
once again I am going to click once and
| | 03:25 | then wait a heartbeat and
then click a second time.
| | 03:29 | Once I've drawn that curve, I'll press Enter.
| | 03:32 | To change the shape of the curve, I'll
right-click and go into Control Vertex
| | 03:36 | mode and move those points
around with the Move tool.
| | 03:40 | Now that I've actually got it
blocked out, I can turn the Snapping off.
| | 03:45 | Depending upon what object you are
building, of course, you will need different
| | 03:48 | methods to build it.
| | 03:50 | The Revolve is obviously the best
choice for a bowling pin, because it's
| | 03:54 | really symmetrical.
| | 03:57 | So there's my curve.
| | 03:57 | I will go ahead and go back to Object Mode,
select that curve, and I want to make a Revolve.
| | 04:05 | To do that, I'll go to the menu set
and choose Surfaces and then in the
| | 04:11 | Surfaces menu I want to choose
Revolve, but I'll go into the Options.
| | 04:16 | I want to make polygon objects here so
that I can really precisely control the
| | 04:21 | level of detail and in the Revolve
Options-- just make that a little bit bigger
| | 04:27 | here-- I want to output to Polygons.
| | 04:30 | So here is Output Geometry,
so I will choose Polygons.
| | 04:34 | Additionally, I want to do Quadrilaterals,
that's just going to be more efficient.
| | 04:38 | And I can play around with some of
this stuff later, but I think for now I'm
| | 04:43 | just going to choose
General and I will click Revolve.
| | 04:46 | Now I don't have much here.
| | 04:47 | It actually is a Revolved object,
but I will just need to go into the
| | 04:52 | nurbsTessellation settings.
| | 04:53 | I will tap the Spacebar so I can go
back out to my Perspective view and just
| | 04:58 | dolly back a little bit.
| | 04:59 | With that object selected, I'll hit
Ctrl+A to get the Attribute Editor and I
| | 05:04 | want to find the nurbsTessellate node.
| | 05:06 | Here we go, nurbsTessellate1.
| | 05:09 | I just want to go into the Advanced
Tessellation Options and play around with them.
| | 05:14 | General Tessellation, I just
want to increase the numbers here.
| | 05:19 | Now of course, this is still live.
| | 05:21 | In other words, if I change the shape of
my curve, I'll change the shape of this
| | 05:25 | bowling pin for the Revolve surface.
| | 05:29 | So those are not quite the right
proportions, but that's okay, because I can
| | 05:32 | just get in a little bit closer on that
curve, select it, and then right-click,
| | 05:36 | and choose Control Vertex once again.
| | 05:38 | It's important that I am manipulating
the control vertices on the curve and not
| | 05:44 | the points on the Revolve.
| | 05:46 | It's also very important that I
cannot make this curve overlap itself.
| | 05:51 | So that's not the world's greatest bowling pin,
but that gives you an idea of the process.
| | 05:56 | So that would be my high level of detail.
| | 05:59 | I know you will look at that and you
will think, well, that's not really very
| | 06:01 | high level of detail.
| | 06:02 | That looked kind of blocky by my
standards, but it's sufficient for rendering.
| | 06:07 | Now I will go back and I will make another one.
| | 06:10 | I want to be in Object Mode to do that.
| | 06:12 | So I will right-click on that curve and
choose Object Mode and select the curve
| | 06:16 | and I will make another Revolve, but
just use lower settings for that one.
| | 06:20 | Surfaces>Revolve, go back to the Options.
| | 06:23 | In fact, I will leave all of this the
same, click Revolve and then the second
| | 06:27 | one that's been built here revolveSurface2.
| | 06:30 | I will go to its Attributes, Ctrl+A,
and increase this number up, but I just
| | 06:35 | need it to be a lot blockier than
the full level of detail version.
| | 06:39 | So you can see that I've got two of them now.
| | 06:42 | I've got one that's really blocky,
and I got one that's somewhat smooth.
| | 06:49 | That's the basic principle.
| | 06:50 | I need to have two versions of my model;
the blocky one here is going to be the
| | 06:55 | one that's going to have the Dynamics
applied to it, and the nice pretty one is
| | 07:00 | the one that we will actually
render-- Ctrl+Z to undo that.
| | 07:04 | Once you've got your levels of detail made,
then the next step is to connect them.
| | 07:09 | You can either parent them or even
better, as I'll show you in the next movie,
| | 07:13 | we will use a parent constraint.
| | Collapse this transcript |
| Constraining renderable objects to proxies| 00:00 | Let's look at organizing our proxy objects.
| | 00:03 | Once again, we want the low level of
detail to be dynamic and the high level of
| | 00:07 | detail to be renderable.
| | 00:09 | I need two versions of each object to do that.
| | 00:12 | And I can either parent them or constrain them.
| | 00:15 | Let's look at parenting first.
| | 00:16 | I'll open up Window>Outliner and
scroll down a bit so you can see what I have
| | 00:22 | done, I have got pin_low_res_1, pin_hi
_res_1, 2 and 2 and so on and in fact
| | 00:30 | the difference between these is even
more dramatic than in the demonstration I
| | 00:34 | gave in the last movie.
| | 00:35 | If I just move this guy over to the
side, you can see that it's really quite
| | 00:39 | blocky and the high LOD
is considerably smoother.
| | 00:43 | Now I'll Ctrl+Z to undo that,
put those back over one another.
| | 00:48 | One way I could do this once
again is just to simply parent them.
| | 00:51 | I'll select the high LOD and then Ctrl+
select the low LOD and hit the P key or
| | 00:59 | else just choose Edit>Parent and now
the low level of detail pin is the parent
| | 01:06 | and the high LOD is the child, so if I
select the low one and move it of course
| | 01:11 | the high LOD will move
with it, Ctrl+Z to undo that.
| | 01:15 | That seems pretty simple, but there's a
problem with this, when I go to Render,
| | 01:20 | --go ahead and click Render-- and this is
going to render in Maya hardware, so it
| | 01:23 | can render really quickly, you can see
that low level of detail object there; I
| | 01:27 | really don't want that.
| | 01:29 | We could go into the Shape Properties
for each one of these low LODs and make
| | 01:33 | them non-renderable.
| | 01:36 | I'll hit Ctrl+A to open up the
Attribute Editor and what you're looking for is
| | 01:40 | the Shape node and the Render Stats section.
| | 01:43 | You'll need to open that up and
you'll need to turn all this stuff off.
| | 01:47 | We don't want Shadows, you don't
want it to be Visible in Reflections or
| | 01:51 | Refractions and most importantly you
want to turn off its Primary Visibility.
| | 01:57 | With all those switches turned off,
then that low LOD model will never render.
| | 02:01 | I'll go ahead and do another test
render and you can see it's as if it
| | 02:05 | wasn't there at all.
| | 02:06 | Well, that's kind of tedious because
you'll have to do that for each object.
| | 02:10 | I am going to undo what I've done, I'm
going put all these back on again and I
| | 02:15 | am going to unparent this, so I'll
select that, I'll say Edit>Unparent or just
| | 02:21 | Shift+P and now I am back where I was,
I have got low_res_1 and hi_res_1, just
| | 02:28 | move that back up there with a middle mouse.
| | 02:31 | So instead of parenting, I can use
Constraints and that's actually better and
| | 02:37 | the reason is that if I use a
constraint, then I can easily toggle the
| | 02:41 | visibility for all of the low LODs
and all the high LODs independently.
| | 02:48 | In other words in my viewport, I can
choose to see just only one of those or both.
| | 02:52 | To make a constraint, I want to be in
the Animation menu set and I want to
| | 02:57 | select the thing that's going to be
the constrainer or the sort of leader
| | 03:02 | first and I want to select the thing
that is going to be constrained or the
| | 03:07 | follower second, which is the opposite of what
you would do for a parent-child relationship.
| | 03:13 | Again, I want to select the leader
first and that's going to be the low LOD and
| | 03:18 | then I'll Ctrl+select the follower
which is the high LOD and I go up to the
| | 03:24 | Constrain menu and choose Parent Constraint.
| | 03:27 | Now you might want to go into the
options just to be sure and reset them.
| | 03:32 | We just want to make sure we're
constraining in all axes and click Add and
| | 03:38 | that's that. It's done.
| | 03:39 | If I select the low-res pin now, I can move
it and the high-res pin is moving with it.
| | 03:45 | You don't see a parent-child
relationship here, but if you open up the high-res
| | 03:50 | object you'll see there's a
constraint node inside there, so that's the
| | 03:54 | indicated, there's a constrained-in effect.
| | 03:56 | If I need to remove that, of course
I can just select it and press the
| | 04:00 | Delete key on my keyboard.
| | 04:01 | So I could go through that
process and do that for all these.
| | 04:05 | Select the leader, then the follower
and I can actually just press the G key on
| | 04:10 | my keyboard and that will perform the
most recent command again. Done. I'll just
| | 04:16 | go down the line, use the
Ctrl key, select, press G.
| | 04:23 | So I think I'm all right here.
| | 04:24 | I should probably test my work and make sure.
| | 04:27 | I'll select the low LOD of each one
and make sure that the high LOD is
| | 04:31 | actually following along.
| | 04:33 | It takes extra time to do so, but that
time will be saved in all the mistakes
| | 04:38 | that you're not going to make,
because you've tested it.
| | 04:42 | Now we're ready in our next movie
to actually put these on different
| | 04:46 | display layers.
| | Collapse this transcript |
| Organizing display layers| 00:00 | We're almost ready to actually
create our Dynamic Simulation;
| | 00:04 | we just have a little bit more setup to do.
| | 00:06 | I know that this is kind of tedious to
have to go through all that, but if you
| | 00:10 | don't create proxy objects you simply
won't be able to meaningfully create any
| | 00:15 | kind of good looking simulation.
| | 00:17 | So I have created the constraints. All I
need to do now is just place them onto
| | 00:23 | display layers so that I
can toggle their visibility.
| | 00:25 | I'll go back into my Window>Outliner
and I'll select all the low res pins
| | 00:30 | those are going to be the dynamic
pins and I go into my Display editor here
| | 00:35 | and click on the button to create a
new layer containing the selected objects
| | 00:40 | and it's called Layer 1. I'll double-click on
Layer 1 and I'll call that one dynamicsLayer.
| | 00:48 | Because we've used constraints here
instead of a direct parent-child link, we
| | 00:53 | can toggle the visibility of all those
objects without affecting the high LOD objects.
| | 01:00 | If it were a direct link then when
I click here to hide those low LOD
| | 01:06 | objects, the high LOD objects would inherit
that visibility, because they would be children.
| | 01:12 | So again, we're not using a parent-
child relationship, we're using constraint,
| | 01:15 | so that we have the freedom to toggle
the visibility of those two sets of pins
| | 01:20 | independently of one another.
| | 01:22 | I'll select these high LOD pins and
put those on a layer as well, I'll make
| | 01:27 | a new layer, Layer 1 once again,
double-click that and I'll call that one
| | 01:32 | pins_highLOD_Layer.
| | 01:38 | Now I have the ability to turn these
on or off at will and of course when I
| | 01:43 | render I want to have these visible
and when I'm animating I may want to have
| | 01:48 | those hidden and only see the dynamic objects.
| | 01:51 | Very good. We've got our scene set up
and we're ready to create some Dynamics.
| | Collapse this transcript |
| Creating passive rigid bodies| 00:00 | Now we are ready to start simulating.
| | 00:03 | We want to create so-called "passive
rigid bodies" for the ground plane and
| | 00:08 | any collision objects.
| | 00:10 | A passive rigid body is one that will collide
with other rigid bodies, but it is immobile.
| | 00:18 | It will stay static.
| | 00:19 | It could actually have keyframes placed
on it unlike an active rigid body which
| | 00:24 | is going to be directly under
the control of the simulation.
| | 00:28 | In general, the passive rigid bodies
will be things like the ground plane or in
| | 00:32 | this case the backplane
of my bowling alley lane.
| | 00:36 | So, to create a passive rigid body,
you simply select an object like this
| | 00:40 | backplane here, and you want to go
into a menu set up here called Dynamics.
| | 00:45 | Not nDynamics, that's Nucleus Dynamics.
| | 00:49 | What we want this time in fact are
the old-school plain vanilla Dynamics.
| | 00:56 | And with that object selected, I will
simply go up here to the menu that says
| | 01:00 | Soft/Rigid Bodies, and I want to
choose Create Passive Rigid Body.
| | 01:07 | Now two things have happened.
| | 01:08 | Number one, a node has been added to
that object: it's a Rigid Body node.
| | 01:14 | Go over here to the Channel box and
scroll down a little bit, and you'll see
| | 01:18 | there it says Rigid Body1.
| | 01:19 | And if I click on that to open it up,
you'll see it has a bunch of properties,
| | 01:23 | things like mass and friction and so on.
| | 01:26 | So that Rigid Body node has
been created for that one object.
| | 01:30 | Additionally, a Master Rigid
Body Solver node has been created.
| | 01:35 | That's the global settings,
basically the quality settings for the entire
| | 01:40 | simulation and all the objects within it.
| | 01:43 | If I scroll down a little bit further
in the Channel box, you will see now at
| | 01:47 | the bottom, there is a Rigid Solver node.
| | 01:49 | And I can open that up just to show you
that it's got some properties in here.
| | 01:53 | We really won't need to change those properties;
| | 01:56 | they're fine as they are.
| | 01:57 | I just wanted you to see
that that Rigid Solver exists.
| | 02:00 | And once again, that's the master
controller for all of the rigid body
| | 02:05 | objects in the scene.
| | 02:07 | We could actually have multiple
Rigid Solver nodes per scene, but we don't need
| | 02:12 | that in this case. We're
fine with just having one.
| | 02:15 | I just want to go around and create
passive rigid bodies for the rest of the
| | 02:19 | geometry that the pins might collide with.
| | 02:22 | And that's these two backplanes here, hold
down the Shift key to select some more,
| | 02:28 | the gutter here and the gutter here,
and of course the playing surface.
| | 02:34 | So I've got everything selected that
wants to be a passive rigid body, and I
| | 02:39 | just go up to Soft/Rigid
Bodies>Create Passive, done.
| | 02:42 | You'll notice by the way that for
any object that has a Rigid Body node
| | 02:48 | attached, you'll see a little x at
the center of the object, and that's
| | 02:52 | it's center of mass.
| | 02:53 | If I hit the 4 key on the keyboard so
we can see wireframes, you can see that a
| | 02:59 | little bit more clearly, there's a
little x in the center of each one of these.
| | 03:03 | We'll come back to that later
when we talk about animating.
| | 03:06 | But, for now, I just wanted you to
know that, that's what that little x was.
| | 03:10 | That's an indicator that there is a
Rigid Body node attached to that object.
| | 03:14 | Finally, if I select the object and
look at its transforms, Translate and
| | 03:18 | Rotate, you'll see, in this
case, they are all in yellow.
| | 03:22 | Ordinarily, that means that there's an
incoming connection, and that is the case
| | 03:26 | here. In fact, the Position and Rotation
channels are going to be controlled by
| | 03:31 | the simulation or by the Rigid Solver node.
| | 03:34 | However currently, they've been made passive.
| | 03:37 | So although these are showing up as if
they're under the control of something
| | 03:40 | else, they're actually not under the
control of anything right now, and they
| | 03:44 | could in fact be keyframed if needed.
| | 03:46 | So, don't let that throw you off. Just
because those are yellow there, doesn't
| | 03:50 | mean that you can't move or animate
a passive rigid body because you can.
| | 03:56 | In the next movie, we'll create active
rigid bodies which will actually move.
| | Collapse this transcript |
| Creating active rigid bodies| 00:00 | Next, we'll create active rigid bodies.
| | 00:03 | An active rigid body can actually move
according to the laws of physics, whereas
| | 00:07 | a passive body will remain
static or could be keyframed.
| | 00:11 | I will open up the Outliner once again,
Window>Outliner, and I want to select
| | 00:16 | all the low LOD pins, and I also
want to select the bowling ball.
| | 00:22 | It's just a plain old ordinary
polygons sphere, nothing fancy about it.
| | 00:26 | I can hold down Shift and select that.
| | 00:28 | I'll just add the active
rigid bodies all in one go.
| | 00:32 | Go up here to Soft/Rigid Bodies and
you will see Create Active Rigid Body.
| | 00:38 | And in fact, it creates the exact
same node as a passive rigid body.
| | 00:42 | The only difference is one switch
which is whether it's active or passive.
| | 00:46 | I'm going to go ahead and add this,
each one of these now has a Rigid Body
| | 00:52 | node attached to it.
| | 00:53 | So if I select the bowling ball, you'll
see it's got Rigid Body17 attached to it.
| | 00:58 | And they're all connected
to the same Rigid Solver.
| | 01:03 | Nothing much is going to happen just
yet, they've been made active, but they
| | 01:07 | won't move unless there's
some force applied to them.
| | 01:11 | We'll do that in the next movie.
| | Collapse this transcript |
| Adding a Gravity field| 00:00 | A Dynamic Simulation won't do anything if
there are no forces acting in the world.
| | 00:05 | I have correctly set up my scenes, so
that the collision objects have all been
| | 00:09 | made passive and my low level of
detail dynamic objects have all been made
| | 00:15 | active but again, nothing will happen
if there are no forces in the world.
| | 00:20 | And I can apply forces in
different ways. One is to use a Field.
| | 00:25 | In Maya Language a Field is an
object that affects dynamic objects.
| | 00:32 | You can add gravity,
| | 00:33 | you can add wind, or whatever you want
in order to influence the behavior of
| | 00:38 | the dynamic objects.
| | 00:39 | The Maya Rigid Body Dynamics
Solver does not have gravity by default.
| | 00:44 | So we will need to add that.
| | 00:46 | I can select one or more
objects and add gravity.
| | 00:49 | Let's just do the bowling ball first.
| | 00:51 | I've got that selected. Maybe I will
move it up a little bit so we can see
| | 00:56 | the effect of gravity.
| | 00:57 | With it selected, I'll go into my
Dynamics menu set and Fields and you will see
| | 01:02 | they are bunch of them there and these
are really cool by the way, because the
| | 01:06 | Fields will work with other types of
Maya Dynamics as well; if you use nCloth or
| | 01:12 | Fluids or nParticles-- all kinds of stuff--
the fields will affect all of them so
| | 01:18 | it's not just for a Rigid Body Dynamics.
| | 01:20 | So I am going to click on Gravity and I
do get a Gravity field created and you
| | 01:26 | can see it here in the Outliner and
you can see that it's currently selected.
| | 01:30 | It's placed at the Origin right now.
| | 01:33 | And we go out to a top view, tap the
Spacebar here and go to the Origin you can
| | 01:39 | see there is my Gravity field.
| | 01:40 | It looks like three little arrows pointed down.
| | 01:43 | I could position that anywhere in the
scene and it won't affect the gravity.
| | 01:47 | I could even rotate it or scale
it and it will make no difference.
| | 01:50 | I am just going to place it up here close to
the action, so that it will be nearby at hand.
| | 01:56 | Now I'll maximize that
view again with the Spacebar.
| | 02:00 | I'll go ahead and press the Play button,
but before I do, I want to double-check
| | 02:04 | and make sure that I am playing at the
right speed, remember this once again.
| | 02:07 | I have got to check to make sure
it's Play Every Frame Max Real-time.
| | 02:11 | I will right-click and choose Playback
Speed>Play Every Frame, Max Real-time.
| | 02:18 | So my Timeline is set up.
| | 02:19 | Now I have also got a Frame Rate down
here-- remember I turn that on in the
| | 02:24 | Display menu, Heads Up Display> Frame
Rate-- so that needs to be on as well.
| | 02:28 | Rewind and play back and you will see
my ball starting to fall, but wow it sure
| | 02:33 | is falling slowly and according to my
Frame Rate readout it's saying that I'm
| | 02:38 | playing back at about 24 frames a second.
| | 02:41 | But with 60 frames in my timeline, the
ball is still not reaching the ground
| | 02:45 | even though it's falling for nearly 3 seconds.
| | 02:48 | This is a scale issue.
| | 02:50 | This is precisely what I was talking about
in an earlier movie when we discussed scale.
| | 02:55 | Maya is assuming that my world is
built at 1:100th scale.
| | 03:00 | So Maya is assuming that my bowling pins
are 40 meters tall, even though I built
| | 03:06 | them at 40 centimeters tall.
| | 03:10 | If you have built your world at 1:100th
then you're fine: you don't
| | 03:13 | need to change anything.
| | 03:14 | But if you've built it at any other
scale then, you will need to change things
| | 03:18 | like the strength of gravity
and that's what I need to do here.
| | 03:22 | I'll select that Gravity field and I
want to find its attributes, so I will
| | 03:27 | just go into the Channel box and I
am looking for Magnitude, here it is.
| | 03:31 | That's the strength of the
gravity and you will see it says, 9.8.
| | 03:35 | So if you remember from physics
class if you ever took physics;
| | 03:38 | the acceleration of an object in Earth's
gravity is 9.8 meters per second per second.
| | 03:44 | That means with every second, it's
falling 9.8 meters and another 9.8 meters for
| | 03:52 | each additional second.
| | 03:53 | Faster, so it's accelerating as it falls.
| | 03:57 | This is in meters 9.8 meters but that only
makes sense if your world is built at 1:100th scales.
| | 04:04 | Again if your world is built at 1:100th
you're fine, but if it's built
| | 04:08 | at 1:1 then the
gravity is not strong enough.
| | 04:13 | The Gravity is currently now one one
-hundredth of what it needs to be.
| | 04:17 | For scenes built at 1:1 scale the
magnitude for physical accuracy should be 980.
| | 04:24 | Now you will find that if it's at a
1000 or somewhere in the vicinity of that,
| | 04:28 | it's going to look fine but
that's the technically accurate value.
| | 04:32 | So I will rewind and press Play and
that's much better and my bowling ball is
| | 04:36 | actually falling like a bowling ball, it's only
taking less than one second to hit the ground.
| | 04:42 | I also want to attach the
gravity to my bowling pins.
| | 04:45 | Because if I actually sent the ball down
the alley right now, the pins would fly
| | 04:51 | off and would not actually fall to the ground.
| | 04:53 | So they need to have gravity
attached to them as well, and there is
| | 04:56 | multiple ways of doing that.
| | 04:58 | But the easiest way is to simply
select them and select the Gravity node and
| | 05:02 | issue in menu command.
| | 05:03 | I will go into my Outliner once again.
| | 05:06 | I want to select all the low LODs.
| | 05:09 | Those are the ones that have the Rigid
Body nodes attached to them and I want to
| | 05:13 | select my Gravity node as well, so I
can Shift+Click on that and go up into the
| | 05:18 | Filed menu and choose Affect Selected
Object(s) and now the connection has been
| | 05:25 | made so that all the bowling pins
will also be under the effect of the same
| | 05:29 | gravity field and if I get in really
closely on that and play it, we might see
| | 05:35 | them drop a little bit.
| | 05:36 | Looks like I probably have to move
them up in order to see that happen.
| | 05:41 | Just that we can see the full effect,
I will just move these up a bit and
| | 05:47 | rewind and let them drop.
| | 05:49 | You can see now that in fact gravity
is affecting all those dynamic objects.
| | 05:56 | You notice by the way that I have been
rewinding every time and pressing Play.
| | 06:01 | This is really important;
| | 06:02 | you can't scrub in the Timeline for
Dynamics because it's history dependent.
| | 06:08 | What's happening on frame 30 depends
upon what happened on frame 29 and if you
| | 06:12 | are skipping around here,
it's going to go haywire.
| | 06:14 | This is a pretty simple simulation but
if you've got a heavy scene with lots of
| | 06:18 | stuff going on, what you'll find is if
you try to scrub in the Timeline then,
| | 06:23 | Maya will appear to
freeze up as if it had crashed.
| | 06:26 | In fact it's not crashed;
| | 06:28 | it's just calculating all the
frames up to where you currently are.
| | 06:32 | The only things you are allowed to
do are Rewind, Play, and step forward
| | 06:38 | one frame at a time.
| | 06:41 | I know that seems really
limiting. That's reality.
| | 06:44 | So we've got a gravity field in our
scene and next, we want to just play around
| | 06:49 | with center of mass.
| | Collapse this transcript |
| Moving the center of mass| 00:00 | Let's look at center of mass.
| | 00:02 | Center of mass is kind of like a
pivot point, in as much as it's the point
| | 00:08 | around which Transforms are calculated.
| | 00:10 | For ordinary animation hierarchy, the
pivot point is the location around which
| | 00:15 | that object will move, rotate, and scale.
| | 00:18 | For dynamic objects, the center
of mass serves the same function.
| | 00:22 | It's basically the balance point around
which an object will revolve and move.
| | 00:28 | I haven't changed the center of
mass for any of the objects in my
| | 00:32 | simulation just yet.
| | 00:35 | So I'll get in a little closer on one
of these low-res pins here and if I hit
| | 00:40 | the 4 key, I can look at the wireframe
and you can see that little x in there,
| | 00:45 | that's the center of mass.
| | 00:47 | And it's located by default sort of at the
average of all of the vertices on the object.
| | 00:55 | Sort of like if you would use Center
Pivot command, it would move your pivot to
| | 00:59 | that average location of all the vertices.
| | 01:02 | And with the default location for the
center of mass, my objects will behave
| | 01:07 | more or less accurately.
| | 01:09 | If I for example rotate my bowling pin,
so that's off kilter a little bit, hit
| | 01:15 | the 5 key, so we can see that little
bit better and press Play, you will see
| | 01:20 | that it tumbles and falls and
bounces in a more or less realistic way.
| | 01:24 | What does center of mass do?
| | 01:26 | Well, center of mass makes it so that
you could determine the center and the
| | 01:31 | center could even be outside of the
object and we can do cool things with that.
| | 01:37 | With that object selected, once again
I will hit the 4 key to look at wires.
| | 01:41 | I want to go to my Channel box and open up
that Rigid Body node if it isn't already open.
| | 01:45 | Here it is, Rigid Body, and you will see
Center of Mass X, Y, and Z and those
| | 01:52 | values are calculated relative
to the local space of the object.
| | 01:58 | If I set Center of Mass Y that means
it's going to move the center of mass
| | 02:03 | up and down relative to the object,
not up and down in the world but
| | 02:08 | relative to the object.
| | 02:10 | If I set Center of Mass Y to let's say
instead of 20 I will give it a value of 100.
| | 02:16 | Now the center of mass is actually way out
here and that's not going to look like much.
| | 02:21 | If I try to play that back then
that's going to look really strange.
| | 02:24 | That's not really a useful result.
| | 02:26 | But I could do something useful with
this. I could take that center of mass and
| | 02:29 | bring it down maybe to the bottom of
my bowling pin and by doing that I could
| | 02:33 | make it so that the bowling
pin would never fall over.
| | 02:36 | I can adjust Center of Mass just like
Channel in the Channel box, select the
| | 02:41 | name not the number and middle mouse drag.
| | 02:45 | Now you can't pick up the center of mass and
move it with a manipulator in the viewport.
| | 02:50 | This is your only way of
moving the center of mass.
| | 02:53 | It is either numerically or
through the Channel box sliders.
| | 02:57 | What I have done here is I've placed
the center of mass below the bowling pin.
| | 03:02 | Press the 5 key so we can see that better.
| | 03:04 | Rewind and press Play and here you go.
| | 03:08 | They don't fall down.
| | 03:09 | Now I can extend my Timeline a little
bit, so we can really verify then in fact
| | 03:14 | it will never fall over.
| | 03:15 | It may take a while for it to
eventually settle down, but it will
| | 03:19 | eventually settle down and that's simply
because I've moved the center of mass to the
| | 03:24 | bottom of the object.
| | 03:25 | So essentially it's heavier there and
that's the way the Weebles toys work as
| | 03:29 | well, they have got a metal weight at
the bottom of wooden egg and that metal
| | 03:33 | weight is causing it to be heavier at
the bottom, moving the center of mass down
| | 03:37 | and making it so that it will never fall over.
| | 03:40 | In this case this is sort of a special effect;
| | 03:43 | we are kind of exploiting the center of
mass to do something interesting with it.
| | 03:46 | Usually the default position is okay but it
is important for you to know where it is.
| | 03:52 | When you get into using Dynamic
Constraints you'll need to consider the center
| | 03:55 | of mass once again because that'll
be the center around which Dynamic
| | 04:00 | Constraints will be calculated.
| | 04:02 | So basically I just want to move that
back up where I had it, I will press the 4
| | 04:07 | key so I can see the wires and I will
just position that roughly in the center once again.
| | 04:11 | Maybe I will rotate my pin
back straight up. That's good;
| | 04:16 | we've got our center of mass sorted out.
| | Collapse this transcript |
| Setting an initial state| 00:00 | We want to set an initial
state for the dynamic objects.
| | 00:05 | The initial state is the position,
orientation and velocity of the object at the
| | 00:11 | first frame of the simulation.
| | 00:14 | What is it doing at the beginning of the shot?
| | 00:17 | Currently I have got all my objects in
the air and when I press Play they land.
| | 00:22 | What I want to have happen is I want
them to be fully settled down and in
| | 00:26 | contact with the floor on Frame 1.
| | 00:29 | Now you might think that one way to
do that would be to simply select your
| | 00:33 | object and just kind of move it down
until it's touching. This is not really a
| | 00:37 | good way to do this.
| | 00:38 | For one it might actually be
overlapping. If I tap the Spacebar and go out here,
| | 00:43 | you might actually be overlapping the
ground plane and if that's the case at
| | 00:48 | Frame 1 then that's going to break
your simulation completely. You can't have
| | 00:53 | objects overlapping in a Dynamic
Simulation; they just won't work properly. They
| | 00:58 | have to be separated and not touching.
| | 01:01 | You think all right, well I'll just move it
up a little bit and that way it's not touching.
| | 01:05 | Well, actually you can't see it, but
there's actually a distance between these
| | 01:09 | two at which they'll be
considered to be touching.
| | 01:13 | In other words, there might be a
tolerance of let's say 1 millimeter and if
| | 01:17 | they're closer together than 1
millimeter then Maya thinks they're touching.
| | 01:21 | They're farther away than a millimeter
than Maya thinks they are not touching.
| | 01:25 | The simple thing to do is just to set
the initial state, drop the objects on
| | 01:29 | the ground and then say boom, this is
your new start point. That's exactly what
| | 01:34 | we'll do here. So I'll just play my
simulation until everything is settled down
| | 01:40 | and for heavy scenes it may take a
long time to play through. You may need to
| | 01:45 | rewind and actually step through one frame
at a time, until your simulation settles down.
| | 01:53 | Again, that's for really heavy
scenes that have a lot going on.
| | 01:56 | This one's a pretty lightweight scene,
so don't really need to sweat it too much.
| | 02:01 | As long as I play that through either
in real time or one frame at a time until
| | 02:07 | they're completely settled down. Then I'm ready
to set their initial state here I am on Frame 46.
| | 02:14 | So whatever these objects are doing on Frame
46 that will be their new state at Frame 1.
| | 02:22 | So I can select one or more of these objects.
Maybe I'll just actually select everything.
| | 02:26 | I've got all of my high LOD objects
hidden and I have only selected the low LOD
| | 02:33 | pins as well as the ball and I'm
parked on Frame 46 and everything settled
| | 02:39 | down, I'll go up to the Dynamics menu set and
choose Solvers>Initial State>Set for Selected.
| | 02:49 | Now I want to warn you that there's
no way to remove the initial state for
| | 02:53 | this Dynamic System.
| | 02:54 | In other words, once you
do this you can't go back.
| | 02:58 | You could move the objects, you could
rerun a simulation and you could set a
| | 03:02 | new initial state, but you can't really remove
the initial state for the rigid bodies in Maya.
| | 03:08 | You can do it for nCloth and other
forms of Dynamics, but just not this one.
| | 03:12 | So I'll choose Set for Selected and
then when I hit Rewind, now all the objects
| | 03:18 | are touching the ground on Frame 1
and when I press Play basically nothing
| | 03:22 | happens-- they kind of drift around a
little bit there, but not enough that
| | 03:26 | anyone would ever notice.
| | 03:27 | And that's very important. Even
| | 03:29 | if your animation isn't starting with
things sitting on the ground, it's just a
| | 03:33 | really good idea that you establish an
initial state that way you'll always be
| | 03:39 | able to get back to that
point by just rewinding.
| | Collapse this transcript |
| Imparting initial velocity| 00:00 | We're ready now to actually create some
animation with our little bowling alley.
| | 00:05 | We need to get that ball rolling down the lane.
| | 00:09 | Now we can do that in multiple ways, we
could create keyframes on the ball and
| | 00:13 | then key it's active attribute.
| | 00:15 | However, the simplest thing to do here
is to simply apply an initial velocity
| | 00:20 | that will be the speed of the object at
the first frame of the animation. I'll
| | 00:26 | select the ball and scroll down on the
Channel box and open up that Rigid Body
| | 00:31 | node and you will see Initial
Velocity X, Y and Z right up at the top.
| | 00:35 | These values will cause the object to
move in whatever cardinal direction in X,
| | 00:42 | Y or Z space and a positive value will
cause the object to move in positive X or
| | 00:47 | positive Y and negative value would
cause it to move in the negative direction.
| | 00:53 | In my scene currently I want the ball
to move this way and that's actually
| | 00:57 | negative Z in my scene.
| | 01:00 | I need to give a negative value to
Initial Velocity Z: let's try value of
| | 01:05 | -100. Rewind and play that back and
you'll see it is rolling along, but it
| | 01:12 | doesn't have enough velocity to actually get
to the end of the lane and knock over any pins.
| | 01:18 | It needs a greater negative Z velocity
to do that-- rewind-- let's try a value of
| | 01:25 | -500, rewind and play back.
| | 01:29 | So now it's actually moving forward
and knocking over some of those pins.
| | 01:33 | The reason why these values are in
the range of 100 is because that's the
| | 01:37 | magnitude of our gravity.
| | 01:39 | Gravity is kind of setting the
tone for the whole simulation.
| | 01:43 | If the gravity magnitude is in the
range of let's say 1000 then all the
| | 01:48 | other forces in the world are going to
need to match that in order to have an
| | 01:53 | effect. If this had initial velocity of -1,
it would not even move at all, because
| | 01:58 | it would not even
overcome the strength of gravity.
| | 02:02 | So if I really want this thing to
really get kicking across there, maybe I could
| | 02:06 | try value of -1000 and rewind and press Play.
| | 02:11 | How about even greater, how about a -1500?
| | 02:16 | Just turn it up until it does what you
want. Basically it's a bit of a trial and
| | 02:20 | error process, but that kind of works.
| | 02:24 | You'll notice by the way that I am not
able to get a perfect strike this way. I
| | 02:28 | can't knock down all 10
pins by hitting the front pin.
| | 02:32 | The layout of the pins has been designed
that way, so that's hard for you to get a
| | 02:36 | strike. You need to actually come in
on an arc in order to hit the pins at an
| | 02:41 | angle and I'll be showing you
how to do that later with Fields.
| | 02:45 | So we got initial velocity in there,
it's basically doing what we want.
| | 02:49 | The initial velocity will be
applied on Frame 1 of the simulation.
| | 02:54 | If you need the initial velocity to
be applied at a different point in time
| | 02:58 | there are ways to do that, you can
keyframes the impulse values here or as I
| | 03:03 | said earlier you could keyframe the
object directly and then key its active
| | 03:08 | attribute and we'll be
looking at those techniques later.
| | Collapse this transcript |
|
|
2. Directing a SimulationImproving performance with stand-ins| 00:00 | In this chapter we'll be looking at directing the
simulation, controlling it, making it do what you want.
| | 00:07 | In a simulation, really, you have to set up
initial conditions and let it play through
| | 00:12 | and you can't really finely control the
behavior of an individual object very well.
| | 00:18 | That means it's very important that those
initial conditions that you set up be good conditions.
| | 00:24 | Remember, in the first chapter I've showed you
how to use proxy objects to speed up a simulation.
| | 00:30 | What I've done here is I've deliberately used
super heavy objects in order to show you the
| | 00:35 | problems that you could have, and to show
you a quick solution to that or at least for
| | 00:40 | testing purposes, how you could use a stand-
in which will calculate much more quickly.
| | 00:45 | Let's take a look at these pins here that I have
made, these super heavy ones. They're very, very dense.
| | 00:50 | They've been smoothed a couple of times.
| | 00:53 | Let's look at the actual
poly count while we're at it.
| | 00:56 | I'll go to the Display menu, go to Heads Up
Display and Poly Count with that one pin selected,
| | 01:04 | I've got 20,000 triangles on that one pin.
This is just not going to play back very well.
| | 01:11 | I am going to turn that Heads Up Display back
off again, and let's take a look at what happens
| | 01:16 | when I try to play through here.
| | 01:19 | So it goes up until just before the point
of impact then it appears to stop, and then
| | 01:24 | it sort of plays through.
| | 01:26 | If you open this scene up on your own
computer, depending upon how fast your computer is,
| | 01:31 | it may not play at all, and it's really
common actually with these dynamics that you'll see
| | 01:37 | something like this where it will go up to
the point just before impact and then appear
| | 01:42 | to freeze or stop, and it may actually take
minutes to calculate just one frame of the simulation.
| | 01:50 | What can I do here to make this better?
| | 01:53 | Well, aside from of course doing it properly
by using proxy objects, one thing I can do
| | 01:57 | just has a real quick band-aid
fix on this is to use a stand-in.
| | 02:03 | A stand-in is a built-in primitive that's
part of the Rigid Body node, and when you
| | 02:09 | enable stand-ins, it'll calculate based upon
a bounding box or based upon a sphere rather
| | 02:15 | than the actual form of your object.
I am going to select all these pins.
| | 02:20 | These are the high LOD pins,
and I've put them on a layer.
| | 02:23 | I can actually just select them via the layer
by right-clicking and choosing Select Objects.
| | 02:30 | You could do it anyway, you could go and
select them through the outliner however you want,
| | 02:33 | but I just want to select them all because I can then
go into the Rigid Body node and adjust these attributes.
| | 02:42 | Like anything in Maya, if you have multiple
objects of the same type selected then you
| | 02:47 | can go on to the Channel box and change
their attributes all at once. It's very handy.
| | 02:52 | What I want to do here is I just want to
scroll down--I'm looking for Stand In, here it is,
| | 02:58 | Stand In--and it's set to
None which is the default.
| | 03:01 | With no stand-in, the collisions are
calculated based upon the actual shape, but if I choose
| | 03:07 | a Stand In of Cube or Sphere, it's going
be a much simpler calculation, and of course
| | 03:13 | it will be much less accurate because it's
just calculating in the bounding box that's
| | 03:17 | just big enough to enclose that object.
| | 03:21 | So I rewind and play that back and
you'll see there's a huge difference.
| | 03:25 | Now it's not very accurate, once again, it's
kind of sloppy, but this is good for testing
| | 03:30 | purposes, because when I just turn on Stand
In I can get a really quick feedback on whether
| | 03:36 | my simulation is kind of in the ballpark
of working correctly, and sometimes you just
| | 03:42 | actually can't playback your simulation in real time
and you will be forced to use stand-ins from time to time.
| | Collapse this transcript |
| Disabling rigid body nodes with Ignore| 00:00 | Here's another really helpful attribute
for the Rigid Body node, it's called Ignore.
| | 00:07 | Basically it does just what it sounds
like it causes that particular Rigid Body
| | 00:11 | node to not function. It
just turns it off essentially.
| | 00:16 | And why would we want this?
| | 00:17 | Well, when you're testing scenes
sometimes you need to turn certain things
| | 00:20 | off and turn other things on
while you're working on them just for
| | 00:23 | performance reasons.
| | 00:24 | Here is a really good example of
why you would need to use Ignore.
| | 00:29 | I have got my super heavy pins here, the
ones that are ultra high level of detail
| | 00:34 | and I am doing that just that we can
see the problem of poor performance here.
| | 00:40 | My bowling ball's taking forever to get
down there; it's only going at 2 frames
| | 00:45 | per second to get all the way down
there and the reason why it's going so slow
| | 00:49 | is because it's actually calculating
collisions with the pins, even though the
| | 00:54 | ball is way over here it still has to
test every polygon on the ball to see if
| | 01:00 | it's touching any of the polygons on the pins.
| | 01:03 | Well that's problematic, because
really it's nowhere even near those pins.
| | 01:08 | What we want to do is we just want to
make it so that the ball will roll at a
| | 01:13 | more or less real-time speed that way
we can test our animation and see if it's
| | 01:17 | moving at the right speed and doing what
we want and then when it gets closer to
| | 01:23 | the pins than we can turn on the
collisions with the pins and have the rest of
| | 01:27 | that animation happen. I'll rewind back
to Frame 1. I want to select all those
| | 01:32 | pins and I can do that because they're
already on a layer, and I'll just right-
| | 01:36 | click and choose Select
Objects. They're all selected now.
| | 01:40 | Scrolling down in the Channel box down
near the bottom you'll see Ignore and
| | 01:44 | it's off, which means they're not being ignored.
| | 01:47 | And if I turn that on either by typing
in the word On or typing in the numeral
| | 01:52 | 1, I'll press Enter.
| | 01:55 | Now when I press Play the ball goes
much faster and of course it goes right
| | 01:59 | through the pins and bounces off that back wall.
| | 02:01 | We ignored the pins, but what we
really want to do is we want to ignore them
| | 02:06 | only for the first part of this
animation and then when we're ready for that
| | 02:10 | collision we'll just turn the Ignore back
off again, we can keyframe the Ignore value.
| | 02:16 | I'll go back to Frame 1 and I want
to keyframe the Ignore on at Frame 1;
| | 02:23 | I'll right-click the name
and choose Key Selected.
| | 02:26 | Note is very important that I did
not press the S key on the keyboard to
| | 02:32 | keyframe that channel.
| | 02:33 | The S key is going to keyframe all
of the Transforms for the selected
| | 02:39 | objects and it won't actually key-
frame any of these Shape node attributes
| | 02:44 | like the Ignore attribute.
| | 02:46 | So I'll play this through and what I
want to do is keyframe the Ignore back off
| | 02:52 | again when the ball gets near to the
pins, but remember I can't scrub here. It
| | 02:58 | doesn't really work very
well; it's really inaccurate.
| | 03:01 | To find the proper frame in time
what I want to do is just rewind back to
| | 03:06 | Frame 1 and look at this in the top
view. So I'll tap the Spacebar here and
| | 03:12 | look in the top view. I want to get
in really close and step through the
| | 03:17 | animation one frame at a time, because
it's not really going to take that long
| | 03:21 | for it to get down there.
| | 03:23 | Somewhere around frame 20, 25,
somewhere in there maybe I can turn the
| | 03:28 | Ignore back off again.
| | 03:30 | At around frame 34 I guess where I
am at. I want to leave a little bit of
| | 03:35 | wiggle room there and then I'll select
those pins once again making sure that I
| | 03:41 | am not selecting the ground plane
Ctrl+Click to make sure that that's not
| | 03:45 | selected and scrolling down in my
Rigid Body nodes-- here we go Ignore on Frame
| | 03:51 | 34 in my case-- I'll set that to off
by typing in a 0, press Enter and don't
| | 03:57 | forget I've got to key it.
| | 03:59 | So I'll select the name Ignore and
then right-click and Key Selected.
| | 04:03 | Here is a keyframe that starts the
Ignore and here's the keyframe that ends
| | 04:08 | the Ignore and what I have done is I've
basically optimized my shot so that the
| | 04:13 | ball moves at a good rate of speed
during the first part of the animation and
| | 04:18 | only starts slowing down when
it gets close to those pins.
| | 04:23 | Keyframing the Ignore attribute is
very useful to speed up your workflow, so
| | 04:27 | you're not sitting around waiting for
the same simulation to calculate over
| | 04:31 | and over again.
| | Collapse this transcript |
| Adding bounce| 00:00 | Let's play around with some of the
Dynamic properties of the Rigid Body node.
| | 00:04 | First of all, bounce or bounciness.
| | 00:07 | That's pretty self explanatory. I play
this back and you'll see that my bowling
| | 00:11 | ball is bouncing a little bit.
| | 00:13 | We of course, can control the amount of bounce.
| | 00:16 | For any Rigid Body node active or
passive you can scroll down in the Channel
| | 00:21 | box, and you're looking for-- here it is--
Bounciness, and the default value is 0.6
| | 00:27 | and the range is from 0 to 1.
| | 00:30 | If I set the bounciness down to 0 then
you might expect that we would get no
| | 00:34 | bounce. You want that and play it back.
| | 00:36 | But you see it did bounce a little
bit and the reason is that the ground
| | 00:41 | plane of the bowling alley lane has a
bounciness attribute as well, because
| | 00:45 | it's a passive rigid body.
| | 00:47 | If you want no bounce at all then both of
the objects have to have a bounciness of 0.
| | 00:53 | I've got my ground plane selected and
I'll set that bounciness down to 0 and
| | 00:58 | rewind and play that back and you'll
see literally no bounce and it just lands.
| | 01:03 | What I recommend is that you set the
ground plane's bounciness to an average
| | 01:09 | value that works best for all the
objects that might collide with that ground
| | 01:14 | plane and the default of 0.6. In this
case I think it's a little bit high. I am
| | 01:19 | going to set the ground plane
bounciness down to about 0.4, press Enter and
| | 01:26 | then rewind and play it and with the
ground plane with a bounciness of 0.4 and
| | 01:33 | the bowling ball with a bounciness of 0.
It's looking better I think maybe just
| | 01:37 | a little bit of bounce on the bowling
ball maybe a 0.2 and I think that feels a
| | 01:45 | little bit better than what we have
the first time, where it seemed like with
| | 01:49 | the default values of 0.6 it was
bouncing too much and it didn't really feel
| | 01:52 | heavy enough.
| | Collapse this transcript |
| Adding friction| 00:00 | Another essential dynamic attribute of
the Rigid Body node is Friction. That of
| | 00:06 | course, is the resistance to
movement when two surfaces touch.
| | 00:12 | Let's adjust the friction on this
because I think there's not enough really. It
| | 00:16 | seems like it's sliding around a bit
too much. I'll rewind and I want to
| | 00:21 | select all the pins they're in my
Dynamics layer now, I'll just right-click
| | 00:26 | and then select the objects.
| | 00:29 | Look for the Rigid Body node in the
Channel box, scrolling down just where we
| | 00:32 | saw Bounciness then nearby you'll see
Static Friction and Dynamic Friction.
| | 00:38 | Usually these will be set to the same
value. If I set them both to 1 and rewind
| | 00:44 | and play them back, you'll see that the
pins kind of want to stick in place and
| | 00:49 | they'll actually get knocked over
rather then fly across the space.
| | 00:53 | There is also friction for the ground plane too.
| | 00:56 | So if I select that ground
plane, increase its friction--
| | 00:59 | static and dynamic-- both up to 1
and rewind and play that back.
| | 01:05 | That's really strange, isn't it?
| | 01:06 | That's a very unrealistic look
because we've tweaked out the settings to
| | 01:10 | really extreme settings.
| | 01:12 | Now what is the difference
between static and dynamic?
| | 01:16 | Static friction is the force that must
be overcome in order to get the object
| | 01:22 | moving from a resting position.
| | 01:26 | In other words if the object is
sitting in place and you have a high static
| | 01:30 | friction then it won't be as likely to move.
| | 01:34 | If the object is sitting in place and it
has a low static friction then it'll be
| | 01:38 | easily pushed out of the way.
| | 01:40 | Dynamic friction is the force that must be
overcome for an object to continue moving.
| | 01:47 | Once it's in motion that's when
the dynamic friction is relevant.
| | 01:52 | If the object is sliding across the
floor with a low dynamic friction it will
| | 01:57 | just slide without stopping, but with a high
dynamic friction it will slow down and stop.
| | 02:03 | Again, usually you'll set
them both to be the same value.
| | 02:06 | I think what I want here is something
a little bit higher than the defaults.
| | 02:11 | I'll set the ground plane's frictions
back to 0.2 and then reselect my pins right-
| | 02:18 | click and select Objects and I'll set
those to let's say 0.4 and press Enter
| | 02:26 | rewind and play that back.
| | 02:28 | I think that works a little bit better
in this case. This is going to be up to
| | 02:32 | you to decide what looks
good in your own simulations.
| | Collapse this transcript |
| Adjusting mass| 00:00 | Continuing with our survey of the
most important dynamic attributes for
| | 00:04 | the Rigid Body node; next is mass.
| | 00:08 | Mass is essentially, the weight of the
object although it doesn't really work
| | 00:12 | the way mass does in the real world.
| | 00:15 | These simulations are not truly
actually physically accurate; they're just an
| | 00:19 | approximation of the way
things work in a real world.
| | 00:23 | And for mass, what it does is it has to do with
how collisions take place. Let me illustrate.
| | 00:31 | I've got my ball and it's currently got
initial velocity of -1200 in Z. We will
| | 00:39 | play that simulation back.
| | 00:42 | Scrolling down a little bit further
you will see Mass and it currently has a
| | 00:46 | value of 1, and by default that's 1 kilogram.
| | 00:50 | But really it's not a physically accurate value;
| | 00:53 | I'll set that mass up to a value of
10, and rewind and play that back.
| | 01:00 | And interestingly the speed of
the initial velocity didn't change.
| | 01:05 | This is how it's different from the real world.
| | 01:07 | If you increase the mass of something in
order to get it moving you have to push it harder.
| | 01:12 | So you might think that by increasing
the mass then I would need to increase the
| | 01:16 | initial velocity as well,
but that's not the case.
| | 01:19 | The mass only affects collisions;
| | 01:22 | it also affects things
like dynamic constraints too.
| | 01:25 | But in this case all we were concerned
with is the collisions, and essentially
| | 01:29 | what this is doing is when that ball
hits the pins, it's hitting the pins 10
| | 01:35 | times harder than it was before.
| | 01:37 | That's why they're jumping around so much.
| | 01:39 | And additionally you notice that the
ball bounces off the back wall a lot
| | 01:43 | harder, because it has a greater mass.
| | 01:46 | If I reduce its mass let's say to 0.1
and play it back, it bounces off the pins
| | 01:53 | because it's as if that ball is a feather now.
| | 01:56 | And additionally mass is
not really an absolute value.
| | 02:00 | I said that it was a kilogram
but that's just a nominal value.
| | 02:03 | But really all that matters is the ratio
between the masses of the colliding objects.
| | 02:11 | In other words if the ball has a value
of 0.1 and my pin has a value of 1 then
| | 02:18 | the pin is 10 times more massive.
| | 02:21 | If I change these values so that the
pin had a value of 10, and the ball had a
| | 02:28 | value of 1, it is still 10:1 ratio.
| | 02:32 | I've just bumped it up by an order of
magnitude but it's not the absolute value
| | 02:37 | that matters, it's the ratio between the values.
| | 02:40 | So we'll get the same result basically.
| | 02:43 | You will notice that this first pin
knocked the other pin out of the way there
| | 02:47 | because this pin has a mass of 10
and this pin has a mass of 1 still.
| | 02:53 | I'll go ahead and select this one.
| | 02:55 | Set that back to a value of 1, so that
it matches the rest of the pins and then
| | 03:00 | select the ball and instead of a value
of one maybe I'll give it a value of 2
| | 03:05 | which means the ball is now
twice as massive as the pins.
| | 03:10 | It's moving at about the right rate of
speed and it's applying about the right
| | 03:15 | amount of force because in the real
world a bowling ball is approximately about
| | 03:20 | twice as heavy as a bowling pin.
| | Collapse this transcript |
| Applying damping| 00:00 | One of the less obvious but still very useful
attributes of the Rigid Body node is Damping.
| | 00:07 | Damping allows you to apply a
chill out factor to the simulation,
| | 00:12 | essentially slowing it down
and kind of mellowing it out.
| | 00:16 | And its purpose is usually to prevent
jitter or to cause a moving object to
| | 00:23 | eventually slow down and stop,
because otherwise it might just keep moving.
| | 00:27 | Let's take a look at how Damping works.
| | 00:30 | I'll select the ball and press Play
with no Damping applied and you see what
| | 00:35 | happens is it kind of spins around
back there and that looks kind of strange.
| | 00:38 | I'll stop and rewind, with that ball
selected I'm going to go to the Channel box
| | 00:43 | and in the Rigid Body Shape node, in
that same area we saw a Friction and
| | 00:47 | Bounciness, here it is, Damping.
| | 00:50 | I'll increase the Damping to a
value of 1, play that back.
| | 00:55 | You can see that that's a much better result;
| | 00:57 | the ball slid across the floor,
knocked over some pins, and then slowed down and
| | 01:02 | stopped like it should.
| | 01:03 | What Damping does is with each
successive frame of the simulation, it
| | 01:09 | essentially reduces the amount of
velocity carried over from the previous frame
| | 01:14 | and the higher the Damping
value, the more loss in velocity.
| | 01:19 | I'll rewind that, let's try
setting the Damping up to 10;
| | 01:23 | that's really an extreme value
but it will illustrate how it works.
| | 01:26 | So you can see with the damping of 10, the ball
didn't even have enough force to reach the pins.
| | 01:34 | Useful values for Damping are
usually between 0 and 2.
| | 01:38 | 2 is actually probably too high in this
case I think with a value of 1 I was fine.
| | 01:44 | I could apply Damping to the pins as well in
the same manner, I set this back down to 1.
| | 01:50 | Again Damping is very useful
especially if you've got a simulation that's a
| | 01:55 | little bit overactive and it's doing
too much and you need to kind of dial
| | 01:59 | it down.
| | Collapse this transcript |
| Tuning rigid body solver attributes| 00:00 | Up to this point in this title we
haven't seen too many problems with the
| | 00:04 | simulation and that's actually
because I've changed some of the Solver
| | 00:09 | attributes to tune it to this scene.
| | 00:13 | All the scenes that you've opened
up so far have been tuned so that
| | 00:17 | they'll play back properly.
| | 00:19 | However, that's not the default
when you first create a simulation.
| | 00:23 | You need to learn how to tune the
Solver attributes so that you don't get wacky
| | 00:27 | results like this, things falling
through the floor, some of these objects
| | 00:34 | lighting up and then
getting stuck inside one-another.
| | 00:37 | These are problems with Maya's Rigid
Body Solver and this happens all the time.
| | 00:44 | Don't be alarmed; we do have the tools
to fix this and prevent this happening.
| | 00:50 | I want to mention that when these
things light up during the playback of this
| | 00:54 | simulation, it means that there's been
some interpenetration: in other words two
| | 00:59 | of those rigid bodies have passed
through one another and that's of course an
| | 01:04 | illegal condition for the simulation.
| | 01:06 | Therefore, Maya selects the objects to
warn us and say, "Hey! There is an issue here."
| | 01:12 | You will also see the back
down here in the script area;
| | 01:16 | it's saying, "Rigid Body
Interpenetration Occurred."
| | 01:20 | So how do we fix this?
| | 01:22 | You could play around with things
like the velocity of your objects or
| | 01:26 | maybe even the density.
| | 01:29 | In other words, if I highlight one of
these and show you it's got an internal
| | 01:33 | structure-- it's got a
certain number of polygons.
| | 01:35 | Maybe increasing the number of polygons
might help with the Solver calculation.
| | 01:40 | In other words, you have more
points for it to collide with.
| | 01:44 | But that's not really an optable
solution because the more you increase the
| | 01:49 | level of detail the slower your
simulation is going to run, and it will actually
| | 01:53 | compound the problem,
rather than make it better.
| | 01:55 | What we need to do is get a handle
on the Solver attributes themselves.
| | 01:59 | And you can access that by just
going into the Dynamics menu set to
| | 02:04 | Solvers>Rigid Body Solver Attributes.
| | 02:08 | We've only got one Rigid Body Solver in
the scene right now and when I click on
| | 02:13 | this it's going to load the Attribute
Editor and expose that Rigid Solver node.
| | 02:18 | Here are the attributes that
are most important: Step Size and
| | 02:22 | Collision Tolerance.
| | 02:25 | Step Size is the time-based accuracy;
how many times per second does Maya test
| | 02:33 | the position orientation and
velocity of the rigid body objects?
| | 02:37 | Lower numbers to the Step Size mean
more samples per second, meaning a higher
| | 02:44 | accuracy to the simulation.
| | 02:47 | Lower values equal higher accuracy.
| | 02:51 | Higher values give lower
accuracy, but faster performance.
| | 02:57 | Here is a weird paradox around this.
| | 03:00 | Somehow lowering the
accuracy improves the result.
| | 03:05 | I know that's completely backwards
but that's just a fact because I've
| | 03:09 | observed it over the years.
| | 03:10 | So Step Size is the time base.
Collision Tolerance is the spatial accuracy,
| | 03:17 | that's how far apart two services are
allowed to be before they are considered
| | 03:22 | to be touching and
currently it's at 0.03 centimeters.
| | 03:27 | Well as I said sometimes increasing these
values will actually improve the simulation.
| | 03:32 | I'm going to set the Step Size up to a
value of 0.1, rewind and play that back
| | 03:39 | and see if that helped.
| | 03:41 | Didn't really do much, rewind, go
back to that Rigid Solver node, maybe
| | 03:47 | increase the Collision Tolerance as well to 0.1.
| | 03:52 | Rewind, playback, and there you go,
I've got a much better result.
| | 03:57 | It's not a perfect result-- I've turned
the Damping off here so you can see that
| | 04:02 | that's still sliding around-- but that's
the key, it's playing around with those
| | 04:05 | Solver attributes and paradoxically
higher values are less accurate but yet
| | 04:14 | somehow give better results.
| | Collapse this transcript |
| Adding a Radial field| 00:00 | We want to direct this animation to get
a desired result, and that is to knock
| | 00:06 | down all 10 pins to get a perfect strike.
| | 00:09 | To do that I want to make the ball move
in arc so that it curves around here and
| | 00:14 | strikes the pins from the side.
| | 00:15 | I can use a Radial field to accomplish that.
| | 00:19 | A Radial field is a field that
pushes or pulls dynamic objects.
| | 00:24 | This time I'm going to create the
field without any connections so that I can
| | 00:28 | show you how to connect
objects to fields after the fact.
| | 00:32 | I'll just go ahead to my Dynamics menu
set and choose Fields>Radial and it's
| | 00:37 | created right at the Origin
which is nearly where I want it.
| | 00:40 | I just want to move it up a little bit,
give it a little bit of elevation so
| | 00:45 | it's not sitting right on the floor.
| | 00:46 | And now I want to show you a new window
where you can make or break connections
| | 00:51 | to Field to other dynamic objects.
| | 00:52 | It's under Window>Relationship Editors>
Dynamic Relationships; open that up and
| | 00:59 | on the left I want to select the
dynamic objects, the ball in this case.
| | 01:03 | So I want to find the ball and click on
that and then all the fields are listed
| | 01:08 | on the right-hand side.
| | 01:10 | This is showing me that the ball is
currently connected to the Gravity field,
| | 01:14 | but it's not connected to the Radial field.
| | 01:17 | To connect it all I have to do is
click here and if it's highlighted that
| | 01:21 | means it's connected.
| | 01:22 | To disconnect it, once again just click.
| | 01:25 | There we go, that's the
Dynamic Relationships Editor.
| | 01:28 | I rewind and play my simulation but
you'll see that the Radial field is not
| | 01:33 | having any effect right now and the
reason is that that Radial field's values by
| | 01:38 | default are not sufficient to
give the result that we want.
| | 01:42 | In the next movie we will adjust
the Radial field attributes to get a
| | 01:46 | desired result.
| | Collapse this transcript |
| Limiting a field with Max Distance| 00:00 | We've added a Radial field and we've
connected it to the ball but when we play
| | 00:04 | the simulation we're not seeing any result here.
| | 00:07 | We need to adjust some of
those radial field attributes.
| | 00:10 | Also the position of the radial
field makes a huge difference, so even if
| | 00:15 | you just move it by a tiny amount it could
affect the result: it's extremely sensitive.
| | 00:22 | Not seeing any result right now but
we'll play around some of the attributes.
| | 00:25 | With our Radial field selected here I'm in
the Channel box and you'll see the Magnitude.
| | 00:31 | Let's try a Magnitude of
500. That's pretty strong.
| | 00:35 | Rewind that and play that back and I
still don't see any result and the reason
| | 00:39 | why is this attribute here, Max Distance,
that's the extent of the field's range
| | 00:46 | of influence, it's a radius value.
| | 00:48 | Anything that's a greater distance
away than the Max Distance will not be
| | 00:53 | affected by the field.
| | 00:55 | Currently it's got an invisible bubble
around it that's about 20 centimeters.
| | 01:00 | Let's try increasing that Max Distance
up to let's say 200, rewind and playback
| | 01:07 | and now you'll see the ball
actually bounced right off.
| | 01:11 | Not only did it bounce off, but if
you look closely you'll notice that it's
| | 01:14 | actually accelerating away.
| | 01:18 | So what is Max Distance?
| | 01:20 | It's just the radius of influence.
| | 01:23 | Anything farther away than 200
centimeters won't be affected.
| | 01:26 | Well maybe I don't need quite so
much Magnitude, maybe I can bring
| | 01:30 | the Magnitude down.
| | 01:31 | Rewind and see what happens.
| | 01:33 | So you see that these
attributes are very sensitive.
| | 01:38 | You have to play around with them and
sort of find the perfect storm and the
| | 01:42 | magic values of
combinations that do what you want.
| | 01:46 | But in order to do that you
need to understand what they do.
| | 01:50 | So I found a result here that sort of
works in this case. I've got a Magnitude
| | 01:55 | of 300 and Max Distance of 200, and
maybe if I move the field around I can kind
| | 02:00 | of play around and see what I can make happen.
| | 02:03 | So you see there just having moved the field
over a little bit has had a huge influence.
| | 02:07 | I'll move the field even further
over; that's going to cause it to react
| | 02:11 | even more strongly.
| | 02:14 | So it takes a little bit of getting used
to, because the ball is moving in a
| | 02:18 | straight line in the negative Z axis,
it's really overtaking this Magnitude.
| | 02:24 | But when the field is positioned over
here that Magnitude is operating kind of
| | 02:28 | perpendicular to the vector or
the direction the ball is moving in.
| | 02:35 | So that's Max Distance.
| | Collapse this transcript |
| Softening a field with attenuation| 00:00 | Another really important
attribute for fields is Attenuation.
| | 00:05 | Attenuation is the fall off, and with a
value of 1, which is the default, the
| | 00:10 | intensity of the field diminishes linearly
from the field location to the Max Distance.
| | 00:19 | In other words, it's going to be at full
strength at the location of that field
| | 00:24 | and it's going to fall off in intensity
until it reaches the Max Distance where
| | 00:29 | the value will be 0.
| | 00:31 | If the Attenuation is set to 0 that
means it's turned off and instead of a
| | 00:36 | soft fuzzy boundary around the field,
you're going to have a hard-shell around
| | 00:41 | that field and any object that gets
200 units away from that field this is
| | 00:47 | going to bounce right off.
| | 00:48 | Rewind and to play that back, so you
see it bounce right back towards me,
| | 00:52 | whereas with Attenuation of 1, it was
allowed to pass through. It deviated the
| | 01:01 | path because there's a soft
boundary around that field there.
| | 01:06 | You'll need to work with all of
these attributes to get a good result.
| | 01:09 | You'll need to set the appropriate Magnitude,
Max Distance and Attenuation for each field.
| | 01:15 | And every scene is different. That
means you're just going to have to take the
| | 01:20 | time to adjust all those
attributes for every scene that you make.
| | Collapse this transcript |
| Adjusting field attributes with manipulators| 00:00 | Although we have full control over the
Max Distance and other attributes from
| | 00:04 | the Channel box, using this method it's
hard to visualize what that distance is.
| | 00:10 | Here's a handy trick
that can help you with that.
| | 00:13 | We can turn on the Show Manipulator Tool.
| | 00:16 | With the Field selected I'll click
Show Manipulator and you'll see in the
| | 00:20 | viewport here we've got a visual
indicator of the Max Distance, the Attenuation
| | 00:24 | and the Magnitude and I can
click on any of these and move it.
| | 00:27 | And you'll see it's changing
that value in the Channel box here.
| | 00:32 | And what I really want actually is I
want to have a pretty large Max Distance of
| | 00:36 | somewhere in the range of 200 or 150,
but then I actually want to move the field
| | 00:42 | over to the side and reduce its Magnitude.
| | 00:46 | And again I can do that
from the manipulators too.
| | 00:48 | With a low Magnitude and a high
Attenuation it's going to cause the ball to
| | 00:56 | softly arc through here; it's not
going to have a hard bounce effect.
| | 01:01 | Notice, by the way, as I bring that
Magnitude down, it wants to snap back up here.
| | 01:06 | It's not changing the value when it
does that, it's just purely visual
| | 01:09 | indicator on the screen.
| | 01:12 | Okay let's try that.
| | 01:13 | So I've got a pretty low Magnitude and
that's actually good because it's kind of
| | 01:17 | deviating the ball a little bit, it's
just kind of pushing it over slightly.
| | 01:22 | And to finally get this to be a
perfect strike what I want to do is the ball
| | 01:26 | itself, I want to move that over a
little bit to one side and start its Initial
| | 01:33 | Velocity on a diagonal.
| | 01:35 | And then when it gets down here it's
going to sort of softly bounce off that
| | 01:40 | field and kind of arc around
back to the left in this case.
| | 01:46 | So I need to start to figure out
what my Initial Velocities need to be.
| | 01:51 | I need to move in positive X if I
want to move in this diagonal here, but a
| | 01:56 | low positive X value.
| | 01:58 | I've got a negative Z of 1800 and
let's do a positive X of 100, play that back.
| | 02:09 | Pretty close!
| | 02:10 | I think maybe if I increase my field
strength I can get that landing where I want.
| | 02:16 | Let's try a Magnitude of 50, play that back.
| | 02:20 | This is just the tweaking phase where
you've got to adjust all the variables.
| | 02:24 | That's not perfect, but that's
pretty close, I did get a strike.
| | 02:29 | And from this angle we don't see a very
good arc, but from a more conventional
| | 02:35 | angle it might look fine.
| | 02:36 | If I really needed a perfect arc then I
could actually play with that some more.
| | 02:42 | But at this point we've got
essentially the result that we want.
| | Collapse this transcript |
|
|
3. Working with KeyframesDisabling solver evaluation| 00:00 | In this chapter on Rigid Body
Dynamics, we'll be looking at integrating
| | 00:04 | keyframes with a Dynamic Simulation.
| | 00:07 | So we can integrate keyframes in
several different ways, we can keyframe the
| | 00:11 | strength of fields, we can keyframes
attributes such as Ignore and we can also
| | 00:17 | animate an object with traditional
keyframes methodology and then let the
| | 00:22 | Dynamics takeover at a certain point
in time by keying the active attribute.
| | 00:27 | We'll be learning all those
techniques in this chapter.
| | 00:30 | In order for any of those to really
effectively work you actually have to turn
| | 00:34 | off the Rigid Body Dynamics engine
while you're working on keyframes.
| | 00:40 | And the reason for that is of
course that you can't really scrub in the
| | 00:45 | Timeline, and if you do, simulation
is just going to break; it won't work.
| | 00:50 | And we'll also have performance issues.
| | 00:52 | Sometimes if you've got a heavy scene and
you try to like skip forward to a later
| | 00:56 | point in time to set a keyframe, you'll
be sitting there for a really long time
| | 01:00 | waiting for the whole thing to calculate.
| | 01:03 | In order to prevent all those worries,
we're just going to turn off the Rigid
| | 01:07 | Body Dynamics Solver
globally while we create keyframes.
| | 01:12 | It's easy to do that: you just go up
here to the Main menu to Modify>Evaluate
| | 01:18 | Nodes, and you'll see that lots of
different things are in here such as Inverse
| | 01:22 | Kinematics and so on. I just want you
to turn off Rigid Bodies while you're
| | 01:27 | creating keyframes, and to do that
simply just click that little X box.
| | 01:33 | I do want to warn you that this menu
at least in the past has been in my
| | 01:38 | experience slightly unreliable and
the state of that X box may actually not
| | 01:45 | indicate the true state of
whether Rigid Bodies are on or off.
| | 01:50 | But you can tell pretty clearly and
pretty obviously if the Rigid Body
| | 01:54 | Simulation is turned off, because
obviously none the dynamics are working
| | 01:58 | anymore or more precisely, we've disabled them.
| | 02:01 | So that's all there is to that. We need
to do that in order to move forward to
| | 02:05 | create keyframes and not have issues.
| | Collapse this transcript |
| Keyframing field magnitude| 00:00 | One fun thing you can do with keyframing
attributes for rigid bodies is keyframe
| | 00:05 | the Magnitude of a field.
| | 00:07 | That way we can cause the field to have
effect only during certain times of the animation.
| | 00:12 | In this version of the bowling alley
I've deleted the bowling ball and I've
| | 00:16 | deleted the field that we created in Chapter 2.
| | 00:19 | And I'm going to new field that only
affects the pins and I can make those pins
| | 00:25 | fly through the room without having
been struck by anything and I can have that
| | 00:29 | happen at a specific frame in my Timeline.
| | 00:33 | I'll go head and select all the
pins, making sure that I haven't
| | 00:36 | selected anything else.
| | 00:37 | And in my Dynamics menu set I'll
choose Fields and we'll do a Radial field.
| | 00:44 | It's created at the Origin. I'll just
move it up a little bit and then in my
| | 00:48 | top view I'll move it back and
position it so that it's behind the pins;
| | 00:54 | that'll be more dramatic.
| | 00:55 | It calls the pins to fly outward.
| | 00:58 | Now I have disabled Solver Evaluation--
remember here Modify>Evaluate Nodes-- and
| | 01:05 | that's really the best thing to do when
you're trying to set keyframes for field
| | 01:08 | Magnitude. I just want to have those
Rigid Bodies turned off for the moment.
| | 01:12 | With a Radial field selected I'll go
to a later point in time like let's say
| | 01:16 | Frame 30 and I'll keyframe the value
at 0 for the Magnitude, press Return and
| | 01:24 | I want to keyframe that so I'll select the
name and then right-click and Key Selected.
| | 01:30 | Now in this case I don't want to have
any Max Distance or Attenuation. I just
| | 01:35 | want the field to affect all of the pins
regardless of where they are or how far
| | 01:40 | they are away from the field icon.
| | 01:43 | To do that I'll turn Attenuation off
by turning that to 0 and I'll turn Max
| | 01:48 | Distance off as well not by reducing the
value to 0, but in fact by flipping the
| | 01:54 | switch that says "Use Max Distance."
| | 01:57 | I'll just set that to 0 and that
completely disables Max Distance so that this
| | 02:01 | value no longer has any effect at all.
| | 02:04 | And if I go a little bit later in time
let's say Frame 40, I can keyframe the
| | 02:09 | Magnitude up to some level.
| | 02:11 | Let's try a value of 20, press Enter,
then select the name and once again
| | 02:18 | right-click and Key Selected.
| | 02:20 | I'll rewind and in order to see that
take effect I'll have to re-enable the
| | 02:25 | Rigid Body Solver Evaluation.
| | 02:28 | Go back up to Modify>Evaluate Nodes and
tick the Rigid Body switch back on again.
| | 02:35 | Play my simulation and you can see at
Frame 30 it takes effect and it pushes all
| | 02:41 | of those pins out of the way.
| | 02:44 | And the pins are also flying because of
their own inertia, with their own momentum.
| | 02:49 | An object in motion will remain in
motion unless acted upon by a force.
| | 02:54 | So the pins are moving, but they're also
being pushed along by that field on each frame.
| | 03:00 | That means that they're going to continue
to accelerate and move faster and faster.
| | 03:04 | If we'll want that to happen, if we
just want them to get knocked over, then
| | 03:08 | we'll need to keyframe the
field strength back off again.
| | 03:10 | I am going to rewind, disable Evaluation and
then go just maybe a couple of frames after.
| | 03:19 | Maybe I only want them to just get kicked over.
| | 03:23 | I don't recommend just
one frame, maybe two frames.
| | 03:26 | Here I am on Frame 42 and I'll set
that Magnitude down to 0, select it,
| | 03:33 | right-click and choose Key Selected.
| | 03:36 | Rewind, go up here Modify and re-
enable the Evaluation and press Play.
| | 03:46 | So you'll see that they did
accelerate a little bit and that's because we
| | 03:50 | actually have a keyframe interpolation
going on. In other words, between Frames
| | 03:55 | 30 and 40 the strength of the
Field Magnitude is ramping up.
| | 03:59 | All I want to do just briefly go into
the Graph Editor and change the keyframe
| | 04:03 | interpolation such that it will
simply pop on Frame 40 without ramping up.
| | 04:09 | With the field selected I'll go to
Window>Animation Editors>Graph Editor,
| | 04:13 | here is the Field Magnitude I'll click on
that and press the F key so I can see the curve.
| | 04:20 | Here we can see the keyframe magnitude
increasing from Frame 30 to Frame 40 and
| | 04:25 | then dropping off at Frame 42.
| | 04:27 | I don't want this interpolation here, I
just want it to suddenly pop to a value of 40.
| | 04:33 | To do that, I'll select this first
keyframe and set it to Step Tangents here.
| | 04:39 | That's all there is to that.
| | 04:41 | Rewind, play it back and you'll see
that it's pushed those pins out of the way
| | 04:48 | without that same strange
acceleration that we saw a second ago.
| | 04:51 | If we play with that a little bit more
and increase the friction and so on then
| | 04:55 | we can get maybe a little more pleasant
result, but that's the essential process
| | 04:59 | of keyframing Field Magnitude.
| | Collapse this transcript |
| Pushing an active body with Impulse| 00:00 | Really commonly with Dynamic Simulations
you want to have some particular effect
| | 00:05 | happen at a specific time.
| | 00:07 | For example, maybe I want this bowling
ball to fly across the lane at a later
| | 00:12 | point in time, not on Frame 1
| | 00:14 | And additionally, maybe I want the ball
actually dropped to the floor and then roll across.
| | 00:20 | Currently now it's just flying
across the screen on Frame 1.
| | 00:25 | Because if you remember from earlier
chapters what we did was for the Rigid Body
| | 00:29 | node on that ball, we set an Initial Velocity.
| | 00:33 | Those Initial Velocities are applied
on the first frame of the simulation.
| | 00:37 | And the first frame is determined by
the global settings in the Rigid Body
| | 00:41 | Solver node and of course the
default is just to start on Frame 1.
| | 00:45 | If I want the ball to drop and then
fly across the space, I can't do that
| | 00:49 | with Initial Velocity.
| | 00:50 | What I'll do now is I'll just select
those three attribute values and type in a
| | 00:54 | 0, press Enter and disable the Initial
Velocity. I want to make sure before I
| | 00:59 | create any keyframes that my Evaluation of
Rigid Bodies is disabled; I turn that off.
| | 01:06 | And I want to keyframe a
different attribute here which is Impulse.
| | 01:12 | And Impulse is very useful because I can
keyframe that to happen at a certain time.
| | 01:16 | And in fact using the Position values
here I could also cause the force to be
| | 01:22 | applied not directly on the center of
mass of the object, to some other location.
| | 01:27 | We're going to leave these
at 0 for this exercise;
| | 01:30 | I'm just going to keyframe the Impulse.
| | 01:33 | On Frame 1 I want no Impulse and I
want to keyframe the Impulse X and Z, I'll
| | 01:39 | select X and Z with the Ctrl key
and then choose Channels>Key Selected.
| | 01:45 | On Frame 1, Impulse is set to 0.
| | 01:49 | I'll scroll down to let's say Frame 40
and that's when I'll want the ball to fly
| | 01:54 | across the space, and I'll
keyframe those values up.
| | 01:58 | I'll just use similar values to
what I used for the Initial Velocity.
| | 02:02 | Impulse X of 100, press Enter, Impulse
Z of -1800 --because remember we want the
| | 02:09 | ball to move in negative Z-- press Return.
| | 02:14 | Go ahead and select those
and once again Key Selected.
| | 02:18 | Now I only want that Impulse to be on
for one or two frames, because if I don't
| | 02:23 | then the Impulse will accumulate.
| | 02:25 | Just like the field we saw in the last
movie, it will cause the object to accelerate
| | 02:30 | in a really unnatural fashion because
that Impulse is being reapplied on every
| | 02:35 | frame and then also adding to the
inertia or the momentum of the ball.
| | 02:40 | Let's see what that looks like if I re-
enable my Rigid Body Evaluation, and go
| | 02:45 | ahead and rewind and play that back.
| | 02:48 | And what's happening again is that the
ball is accelerating because that Impulse
| | 02:53 | is being applied on every frame.
| | 02:56 | See that in the top view,
it's a little bit clear.
| | 02:58 | The ball really is
accelerating and picking up speed.
| | 03:03 | Go ahead and turn my Evaluation back
off again, scrub down to Frame 42 and then
| | 03:10 | keys these values back off again 0 and 0.
| | 03:15 | Select them and Key
Selected, turn them back off.
| | 03:21 | And then we'll turn the Evaluation back on
again, rewind the simulation and play it back.
| | 03:27 | You'll see we're still not quite there
yet, because the ball is moving before I
| | 03:33 | wanted to. Remember I
wanted it to start on Frame 40.
| | 03:36 | I'll go ahead and select it and go
back into Window>Animation Editors>Graph
| | 03:42 | Editor and here are the curves for
Impulse X and Z and once again I just want
| | 03:49 | to select those and set them to Step Tangents.
That means there will be no interpolation.
| | 03:55 | Let's see what that looks like.
| | 03:56 | Play it back, so that's exactly the
result I was trying to achieve. I wanted the
| | 04:02 | ball to drop to the floor and then
at Frame 40 to kick across the space.
| | 04:07 | I could fine tune that a little bit
better if I want to get a perfect strike,
| | 04:11 | but that's a good illustration
of animating the Impulse values.
| | Collapse this transcript |
| Keying the active attribute| 00:00 | If you want the best of both worlds from
traditional keyframing in Dynamics, you
| | 00:05 | can do that in Maya simply by keying
the active attribute on a Rigid Body node.
| | 00:11 | We can set it up so that the object
will be keyframed in the first part of an
| | 00:14 | animation and then allow
the Dynamics to take over.
| | 00:17 | This is a really cool technique
that you probably will use a lot.
| | 00:21 | In this version of the scene, my
ball does not have any Rigid Body nodes
| | 00:25 | attached to it yet.
| | 00:27 | What you usually want to do in this
case is you want to create a passive
| | 00:30 | rigid body to start with.
| | 00:32 | We've got it selected.
| | 00:34 | In my Dynamics menu set, I'll go
to Soft/Rigid Body>Create Passive.
| | 00:40 | And as I mentioned before, there's only
one Rigid Body node type and whether you
| | 00:45 | choose Active or Passive in this
menu, you'll create the same node.
| | 00:49 | The difference is the state of the
active attribute and if I go to the Channel
| | 00:53 | box and open up that Rigid Body Shape
node, scroll down near the bottom, then
| | 00:59 | you'll see Active and it's currently off.
| | 01:02 | In this state now, I can create
ordinary keyframes on the ball.
| | 01:06 | However, I do want to verify that my
Rigid Bodies Solver is globally disabled
| | 01:11 | so I don't have any performance issues.
| | 01:12 | I'll just verify it by going to Modify>
Evaluate Nodes and we'll turn that Rigid Bodies off.
| | 01:20 | I just create keyframes in the ordinary way,
position keys in this case for that sphere.
| | 01:26 | By the way, you'll see once again that
these channels are highlighted in yellow
| | 01:30 | and ordinarily that means that there's
some incoming connection that's taking
| | 01:34 | over your ability to keyframe.
| | 01:37 | However that's a little bit misleading.
in the interface here. That yellow color
| | 01:42 | does not indicate that there's some
incoming connection that's preventing us
| | 01:46 | from keyframing the object.
| | 01:48 | It simply means that those attributes
are connected to something currently and
| | 01:53 | they're connected to the Rigid Body
node, but the Rigid Body node active
| | 01:56 | attribute is turned off.
| | 01:58 | That means we can go ahead and
keyframe this and not worry about any
| | 02:02 | problems coming up.
| | 02:03 | I do want to keyframe it just in X and
Z once again and on Frame 1, I'll select
| | 02:09 | X and Z and key those attributes.
| | 02:13 | I'll go to a later point in time like
let's say Frame 12-- see that in the Top
| | 02:18 | View-- it's a little bit clear, grab
that Move tool and in half a second, how far
| | 02:23 | will it have traveled? Let's say about
quarter of the way down the length of the alley.
| | 02:29 | And I want to key those attributes once
again and rewind that, play it back and
| | 02:35 | you can see, boom, the ball is
moving down the alley, as we expect.
| | 02:40 | Now I don't want any weird interpolation here.
| | 02:43 | I want that to just be a
straight line and I want it to be a
| | 02:47 | linear interpolation.
| | 02:49 | With that sphere selected, once again
I'll go into the Animation Editor>Graph
| | 02:54 | Editor and I want to press the F key to
frame those curves and select them and
| | 02:59 | this time I want linear
interpolation, so I'll choose Linear Tangents.
| | 03:04 | Now the ball will move in
a perfectly straight line.
| | 03:07 | So that's the first part.
| | 03:08 | Now the second part that's really
fun is to enable the active attribute.
| | 03:13 | I'll scroll down here and
here's the active attribute.
| | 03:16 | It's currently off and on Frame 1, I want to
key it off, select the name and key selected.
| | 03:24 | We have animation up until Frame 12
and what we need to do is we need to
| | 03:30 | reenable the attribute while the
object is in motion in order for this to
| | 03:35 | actually take over and inherit the
vector-- in other words, for it to know what
| | 03:42 | direction the object is moving and how fast.
| | 03:45 | In order for that to work correctly,
we can't key the attribute back on after
| | 03:50 | the animation is finished, we
need to go back a couple frames.
| | 03:54 | The second keyframe here was on Frame 12.
| | 03:57 | I'll just go back to Frame 11 and on
Frame 11, I'll key the active attribute on,
| | 04:04 | typing in a 1, press Enter,
select the name and then key it.
| | 04:11 | By the way you will notice that you
don't see the keyframes for the actual
| | 04:16 | Transforms in the Timeline here.
| | 04:19 | It's just a quirk of the interface.
| | 04:21 | We don't see the keyframe on Frame 12
here, we only see the keyframes for the
| | 04:27 | actual Rigid Body Shape node.
| | 04:29 | But if we go into the Graph Editor
once again, we will see all those keys and
| | 04:34 | we have got Translate X here and that's
got keyframe data on it and we have got
| | 04:39 | the active attribute here as well and I
want to select that and press the F key
| | 04:45 | and you can see that the active attribute is
binary, in other words it's only on or off.
| | 04:49 | There is no possibility of a
transitioning with an interpolation any of
| | 04:54 | these tangent types.
| | 04:55 | It will always be a step tangent, because
active is binary. Rewind and play that back.
| | 05:02 | Cool!
| | 05:03 | So now let's try seeing what we get here.
| | 05:05 | Tap the Spacebar, go back out to our four
-viewport layout and then we'll go back
| | 05:10 | and reenable the Solver, Modify>
Evaluate Nodes>Rigid Bodies. Rewind and play
| | 05:17 | that back and you can see that in
fact the Dynamics have taken over.
| | 05:23 | I only animated the ball from Frame 1
to 12 and then I have turned the active
| | 05:27 | attribute on, on Frame 11.
| | 05:31 | We don't see the ball falling to the
ground, because it is not connected to
| | 05:34 | gravity and that's easily fixed, select
the ball, select the Gravity field, then
| | 05:40 | go to Fields>Affect Selected
Object(s), rewind and play it back.
| | 05:47 | It's basically doing what I want.
| | 05:48 | If I wanted a more realistic result of
course, I would probably want to animate
| | 05:53 | the ball in Y, so it would fall
instead of just flying through the air.
| | 05:58 | But that is a very good illustration of
how we can keyframe the active attribute
| | 06:03 | to combine traditional
keyframe methods with Dynamics.
| | Collapse this transcript |
| Baking the simulation to keyframes| 00:00 | We've had a lot of fun playing
with Creating Dynamic Simulations.
| | 00:04 | When we're ready to actually render
the animation, we'll need to perform a
| | 00:08 | process called baking.
| | 00:11 | Baking is converting the dynamic
simulation into traditional keyframes.
| | 00:16 | It's not an optional step; it's
something that you have to do in Maya.
| | 00:20 | If you forget to do this and you go
ahead and render your animation, there is
| | 00:25 | a good chance that what you get back
from the rendering will not be what you
| | 00:29 | saw in the viewports.
| | 00:31 | There are a lot of reasons for this.
| | 00:33 | One is that the simulation is history
dependent and that means that what happens
| | 00:38 | on let's say, Frame 5, depends directly
upon what happened on Frame 4 and those
| | 00:44 | calculations might be different
each time the simulation is run.
| | 00:48 | We've had pretty good luck, here
with this exercise, but you'll see that
| | 00:52 | it's pretty common that you may play
the same simulation twice in a row and
| | 00:57 | get different results.
| | 00:59 | Additionally, especially for heavy
scenes your render times will be much longer
| | 01:04 | if you forget to bake the simulation.
| | 01:06 | And that is once again,
because it's history dependent.
| | 01:09 | If we're on Frame 100 of our batch
render, we have to actually calculate every
| | 01:15 | frame of the simulation from Frame 1 to
Frame 99 before we can calculate frame
| | 01:19 | 100. Then, we get to Frame 101, we have to
recalculate everything from Frame 1 to Frame 100.
| | 01:26 | So that means as your animation
progresses through the batch render, each frame
| | 01:31 | is going to take longer and
longer and longer to render.
| | 01:34 | The solution to this is simple.
| | 01:36 | You just bake the simulation which
will convert the Dynamics into actual
| | 01:40 | keyframes which you can then edit if needed.
| | 01:44 | To bake the simulation you need
to select the active rigid bodies.
| | 01:49 | Before you bake the simulation, set your
Timeline up. I'll play this through and
| | 01:53 | figure out when I need my Timeline to stop.
| | 01:57 | When all those pins settle down is
approximately Frame 120. I'll set the end of
| | 02:03 | my playback range to Frame 120 here.
| | 02:06 | Then I want to select all the objects
that are going to move in the simulation.
| | 02:12 | In other words, all the active rigid
bodies, and in this case it's simply the
| | 02:17 | ball and those ten pins.
| | 02:20 | If you're not sure what's selected you
might want to go into the Outliner and
| | 02:23 | verify that you selected just the
ball or just the dynamic objects that are
| | 02:28 | moving in this case the ball and those ten pins.
| | 02:31 | To bake the simulation I want to go
into the Edit menu and there's a section
| | 02:36 | that says Keys and you
want to go to Bake Simulation.
| | 02:40 | Let's open the Option box
for that and look at it.
| | 02:43 | We don't really need to change anything
in here, but I just wanted to show you
| | 02:47 | that you have the option to bake a
different time range if you needed to.
| | 02:51 | It defaults to the entire time slider, but
could bake a different range if we wanted.
| | 02:56 | And by default it's going to bake all of
the selected objects and all of the channels.
| | 03:03 | Go ahead and click the Bake button.
| | 03:06 | The simulation will play through once
and then when it's finished you'll notice
| | 03:12 | that for any selected object that has
keys on it there is a keyframe on every
| | 03:16 | single frame, but that's what we have to do.
| | 03:19 | We do need to do a little bit of
cleanup here, because as I said the default
| | 03:24 | behavior of the Bake Simulation tool is
to keyframe all of those attributes even
| | 03:31 | stuff that wasn't even animated.
| | 03:33 | We'll go back into the Edit menu
and we want to go to Delete All by
| | 03:38 | Type>Static Channels.
| | 03:41 | A Static Channel is some animation
curve that has a flat line, in other words
| | 03:47 | all the keyframes have the same value
and the channels of value is not changing
| | 03:52 | therefore it's static and I want to
delete all Static Channels for the entire
| | 03:58 | scene and so you see these all change
back to white indicating there is no
| | 04:03 | keyframe data there.
| | 04:05 | Now check this out, I can scrub
through my animation now. That's a new
| | 04:09 | functionality that I did not have
before and that's important too, because if
| | 04:14 | you're animating a character for
example and that same scene has dynamics in it
| | 04:19 | you want to either bake the
simulation or disable the Rigid Body Evaluation
| | 04:24 | while you are trying to animate your character.
| | 04:27 | So that's baking simulations.
| | Collapse this transcript |
| Deleting all rigid body nodes| 00:00 | We've baked the simulation and now
we can be reasonably sure that we will
| | 00:05 | get reliable playback.
| | 00:06 | Every time we play the simulation we'll
get the same result and we render what we
| | 00:11 | see is what we will get.
| | 00:13 | But there's one little piece of garbage
collection we need to do here, because
| | 00:16 | if you notice when I press play it
doesn't really play quite in real time and
| | 00:22 | when I scrub through here, there
is just a slight performance hit.
| | 00:26 | If this were heavier scene it would be
more obvious, but sometimes you might
| | 00:30 | bake the simulation and then try to play it
and it's still just as slow as it was before.
| | 00:35 | And the solution to this is to actually
just blow away all the Rigid Body nodes
| | 00:40 | and delete them completely.
| | 00:42 | You could disable Solver Evaluation,
but I don't recommend that, because that
| | 00:46 | state of the Solver Evaluation
might get toggled back on again.
| | 00:51 | It's better to simply just delete all the
Rigid Body nodes and just blow it all away.
| | 00:56 | If we need to we can get back to an earlier
version if we just saved before we do this.
| | 01:01 | I am going to go ahead and do the
command that's going to be found in the Edit
| | 01:05 | menu, Delete All by Type, and down
near the bottom you'll see Rigid Bodies.
| | 01:12 | Click on that and you will notice that
all of the little Xs that indicated the
| | 01:16 | centers of mass of all the
objects have all disappeared.
| | 01:20 | Now I can scrub through here and I
don't have any performance issues.
| | 01:25 | This is now a version that I want to render.
| | 01:28 | You will see that I have got a
couple fields still floating in here.
| | 01:31 | I could delete them as well, but
currently they're not hurting anything, because
| | 01:35 | there's no Rigid Bodies for them to affect.
| | 01:37 | That's the workflow for a
finishing up a Rigid Body Simulation.
| | 01:42 | You have got to bake the simulation
and then delete all the Rigid Body nodes.
| | 01:47 | But don't forget to save your Dynamic
version of that before you delete the
| | 01:52 | Rigid Bodies, because if you overwrite
your file having deleted the Rigid Bodies
| | 01:57 | you'll never be able to get
back in order to make changes.
| | Collapse this transcript |
| Editing keyframes in the Graph Editor| 00:00 | Before rendering an animation that
was created with a Dynamic Simulation we
| | 00:05 | might need to clean up the keyframes a bit.
| | 00:07 | In this case, at the very end of the
animation the pins are kind of dancing
| | 00:11 | around a little bit.
| | 00:12 | Let me maximize this view by
clicking it and tapping the Spacebar.
| | 00:18 | I'll go down towards the end of the animation.
| | 00:20 | You'll see after about Frame 110 the
pins should really be sitting static on the
| | 00:26 | ground, but they are kind of
wiggling around and moving around a bit.
| | 00:30 | I can easily fix that by just
deleting those keyframes at the end.
| | 00:34 | I want to select all the pins, make
sure I have selected nothing else, and then
| | 00:39 | just scrub down here and I can figure
out when I want to delete those keys.
| | 00:44 | Let's say after Frame 110.
| | 00:47 | To delete the keys I want to select
them first, hold down the Shift key, and
| | 00:51 | then click-and-drag across the
keyframes you want to delete.
| | 00:56 | Now they are selected.
| | 00:57 | If I press the Delete key on the
keyboard now, I'll actually delete the
| | 01:01 | bowling pins themselves.
| | 01:03 | I don't want to do that.
| | 01:04 | I just want to right-click on this and
choose Delete and now after Frame 109
| | 01:12 | there's no motion here.
| | 01:14 | However, you'll notice that they
kind of suddenly come to a stop.
| | 01:17 | They're dancing and wiggling around a
little bit between Frame 100 and 110 and
| | 01:25 | at Frame 109, boom, they just suddenly stop.
| | 01:29 | What I want to do clean that up is I
will leave this keyframe at Frame 109, but
| | 01:32 | maybe I'll delete
everything from Frame 102 to 108.
| | 01:36 | If you are having a hard time
selecting those you might want to zoom in a bit
| | 01:41 | by changing the Range bar and I'll hold down
the Shift key and I will select those keyframes.
| | 01:49 | Now this is a bit misleading here.
| | 01:50 | When I go all the way out to here
that's not actually selecting Frame 109.
| | 01:54 | I'll right-click and Delete.
| | 01:57 | That Range bar only selects keyframes
that are completely enclosed within it.
| | 02:03 | That last Keyframe was actually on the outer
edge of the Range bar and so it was not selected.
| | 02:08 | I'll just play that bit.
| | 02:11 | So now we got a little bit more
graceful transition there at the end.
| | 02:14 | So they don't seem to suddenly come to a stop.
| | Collapse this transcript |
| Simplifying animation curves| 00:00 | Sometimes you'll need to really go
in and edit the simulation data after
| | 00:05 | it's been generated.
| | 00:07 | Maybe you need to change the trajectory
of an object, maybe you need to make it
| | 00:11 | go in a different place
than the simulation made it go.
| | 00:14 | In that case then you'll need to edit the
curves, and you do that in a Graph Editor.
| | 00:19 | Select that ball in this case and go
into Window>Animation Editor>Graph Editor.
| | 00:24 | You can see now when I press the F key
that we've got a keyframe on every single
| | 00:29 | frame, and it's going to be really
difficult to edit this data.
| | 00:33 | However, Maya gives you a
tool to simplify the curves.
| | 00:37 | I am just going to focus in on
one of these for simplicity's sake.
| | 00:41 | The ball>Translate X, which is its
position side-to-side and I'll press the F
| | 00:47 | key once again to frame that curve.
| | 00:50 | Because this has got so many points on,
it's going to be nearly impossible
| | 00:53 | for me to edit this.
| | 00:55 | But all I need to do is just select that
channel name and in the Graph Editor go
| | 00:59 | to the Curves menu and choose Simplify Curve.
| | 01:03 | There is an Option box for that and I
can open that up and you can see you could
| | 01:08 | a Time range and you could play around
a little bit with these tolerance values
| | 01:12 | and they will give you
slightly different results.
| | 01:14 | But I am just going to leave it
at the default values right now.
| | 01:17 | I will click Simplify. There you go!
| | 01:20 | We've got a much easier curve to work with now.
| | 01:23 | Now I want to show you that the way that it
does it is not quite optimal in all cases.
| | 01:29 | Let me zoom in a little bit here with
Alt and right-mouse and just position the
| | 01:35 | curve with Alt and middle-mouse.
| | 01:38 | I just want to undo that last Simplify Command
so we can compare the before and after results.
| | 01:44 | I'll hit Ctrl+Z or just Z and that's
before the Simplify and then Shift+Z that
| | 01:51 | will redo the Command and you can see that
it actually changed the shape of the curve.
| | 01:56 | If I get in a really close on this we
can see that maybe even more clearly.
| | 02:01 | Once again it's Z to undo and Shift+Z
to Redo, and it definitely changed the
| | 02:08 | shape of the curve, especially
here that's where it's most obvious.
| | 02:13 | What's happening is Maya is basically
rebuilding the curve and these keyframes
| | 02:19 | initially all had autoTangents on them.
| | 02:23 | When we did the initial bake command,
we got a keyframe on every single frame
| | 02:28 | and they all had so-called
"autoTangents", which is what you see here.
| | 02:33 | Then when we simplified the curve, it
didn't have any information before Frame 1,
| | 02:39 | so it didn't know how to set the tangents.
| | 02:43 | Here on this one for example you'll see
that tangent is set properly in order to
| | 02:48 | try to maintain the shape of the
curve instead of a flat tangent.
| | 02:52 | This would be bad if we got this
result out from the Simplify command.
| | 02:57 | But we didn't get that.
| | 02:58 | What we got is more or less an automatic curve.
| | 03:01 | Once again because there was no
data before Frame 1, then Maya didn't
| | 03:06 | know what to do there.
| | 03:07 | However, we can fix that really easily.
| | 03:09 | We can select that keyframe and we
can set it to a different tangent type.
| | 03:15 | We can play around with these or maybe
we could just select that tangent and
| | 03:20 | then use the Move tool.
| | 03:22 | We got the Move tool here and
then just set that manually.
| | 03:27 | In any event, after you've simplified you
will need to go in and check the results.
| | 03:32 | So now I have the ability
to completely fine-tune this.
| | 03:35 | Maybe I want the ball to move further
over to the right and then swing back
| | 03:40 | in towards the center.
| | 03:42 | To do that I could just
change the value of these keys.
| | 03:45 | I could grab one of these and with the
Move tool I only want to change the value
| | 03:51 | not the time of the keyframe.
| | 03:53 | So I'll hold down the Shift
Key and click-and-drag here.
| | 03:57 | And it helps if I position my
Timeline on that frame so I can see where
| | 04:02 | that's going to land.
| | 04:03 | Now you can see I've pushed
that farther over to the right.
| | 04:06 | Maybe I'll do the same with this one
holding down Shift and just move that up a bit.
| | 04:11 | Now it's describing a better arc through space,
at least in the first half of the animation.
| | 04:18 | I can delete the keys as
well too if I don't like them.
| | 04:22 | So I can just select that key
and just press the Delete key.
| | 04:27 | I want to maintain that same value
at that point of impact on Frame 28.
| | 04:32 | That's kind of sacred so I want to
make sure that one stays the same there.
| | 04:36 | But maybe this one key had moved up
a bit to get a more graceful curve.
| | 04:40 | Let's check our results.
| | 04:44 | That's a pretty good arc I could fine-
tune that a little bit more and make it
| | 04:49 | better, but essentially that's how
you can edit keyframes on the dynamic
| | 04:52 | simulation after you've baked them.
| | 04:56 | And that concludes our chapter on
integrating keyframes with Rigid
| | 04:59 | Body Dynamics.
| | Collapse this transcript |
|
|
4. Applying Dynamic ConstraintsUnderstanding dynamic constraints| 00:00 | In our final chapter on Maya Rigid
Bodies we are going to look at Constraints.
| | 00:05 | We will be using Animation Constraints,
but more importantly we will be using
| | 00:10 | Dynamic Rigid Constraints.
| | 00:12 | Here's a Newton's cradle animation
that I've created using Rigid Bodies.
| | 00:17 | This is an automated animation.
| | 00:19 | There are no keyframes.
| | 00:20 | There's actually one keyframe
which is on a Spring Constraint.
| | 00:25 | It's on a hidden layer here.
| | 00:26 | So I'll open that up to make it visible.
| | 00:29 | That's the so-called "spring."
| | 00:32 | There is actually one keyframe on that
spring in order to enable or disable its
| | 00:37 | ability to pull the
sphere over. I'll rewind that.
| | 00:43 | And when the constraint turns off you'll
see that that turns into dashed line.
| | 00:48 | That's the only keyframe I
have in the whole animation.
| | 00:53 | Then to keep these spheres in
place I've used Hinge Constraints.
| | 00:57 | So those are all on hidden layers as well.
| | 00:59 | I'll make that visible and these are the
constraints that are holding those spheres.
| | 01:03 | You'll notice that they're positioned
directly above the spheres and you will notice
| | 01:09 | that they're not in the same position as
these polygon cylinders which are meant
| | 01:13 | to represent the wires.
| | 01:16 | In fact these cylinders are not dynamic,
they're just plain ordinary polygon
| | 01:21 | cylinders, and I've used an Aim Constraint
to merely point the cylinders at the spheres.
| | 01:29 | So these are not actually dynamic.
| | 01:30 | They're just there for show.
| | 01:32 | So let's look at the scene without
any of those constraints applied.
| | 01:36 | I can go to File>Open Scene and I
have got it here in the Exercise Files.
| | 01:41 | Here it is, 04_01_start.
| | 01:44 | And this again has no
constraints in it currently.
| | 01:47 | But what I have done here in advance
is I have moved the pivot points of the
| | 01:52 | spheres and the cylinders so that
the Aim Constraint will work properly.
| | 01:56 | Notice that the pivot point for the
sphere is right at the top of the sphere
| | 02:01 | and I know that because I have got the Move
tool selected and then selected this sphere.
| | 02:06 | That's so that this cylinder
will point exactly at that location.
| | 02:10 | The Aim Constraint will always point at
the pivot of the constraining object.
| | 02:15 | I've also moved the pivot points of the
cylinders themselves as you can see here.
| | 02:20 | If I turn on the wireframe by hitting the 4
key, you can see that a little bit better.
| | 02:24 | I've moved the pivot point of the
cylinder up to the very top of the cylinder,
| | 02:28 | because that's the point
around, which we needed to rotate.
| | 02:31 | Press the 5 key, go back to Shaded Mode.
| | 02:34 | Let's add the Aim Constraint.
| | 02:35 | To add an animation Aim Constraint you
want to be in the Animation menu set and
| | 02:41 | select the Constrainor, or the thing
that's the leader, and that's the Sphere in
| | 02:45 | this case and Shift+Select the
constrainee-- the thing that's going to be
| | 02:49 | constrained or the follower. Go up to
the Constrain menu, and we want to go to
| | 02:55 | Aim, but let's open up the Option box here.
| | 02:59 | If I just hit up Apply here I
probably won't get the results that I want.
| | 03:02 | As you see it's pointed in the wrong direction.
| | 03:06 | I'll give focus to the main window
and press the Z key to undo that.
| | 03:10 | I just need to play
around with these Aim vectors.
| | 03:13 | In this case I want the negative -Y axis
of the cylinder to point towards the sphere.
| | 03:19 | To do that I want change
these Aim vector values.
| | 03:22 | The X Aim vector will be 0, the Y Aim
vector will be -1, and the Z will be 0.
| | 03:31 | I want to change the type of vector.
| | 03:33 | In other words, this is determining
which way is up in my world I want to choose
| | 03:37 | Scene Up in this case.
| | 03:38 | Now let's try that.
| | 03:40 | I'll click Apply and that seemed to
work and with the cylinder selected you'll
| | 03:45 | see that these Rotate channels are in
blue indicating that there's an incoming
| | 03:48 | constraint on those channels.
| | 03:51 | If I pick up the Sphere and move it, you
will see that now the cylinder is following.
| | 03:55 | I'll hit Ctrl+Z. I want to do
the same for the other side here.
| | 04:00 | This one is going to be a little bit
different, because the pivot point on these
| | 04:04 | is not actually aligned
as it is on the left side.
| | 04:06 | So these are little bit different.
| | 04:08 | If I use the same settings here and
try to make this happen, it won't work.
| | 04:12 | Select these sphere, select the cylinder,
and press Apply, and you'll see it's off.
| | 04:18 | The reason is that I needed to
enable this Maintain Offset switch.
| | 04:22 | So once I'll focus in the main window,
press the Z key to undo, turn on this
| | 04:27 | Offset switch, and really that
probably should be on in most cases.
| | 04:32 | Go ahead and click Apply.
| | 04:34 | That seemed to work.
| | 04:35 | I'll select the sphere and move
that around and now those cylinders are
| | 04:39 | following these sphere properly.
| | 04:41 | Press Z to undo that movement.
| | 04:43 | I can close this and to repeat that
process for the rest of these objects I
| | 04:47 | can just use the G key.
| | 04:50 | I'll select the sphere, select the cylinder,
and press G. That just repeats the last command.
| | 04:56 | I'll just go down the line and do all those.
| | 04:58 | I've created all those constraints.
| | 05:03 | I just want to test each one of these
spheres and make sure that it's doing
| | 05:07 | what I think it's doing.
| | 05:09 | Pressing Z each time to undo. That's that.
| | 05:13 | It looks like we've got Aim Constraints in place.
| | Collapse this transcript |
| Creating dynamic objects| 00:00 | Heading out of those Aim
Constraints now I am ready to create Dynamics.
| | 00:04 | I'll go to the Dynamic menu set and
I want to make all of these spheres
| | 00:08 | active rigid bodies.
| | 00:09 | So I'll just select all those spheres, go
up to Soft/Rigid Bodies, and Create Active.
| | 00:14 | We also need to have gravity applied.
With those spheres still selected,
| | 00:19 | I'll go up to the Fields
menu and choose Gravity.
| | 00:23 | And there's my Gravity node and move
that out of the way a little bit, rewind
| | 00:27 | and play my simulation, you'll see
that the spheres are falling and they're
| | 00:31 | falling very, very slowly.
| | 00:33 | And the reason for that is that I've
built my scene at 1:1 scale and the
| | 00:37 | gravity is expecting
this scene at 1:100th scale.
| | 00:41 | To correct for that now, I'll select
that Gravity field and in the Channel box
| | 00:45 | I'll set that Magnitude to 980.
| | 00:49 | Now I've got physically accurate behavior.
| | 00:52 | Those spheres are real-world size and
they're only an inch or two above the ground.
| | 00:56 | So it wouldn't take them very
long to fall to the grid plane.
| | Collapse this transcript |
| Creating a Hinge constraint| 00:00 | Currently, we've got Rigid Body
nodes applied to all these spheres and we
| | 00:04 | attached them to Gravity
nodes and now they're falling.
| | 00:08 | You want to keep them in place. I'll
select one of these spheres, and in the
| | 00:12 | Dynamics menu set I'll go up to Soft/
Rigid Bodies and you'll see various types
| | 00:18 | of constraints listed here.
| | 00:20 | In fact they're all the same
node type with different settings.
| | 00:23 | In this case, I want to choose a
flavor Create Hinge Constraint, select that.
| | 00:29 | And now inside this sphere located
right at its center of mass is a hinge.
| | 00:34 | I'll get in closer by pressing F key
and hit the 4 key, so we can see wires.
| | 00:40 | Here is our wireframe
view, and that's the hinge.
| | 00:44 | I've built my scene, so that the hinge
will be oriented in the correct direction
| | 00:48 | to begin with and I will move that up.
| | 00:53 | Let's go out to the front view and move
that up in the front view, so that it's
| | 00:57 | right at the top of those cylinders there.
| | 00:59 | I don't need to rotate the hinge in this case.
| | 01:02 | It should work just fine.
| | 01:04 | The object will swing in this direction.
| | 01:06 | If I had turned the hinge in some
other direction then that would cause the
| | 01:10 | object to swing that way,
Ctrl +Z to undo that. Okay.
| | 01:15 | I'll press 5, so I can see Shaded View.
| | 01:18 | Rewind and Play the simulation,
you'll see that one is holding in place.
| | 01:22 | And it's swinging in this axis, very slightly.
| | 01:26 | All right, I just want to repeat
that process for the rest of these.
| | 01:30 | Go up and add that Hinge Constraint.
| | 01:32 | In fact I can use the G key once again
and go around and just select and then
| | 01:37 | press G, select and press G, select and press G.
| | 01:42 | Now I have got all those
Hinge Constraints built.
| | 01:45 | I can select them easily using Window
Outliner and here are my Hinge Constraints.
| | 01:50 | I have already moved the first one, so
I just want to select 2 through 5 and
| | 01:54 | then grab the Move tool and position those up.
| | 01:58 | Let's look at that in this front view.
| | 02:00 | I want to try to position these all
so they are about at the right place.
| | 02:05 | So they're all at about
the same location. Cool!
| | 02:07 | Let's see what we've got. Alright!
| | 02:12 | So it looks like we've got our Hinge
Constraints in place and they're all
| | 02:15 | oriented in the right direction
causing those spheres to swivel and turn and
| | 02:21 | move in the X axis of the scene.
| | Collapse this transcript |
| Creating a Spring constraint| 00:00 | Our simulation is mostly set up.
| | 00:03 | We just need to give it a kick to get
these spheres moving on a Newton's cradle.
| | 00:08 | We do that in lots of ways.
| | 00:10 | I'm choosing to do that with a Spring
Constraint to illustrate how that works.
| | 00:13 | I'm going to select that center
sphere and add a Spring Constraint.
| | 00:18 | Soft/Rigid Bodies>Create Spring Constraint.
| | 00:23 | Let's zoom in on that, I'll press the
F key, press the 4 key and it is just a
| | 00:28 | tiny little locator: that's the spring.
| | 00:32 | And you'll see that there is a line
connecting the spring to the object's center of mass.
| | 00:37 | I want to move that spring way out and
just moving it in the X and Y axis, not in
| | 00:41 | Z. I want it to maintain this symmetry here.
| | 00:45 | Move that spring out there. Rewind.
press the 5 key, so we can see that, and
| | 00:52 | press Play and you'll see it's
pulling a little bit, but it's pretty weak.
| | 00:57 | We need to increase the strength of that spring.
| | 01:00 | With the spring selected, I'll go to
the Channel box. Scrolling down you'll see
| | 01:04 | spring stiffness. Let's turn
that up maybe 100 or even higher.
| | 01:09 | Rewind and play that back and you
can see with the stiffness of 100, it's
| | 01:13 | trying to pull those spheres towards it, but
it's not oscillating and bouncing around there.
| | 01:19 | What we want is we want that to
just pull straight up and hold.
| | 01:23 | To accomplish that, I'm going to give it a
really high spring stiffness of about 500 or so.
| | 01:29 | So rewind and play that back and you
can see that that's really pulling them up
| | 01:33 | there, but we're still
getting that funky oscillation.
| | 01:37 | We can tone that down by applying
some Damping. So here's Damping.
| | 01:42 | And let's try value of 100 for Damping.
| | 01:46 | That's a very high value, but we need a high
value to match the high value of that stiffness.
| | 01:52 | Rewind and play that back,
and that's much better.
| | 01:54 | That's about what I was trying to achieve.
| | 01:57 | And now what we want to do is
actually animate the Constraint.
| | 02:00 | We can turn it on and off at will.
| | 02:02 | I want it to be on at the
beginning of the animation.
| | 02:05 | So on Frame 1 the Constraint attribute is on.
| | 02:08 | I want to go ahead and keyframe that.
| | 02:11 | Right-click and Key Selected.
| | 02:13 | Let that play through for a couple of seconds.
| | 02:17 | Now I let my Timeline go
to about Frame 48 or so.
| | 02:20 | I can step forward one frame at a time,
if I want, or of course I can disable
| | 02:25 | Solve or Evaluation.
| | 02:26 | But I'm just going to choose to step forward
one frame at a time until I get to Frame 48.
| | 02:32 | And with my Timeline at Frame 48 I
want to animate the Constraint off.
| | 02:38 | I'll select the value and type in a 0,
turn it off, then select a name and
| | 02:43 | right-click Key Selected.
| | 02:46 | If we look at this in wireframe, it's
easier to see that in fact that's got a
| | 02:50 | dashed line now indicating that
the Constraint value is disabled.
| | 02:55 | Play that back: see what we get.
| | 02:56 | We don't quite have the behavior that
we want as far as the bounciness and
| | 03:01 | the movement of those spheres in
the Newton's cradle, but we have this
| | 03:06 | structure working and we're just
going to then fine-tune that and we'll do
| | 03:10 | that in the next movie.
| | Collapse this transcript |
| Fine-tuning attributes| 00:00 | The basic structure of our simulation is
in place, but as you can see, we're not
| | 00:05 | seeing physically accurate results and
we're just going to then fine-tune that.
| | 00:09 | If we pulled this sphere over and let
it go, it would actually continue moving,
| | 00:14 | It would push these other two out of
the way. And to do that interesting thing,
| | 00:18 | where it will do three
and two and three and two,
| | 00:21 | we need to just adjust some
attributes to make that happen.
| | 00:24 | Mainly, it's all about the
Bounciness and the Damping for these spheres.
| | 00:28 | I'll go ahead and select all those
spheres and go into the Channel box, looking
| | 00:34 | for the Rigid Body Shape node and we've
got Bounciness, Damping, and Friction.
| | 00:42 | I need a high bounciness here.
| | 00:43 | I really need those to push each
other around with quite a lot of strength.
| | 00:48 | We don't want a Bounciness of 1
| | 00:50 | because that would actually create kind
of a perpetual motion machine where it
| | 00:53 | would never really settle down.
| | 00:55 | I want a Bounciness of nearly 1.
| | 00:58 | And I've tested this quite a lot and
spent quite a bit of time trying to get
| | 01:02 | this to do exactly what I need.
| | 01:04 | And I think the Bounciness
of 0.99, is going to work.
| | 01:07 | Rewind and play that back and see what
I get. That's better. It's not perfect.
| | 01:15 | It starts out okay, but
then it kind of gets weird.
| | 01:19 | We can help that along by just
giving it a little bit of Damping.
| | 01:22 | And remember Damping is a chill out
factor that just reduces the amount of
| | 01:27 | inertia carried over to the next frame.
| | 01:30 | I'll give it a pretty
conservative Damping of let's say 0.3.
| | 01:36 | Rewind and Play that back, that's better.
| | 01:41 | It's carrying on a little
longer with what I was hoping to see.
| | 01:46 | I don't actually want any friction here.
| | 01:48 | We don't want to lose energy in the process.
| | 01:51 | So I'm going to set the frictions-- Static
and Dynamic-- both down to 0. Play that back.
| | 01:59 | That's pretty good.
| | 02:00 | It's not perfect, but it'll never be perfect.
| | 02:03 | And in fact, actually in Maya, if I
wanted to make this Newton's cradle carry
| | 02:08 | onward for a much longer period of
time, then I would have to do it through
| | 02:12 | traditional animation.
| | 02:13 | The Dynamic's engine is really not
quite accurate enough to produce that
| | 02:19 | accurate-looking result, but this is a
good demonstration of how Constraints work.
| | 02:23 | We can play around a little bit with the
solver settings and we might be able to
| | 02:28 | get a better result by doing that.
| | 02:30 | Remember it's here in the Solver
menu and Rigid Body Solver Attributes.
| | 02:35 | And these are just the default
values, currently Step Size and
| | 02:39 | Collision Tolerance.
| | 02:40 | Step Size, remember is the time base
accuracy and Collision Tolerance is the
| | 02:45 | spatial accuracy and
lowered numbers are more accurate.
| | 02:49 | In the bowling alley scene that we did
in the previous chapters, we got better
| | 02:53 | results by reducing the
accuracy, by increasing these values.
| | 02:59 | Here, what I found is that it works
better if I increase the accuracy by
| | 03:04 | reducing the values.
| | 03:06 | And if I knock this down to Step Size
or time accuracy of 0.001, what that will
| | 03:14 | do is create more time samples.
| | 03:16 | We want to see if that give me any change.
| | 03:18 | It didn't seem to really help, so I'm
not really going to push my luck here, I'm
| | 03:25 | going to put that back up at 0.3.
| | 03:28 | It takes quite a long time to test
out systems like this, especially if
| | 03:32 | they've got a lot going on.
| | 03:34 | And it does become a little bit tedious
sometimes and you won't be able to get
| | 03:39 | exactly what you had in your head,
but you can get pretty close.
| | 03:43 | And that concludes our chapter
on applying Dynamic Constraints.
| | Collapse this transcript |
|
|
ConclusionGoodbye| 00:00 | That concludes our training course in
Creating Simulations in Maya Dynamics.
| | 00:05 | I hope you've enjoyed this as
much as I've enjoyed creating it.
| | 00:09 | Maya Dynamic Rigid Bodies are admittedly not
the fastest or the newest option out there.
| | 00:15 | But as I've shown you in this course,
you can work around those by using
| | 00:19 | proxy objects and so on.
| | 00:22 | Once again, I want to thank you for
watching this training course and bid you goodbye.
| | 00:27 | So goodbye!
| | Collapse this transcript |
|
|