Tip:
Highlight text to annotate it
X
(music)
Donald: Hey everyone. Thanks for watching 3dmotive.com.
This is Donald and in this video we'll be covering how to create a junk pile using Reactor
and a handful of the features in 3DS Max 2010.
This tutorial is intended for beginner to intermediate levels and it assumes
that you know a little bit about object creation, 3DS Max navigation and basic editable
polygon functions.
By the end of this video you should have a knowledge of how to use Reactor
in conjunction with your created 3D props to create a convincing junk pile
like what I have here.
So the goal of this tutorial is to basically show you how to use the Reactor
Physics Simulator to create a series of key frame animations for each
of these objects and we will basically make them fall into a collection area,
which is going to give it a very convincing result as if it were actually falling
down into a giant pile.
Now, if you can imagine trying to hand place each of these objects
one by one, it could probably take you a considerable amount of time,
but if you know how to use the Reactor Simulator you can quickly and easily
apply a series of key frames of animation onto these objects and have them all fall
into very, very interesting pattern.
These methods will apply to just about anything you can think of
so feel free to get creative.
The first step in this process is going to actually have some 3D objects to work with.
What I have here is an old tire, rusty can, some cinder blocks, rebar pipes
and some bricks.
Now the next thing that I'm going to want to do is I'm going to want to
go ahead and make a whole bunch of instances or copies of my objects
and line them up in such a way that if the objects were to fall straight down
all of these objects would fall down into a specified mesh that I have
set up over here.
Now, the point of this object specifically is so that when we apply gravity and run
the Reactor Simulator all of these objects are basically going to fall down
into this circular shape that I have created to create a nice convincing junk pile
in sort of a random round shape.
Now, you could easily use these techniques against a corner wall for example
or if you wanted to just lay everything out completely flat.
I tend to use the rounded circular shape to begin with because that allows a lot
of the objects not to fall out of the world, and everything to kind of tidily clump
up right here in the center of this object.
What you're going ot want to do is ensure that you have all of our objects lined up
in such a way that if the objects were to fall straight directly down
they would fall down onto your specific mesh.
The other thing that you're going to want to watch out for is to make sure that you look at
it from a top view as well to assume that for example this tire if it was way out over
here it would probably fall outside of our catch mesh that we have set up.
Make sure that you do that last little check before you start getting into the specifics.
One other rule of thumb that's very important is you make sure that none of
your objects are interpenetrating.
What I mean by that is for example if I take this tire and I shove it directly into this tire
or these bricks what's going to happen is Reactor is going to give us some error
messages whenever we try to run it.
It's going to tell us hey, you know, you've got some objects interpenetrating
and it may cause some errors whenever you decide to run it.
A quick and easy rule of thumb is going to be go ahead and just make sure that
you space all of your objects out just enough that nothing is touching each
other and that will guarantee that you have a very clean and successful simulation
when you start using Reactor.
Once all of your pieces are in place and ready to drop we have two things
that we need to create and add into our scene.
The first one is a gravity object and the second one is a rigid body collection.
The gravity, it basically tells your scene just how heavy or light the gravitational pull
is for all of these objects as they fall, and then the rigid body collection
can basically be used to assign a specific set of parameters to each of your objects,
and we'll talk about that in just a second.
The first thing, in order to create a gravity object we want to go ahead and
go over to space warps and then make sure that we're in the forces pull down menu,
and then go ahead and create a gravity object.
To create it all you need to do is just left click anywhere in your scene.
It doesn't matter where this object is, it can be directly next to your objects
it's just a good idea to keep your scene nice and tidy because we will
be adjusting some of these values a little bit later.
So just hold down the left mouse button and then release and that will create the object.
The actual icon size, again, is irrelevant.
This is more just an aesthetic than anything.
The actual strength of the gravity force is going to determine just how strong
that gravitational field is.
By default what I'll do is I'll set the strength on this to about 20.
You're going to get different results whether you have a very low strength of gravity
or a very high strength of gravity so feel free to play around with some of
the values when you run your simulation and find out which one is going
to give you the best results for you.
Now the next thing we need to do is we need to create a rigid body collection
which will assign all of our objects to that collection.
The way that you do that is under the create tab also.
It's going to be under the helpers, and it's going to be under the Reactor pull down menu
under RB collection.
If we go ahead and click on that just like the gravity object all we need
to do is just left click anywhere in the scene and it's going to create
this RB collection object.
Then when you release the left mouse button there's your object.
The next thing that we need to do is we need to go ahead and add all
of these objects that we've created to this rigid body collection.
The way to do that is to go ahead and modify that object, and then down here
we're going to go ahead and click on add and this is going to bring up a popup
which is going to list all of the objects that you have listed in your scene.
If I click here I can go ahead and select all and press select and as you notice
all of those objects sort of popped up right over here under our RB collection properties.
Now, we don't need the gravity object so I can go ahead and delete that out, and now we're
pretty much good to go.
So, with our rigid body collection object and our gravity object, the next thing we
need to do is we need to go into the Reactor and we need to go ahead and
start playing around with some of the settings and go ahead and execute the command
to run the simulation and see how this junk pile is going to look when it falls.
The way to access it is over here under the utilities tab you should see an option for
Reactor.
Now if you don't see Reactor listed here you can always click on more, up here
on the top left and you may find it inside of here.
If you find it in here you can just go ahead and double click on it to open it.
Go ahead and click on Reactor and that's going to go ahead and bring up
the Reactor utilities.
Now, by default you may be set to havoc 1.
I'm going to go ahead and change mine to havoc 3, which is a little bit faster.
It's a little bit newer calculation.
It's going to give you a much quicker preview when you decide to start testing
this animation process.
There's a couple of things you want to go ahead and set first before we get into running
the actual simulation.
If you go ahead and expand the properties tab, this is going to give you some
different options based on mass, friction and elasticity.
Mass is basically going to tell you just how heavy or how light the objects are
going to be.
Now this works very similar to what we mentioned earlier with the gravity field.
You can adjust this parameter as needed, and you're going to get some different results for it.
The higher the number is the heavier the object is going to react.
The other thing to think about is down here at the very bottom since we don't want
this piece, this catch mesh to do anything we're basically going to zero out
all of these settings under mass, friction and elasticity.
I'll talk about friction and elasticity in a second.
What I'm going to do is I'm going to go into the front view, and I'm going to grab everything
in the scene except for that last one.
Go ahead and deselect that and make sure that I set all of these objects with a
mass at a specific setting.
Right now they're set to 20.
I'm going to go ahead and turn this up just a bit to about 100, and part of the reason
for that is when all of these objects fall we want a real heavy collection down here
at the bottom when everything clumps up.
Now friction is basically just going to be how smoothly all of the objects
interact with each other.
Down here on the bottom collection mesh we're actually going to set that back up
to about 5, and that's just to kind of give everything a little bit of slide
once everything falls down.
The rest of your objects you can leave everything to zero if you want,
and that's basically going to ensure that there's very little sliding going on
with your objects when they drop down inside here.
We don't want a bunch of stuff sliding all over the place and kind of jiggling
around down there.
So under friction we're going to go ahead and set that to 5.
Now elasticity is going to basically be just how bouncy the objects are.
If I turn this up really, really high everything is going to be very, very bouncy.
Maybe for the tires or if you had a bunch of rubber balls or something you
might set that elasticity really high whereas if you want to do a very hard
pile of blocks and concrete and stuff and you want everything not to bounce
we're going to go ahead and set that to zero as well.
Now here under inactive you can also set this, if you want an object's
property to be inactive and what that means is that the object will basically remain
completely still until something else hits that object.
For example, if you wanted to create a simulation of bricks, and you didn't want the bricks
down here at the bottom to do anything until the bricks up top smashed into them
you'd want to go ahead and turn on that inactive.
The other thing that we want to do is down here for our base mesh
we want to go ahead and turn that as inactive as well.
Since its mass is at zero it's basically going to be completely removed from
the gravity calculation.
The final step is to grab all of your objects and you want to assign everything
to a type of collision.
Now bounding box is going to be one of the most primitive of the types
of collision that the object would get.
For example if I zoom way in and you see the bounding box, which you can toggle
on and off with the J key, that's the basic primitive collision that you can possibly get.
For stuff like the blocks and maybe even the rebar pipes, the bounding blocks may be
just fine.
However, for something like these tires we're going to be wanting to use
something like a concave mesh, and what that means is that other objects can fall inside
of these objects.
If we just set it to bounding box anything would basically bounce and collide
with the bounding box, which means nothing would fall inside of the hole
that these tires have.
So, what I'm going to do is I would go through and I would, just individually, kind of select
what type of collision each of these objects would have, and then over here
under the Reactor under simulation geometry you want to go ahead and assign that.
For example, I'll just grab all these tires.
I want to make sure that those are set to concave mesh.
Then for the blocks we can probably get away with just using the bounding box.
One last thing to think about too though is with the concave mesh that is
going to be more expensive.
It's going to take a lot longer to calculate that.
Use with caution.
If you're doing a big pile of tires like this and all of them are tires,
the likelihood is you might not want a bunch of them to be able to fall into each other.
Maybe you just want to do a stack.
So play around with these settings until you find a collision setting that's fast for you,
and gives you the results that you want.
So, the final step with this is here inside of the Reactor if we go ahead and pull this up
just a little bit we're going to go ahead and run down to the utilities and we're
going to go ahead and click on analyze world.
This is basically going to give us any of those error messages that we
talked about.
What this is telling us here is it's telling us that there are some pieces that are interpenetrating.
So, your next step would be to basically address any of the issues that it says
that you have whether objects are interpenetrating, if something doesn't have
a collision type, lots of these things are types of errors that you would get here inside
of this message.
This is telling us that box 9, 10 and 11 are interpenetrating.
So if we go up to our list, we can quickly find those objects if we just
sort by name and then grab those objects and find out what's going on with them.
So go ahead and hit okay, and what's happening here is it's basically telling us
that the collision is colliding just inside of the catch mesh that we want
to go ahead and move these out of the way and just make sure that
they're kind of off to the side here.
We also need to make sure that our bottom mesh is set to a type of collision
as well, and we're going to go ahead and change this to a concave mesh
because we do want all of the objects to fall inside of them.
To preview the animation with our physics simulation, all we need to do is here
under the preview and animations tab is we need to go ahead and click on the
preview in window, and this is going to bring up a brand new window,
which is basically giving you a example of what your Reactor Simulation is
going to look like.
And if you go ahead and just press the P button as it says down here in the bottom
that's going to go ahead and run the simulation based on all of the settings that we've set.
What you're seeing is all of the objects are falling down here into our collection
mesh and this will be a good time for you kind of take a look at it and see
if there's anything weird going on, maybe your collection mesh is too small,
maybe some of your collision isn't working correctly.
This is basically giving you a preview of the simulation before you actually commit
the simulation to take place inside of your scene.
To navigate around all you need to do is just go ahead and scroll your mouse
back and forth or hold down the left mouse button to kind of drag it.
Now, once you've run the simulation you can always reset it by clicking
simulation reset then just kind of frame it and once again press the P key to go ahead and play it.
As this is playing I'm looking at what is happening down here also under the time counter
because when we go to actually commit the animation over here inside of Reactor
we want to go ahead and make sure that we give ourselves enough key
frames based on the amount of time that it takes for this simulation to run.
So if I go ahead and close this what we're looking at over here is we're looking at
the end frame.
This is basically the number of frames that that simulation took place.
Once again, if I go ahead and preview it and I play it what we're looking at is
basically how many seconds the animation takes for everything to collect
and for everything to be correct down here.
Now, I'm looking at probably about 15 seconds or so of time and in the basics
of animation that's approximately about 32 frames per second.
If we take 32 frames per second and we multiply that by 15 seconds
we get about 480 frames of animation that we'd be looking at.
Just to play it safe I'll set that to about 500 and go ahead and press enter,
and that's going to go ahead and set this up so that we have exactly 500 frames
of animation that's going to be created for our final animation because
basically what we're doing with the preview is it's just sort of giving us
a hint of what the final calculation is going to be, but when we click on create
animation that's basically going to actually commit the scene to making some changes.
So this is probably a good a time as any to go ahead and save your scene
because if you go ahead and click on that create animation it's going to give
you an error that says -
Not an error, but it's going to give you a popup that's kind of a warning
that says, "Are you sure you want to create an animation? This action cannot be undone."
So make sure that you save a copy of this file in the event that you decide
hey this didn't quite work out or maybe I want to try something else with it
before you actually commit to it.
We're going to go ahead and commit to it by clicking on create animation and then
press okay.
Then down here at the bottom you're basically going to get a preview bar
and what that's doing is that's essentially calculating very similar to how we did
in the preview, only this is doing it for real basically.
Once that done you can go ahead and press on close and then now by selecting any
of your objects you'll notice that this created all of these key frames of animation
and as you scrub the time bar back and forth here you'll notice that all of your
objects are starting to kind of fall down here in the scene.
Now, don't worry if right off the bat you notice you're only set to about 100
by default.
All of your 500 frames should be there.
In order to change that all you need to do is down here in the right hand corner
click this little button down here which is the time configuration, and that's
going to go ahead and adjust the frame count for your slider here.
For frame count I'm going to go ahead and set this to 500 and press enter
or in length and then press OK.
So now if we scrub the time bar you'll see that all of the objects are basically falling
very, very similar to how we had originally in the preview.
So if I frame this up just a little bit you can kind of see all these objects are falling, falling
and then they're kind of settling in a rest state.
Once we have all of our objects clumped together down here there's just a couple
little things that we need to do to go ahead and clean this up.
We can go ahead and exit out of Reactor and I'm going to go ahead and pull the
command panel over to the side just a litle bit, and now we don't need this rigid body
or this gravity object anymore so I can go ahead and delete that.
You can also select on the catch mesh down here at the bottom and delete that as well.
Because basically what we're looking for is we're looking for this pile of objects
which basically clumped just like what we were looking for in our Reactor simulation.
I'm going to go ahead and turn on the hardware shading and go ahead and turn
on ambient occlusion.
Just so you can get a nice visual look of what our junk pile looks like.
Now you will notice that sometimes you're going to have some problems
with some of these meshes like this over here for example.
These rebar pipes are probably not 100% accurate because we know
that when we ran our simulation they basically fell and were clumping up
onto the side of our catch mesh.
Sometimes you may have to do just a little bit of cleanup but nothing says you can't
just kind of grab those and pull them in somewhere else or you know manually
go in and make a few minor adjustments to those meshes as needed.
I'm just going to go ahead and kind of pull them up and down just a little bit.
It won't be quite as noticeable if we just go ahead and kind of bury them
underneath some of these other pieces.
That should be fine.
Once I'm happy with that I can just kind of -
Basically all I'll do now is I'll have a last little check just to make sure everything
sort of makes a little bit of sense.
This tire may be a little bit off here but I think for now we can just go ahead and leave
that guy there.
You want to make sure that nothing's leaning towards something without a reason for it.
Like what we mentioned earlier with these rebar pipes.
So the last step that I will do before I get this ready whether it's for a game
asset or an environment scene is I want to go ahead and make sure that I get rid
of all of the key frames of the animation, and I basically merge everything together
as one single object and then kind of clean stuff up just a bit.
I'm going to start by drag selecting all of the objects in my scene
and then down here on the timeline if you hold down your left mouse button
you can go ahead and just drag select over all of these key frames of animation
and then press the delete key.
Now what you've done is you've deleted out all of the animation information
of this object and you've basically committed to saying hey this is my junk pile,
no more animating and there's no going back.
Very similar to the reason why we want to save multiple copies of our files
just in case we decide that we do want to make some changes.
What I'm going to do next is I'm just going to go ahead and grab
any one of the objects, it doesn't really matter which one, and under the
edit or modify tab I'm going to go ahead and click on the attach dialogue box
here under the attach list and then go ahead and click on select all
and that's basically going to attach all of the objects together as one single object.
You'll notice that the bounding box is a bit off and that's because we need to go ahead
and reset our transform.
I'll do that over here under the utilities tab under reset X form and go ahead and hit
reset selected.
So now the rotations and scale and everything should be accurate.
So, now that it's down to a single object the last little bit of cleanup
that I would probably do would be to go in and clean out any of the bottom faces
underneath the bottom of the object.
For example this is a very unique object.
I could never turn this thing on its side and it wouldn't make any sense if
this was rotated so obviously there's really not a lot of reason why the player
or the person would ever see some of the bottom faces of this object.
What I would probably do is go in as just one last little bit of check and cleanup
is to go into the bottom of the object itself and grab any of those faces that I know
that the player is never going to actually see.
By looking at the object from up here I can tell that I can't see any of those
selected faces that I have right now but looking at it from the bottom where the player is
never going to be able to get to those are probably safe to go ahead and delete.
Now one other thing that you can also do is take advantage of using the bi-angle selection
and the ignore backfacing selection.
This can help speed up large selections of polygons.
You want to be a little bit careful when using the bi-angle selection.
Sometimes it can be a little tricky, and it may accidentally grab
some stuff behind your object unexpectedly.
Use with caution but it can definitely be a great help for selecting a large group of polygons
when you want to go through and do a last little bit of cleanup on your object.
Now that we're all done I've gone ahead and brought our object here into UDK.
This is basically what a typical asset could look like by using some of the techniques
we've covered in this video.
I hope you've enjoyed the tutorial and don't forget to check out our
other content, including a free video on how to import meshes just like this
directly into UDK.
Thanks again for watching 3dmotive.com.
(music)