IntroductionWelcome| 00:00 |
(music playing)
| | 00:04 |
Welcome to Liquid Simulation in Maya.
My name is Aaron F Ross.
| | 00:08 |
This course covers advanced tools and
workflows for dynamic fluids.
| | 00:13 |
Here are a few of the topics we'll cover.
Creating dynamic foam and bubbles,
| | 00:18 |
rendering particles with the Fluid
Shader, colliding particles and fluids
| | 00:23 |
with Polygons, storing simulations with
disk caches, emitting particles from a
| | 00:28 |
texture, converting particles and fluids
to smoothed polygons, simulating liquids
| | 00:34 |
with 3D fluids, controlling key
simulation parameters, and texturing 3D fluids.
| | 00:42 |
Let's enter the fascinating world of
Liquid Simulation in Maya.
| | 00:47 |
| | Collapse this transcript |
| Using the exercise files| 00:00 |
If you are a premium subscriber to
lynda.com, then you can download the
| | 00:04 |
exercise files that I've included with
this course.
| | 00:08 |
If you're not a premium subscriber, then
you can create your own assets as you
| | 00:12 |
proceed through the course.
In order to do that, you'll need to
| | 00:16 |
create a layered project.
Let's cover that process just briefly.
| | 00:20 |
Go to the File > Project Window and
you'll see here what your current project is.
| | 00:26 |
Right now, it's just the default project
which is in the current users documents
| | 00:31 |
Maya Projects.
I'll make a new project and I'll call it
| | 00:35 |
Liquid Simulation Project.
(SOUND) And I've just created in the
| | 00:40 |
default location and click Accept.
If I needed to, I could navigate to
| | 00:45 |
another location on the hard drive.
But that default location is fine.
| | 00:49 |
So that's if you want to create your own
assets.
| | 00:52 |
If you are a premium subscriber, you can
download the exercise files and put them
| | 00:56 |
in a location somewhere on your hard
drive.
| | 01:01 |
And then you'll need to point Maya at
that project folder structure.
| | 01:04 |
And to do that you'll go to the File >
Set Project.
| | 01:10 |
And then navigate to the location of your
project files.
| | 01:14 |
In this case, I've got them on my
Desktop.
| | 01:17 |
So, I click on Desktop here.
And here are the exercise files.
| | 01:20 |
Don't drill down inside but make sure
that you're at the root level here.
| | 01:24 |
Just select Exercise Files and click Set.
And now Maya is referring to that
| | 01:29 |
exercise files folder as its home base or
the root of all of the assets.
| | 01:34 |
And we can go into the File > Open Scene
and you'll see it takes us directly to
| | 01:39 |
Desktop exercise files scenes.
And of course these are all the scene
| | 01:45 |
files included with the course and that's
how you want to set up your asset
| | 01:50 |
management in Maya.
I'll mention one last thing is that you
| | 01:55 |
can see I've got a different interface in
Maya.
| | 01:59 |
I prefer black text on a white
background.
| | 02:02 |
That won't affect the lessons at all and
you can use the default interface and
| | 02:06 |
everything will work exactly the same.
If you do want to set it up with a
| | 02:10 |
different interface, then you can do that
by modifying the Maya shortcut.
| | 02:15 |
And I covered that in another course,
which is Maya 2011: Creating Natural Environments.
| | 02:21 |
| | Collapse this transcript |
| What you need to know| 00:00 |
This is an advanced course in liquid
simulations in Maya.
| | 00:05 |
And you need to have some prior
experience with Maya dynamics in order to
| | 00:09 |
get the most out of this course.
And I recommend that if you've never used
| | 00:15 |
any dynamic simulation tools in Maya
before, that you take a look at a couple
| | 00:19 |
of the other courses here on lynda.com
that I've authored.
| | 00:25 |
Specifically, there's a course called
Creating Particle and Fire effects with Maya.
| | 00:30 |
And it goes over some of the basics of
using Maya particles as well as Maya fluids.
| | 00:37 |
Additionally, I've authored another
course called Understanding Maya nCloth.
| | 00:42 |
And it goes into a fair amount of depth
regarding Maya's Nucleus solver and we'll
| | 00:47 |
be using Nucleus in this course.
So, I recommend, once again, that if you
| | 00:52 |
have no prior experience with dynamics in
Maya, that you probably want to take a
| | 00:57 |
look at those two other courses here at
lynda.com.
| | 01:02 |
| | Collapse this transcript |
|
|
1. Foam and BubblesLaying out the scene| 00:00 |
Our first exercise in creating liquid
simulations in Maya is to add some foam,
| | 00:05 |
soap suds, to the surface of this bathtub
water.
| | 00:10 |
The bathtub water is actually already
dynamically animated.
| | 00:13 |
Let's take a look at that animation.
I'll hover my mouse over the camera view
| | 00:17 |
and tap the spacebar, and rewind and
play it back.
| | 00:21 |
The animation actually starts at frame
100.
| | 00:24 |
The way that this was accomplished was
with a Maya pond.
| | 00:28 |
And we're not going to cover how to
animate Maya ponds in this course,
| | 00:32 |
because I covered it in another course,
which is entitled Creating Fluid Effects
| | 00:37 |
in Maya.
This exercise is actually a continuation
| | 00:42 |
of that.
Let's take a look at the layout of the
| | 00:45 |
scene here.
You'll see in the display layers that
| | 00:48 |
I've created layers for basically all of
the scene elements, including, for
| | 00:52 |
example, the rubber ducky.
And by the way, the rubber ducky has an
| | 00:56 |
editable motion trail attached to him, so
we can see his path through space.
| | 01:01 |
We're not going to go over how editable
motion trails are created in this exercise.
| | 01:06 |
I've just created that as a convenience
so that we can see the path of the ducky.
| | 01:10 |
Later when we sketch particles, we'll
want to know where the ducky's path is,
| | 01:13 |
so that we don't create particles in his
path.
| | 01:18 |
We've also got layers for the tub itself,
for the room around the tub, for cameras,
| | 01:23 |
and most importantly, we've got two
layers here for the pond.
| | 01:28 |
There's pond fluid layer and pond
polygons layer.
| | 01:34 |
The reason that I have two different
versions here is because of performance.
| | 01:38 |
The fluid layer is a native pond fluid,
and it plays back in real time in the
| | 01:42 |
view ports here.
However, when we add particles for our
| | 01:47 |
foam, we cannot actually float the
particles directly on the surface of this fluid.
| | 01:54 |
We'll use end particles to create the
foam, and end particles can't collide
| | 01:58 |
with fluids directly.
We have to convert the pond to polygons
| | 02:03 |
in order to create those collisions.
But the polygons are very slow playback
| | 02:08 |
in the view port.
If I disable visibility on the fluid
| | 02:12 |
layer, and enable visibility on the
polygons layer, you'll see that when I
| | 02:16 |
press play it's very slow.
We're only going to get about one frame
| | 02:21 |
per second.
And that's why I've got two different
| | 02:25 |
layers here.
The fluid layer is here so that we can
| | 02:27 |
get fast playback in our timeline.
The polygons layer is here so we'll have
| | 02:32 |
something to collide with later.
I'll mention I last thing, which is when
| | 02:38 |
you convert a fluid to polygons, by
default fluid becomes invisible, and I
| | 02:41 |
just want to show you how that works.
I'll hide the polygons, unhide the fluid,
| | 02:49 |
and select the fluid.
Sometimes it's hard to know if it's
| | 02:53 |
selected if you're in the shaded view
port, but if you just press the 4 key,
| | 02:56 |
you can see what's selected better,
because you can see wire frames on that fluid.
| | 03:01 |
And with it selected I'll go to it's
attributes, Control A.
| | 03:05 |
When you do certain conversion commands
in Maya such as converting the fluid to
| | 03:09 |
polygons, Maya keeps the original
history, and it keeps that fluid node,
| | 03:13 |
but it makes it a so-called intermediate
object, which hides it.
| | 03:19 |
And to unhide it, what you can do is go
into the Object Display section of the
| | 03:24 |
shape node.
And you will see there's a switch here
| | 03:29 |
that says intermediate object, and if
it's on the object will always be hidden.
| | 03:34 |
In this case I want to be able to see it,
so I've turned intermediate object off.
| | 03:41 |
So, that's the basic layout of this
scene.
| | 03:43 |
Let's go ahead and create some foam in
the next movie.
| | 03:46 |
| | Collapse this transcript |
| Sketching nParticles| 00:00 |
Let's sketch some particles to create our
soap suds.
| | 00:05 |
Let's do it in the top view port.
Hover my mouse over the top view and tap
| | 00:08 |
the spacebar.
And just so we can see what we're doing a
| | 00:11 |
little bit better, I'm going to hide some
of these elements.
| | 00:15 |
Hide the pond and hide the room as well.
And we're going to paint particles in
| | 00:21 |
this region just so that it doesn't
collide with the path of the rubber ducky.
| | 00:28 |
So we want to go into the N dynamics menu
set.
| | 00:31 |
N dynamic stands for nucleus dynamics and
we want to go into the N particles menu.
| | 00:39 |
And under Create N Particles the first
thing you want to do is choose a preset.
| | 00:44 |
You will see we've got points, balls,
cloud, thick cloud, and water.
| | 00:49 |
Each one of these will create a slightly
different variation on an N particle system.
| | 00:54 |
And the one that we want in this case is
thick cloud.
| | 00:58 |
So I clicked on that.
The reason why we want thick cloud, is
| | 01:01 |
because it's going to assign a different
shader to the particles.
| | 01:05 |
Particles can accept different types of
shaders and if you just create standard
| | 01:10 |
clouds here, then what you'll get is a so
called particle cloud shader.
| | 01:16 |
But in this case, we want a fluid shader.
To get the fluid shader we'll choose the
| | 01:22 |
thick cloud preset.
So that's been done.
| | 01:25 |
Next, we want to go into the N particle
tool options.
| | 01:29 |
Click on that, and we get the tool
settings.
| | 01:31 |
What we want to do here is sketch
particles.
| | 01:34 |
I want to enable the switch that says
Sketch Particles.
| | 01:38 |
I also want to increase the number of
particles.
| | 01:41 |
Let's turn that up to about 10 or so and
the maximum radius.
| | 01:47 |
What this is is when you click your mouse
to create particles, they'll be built and
| | 01:51 |
born in a radius set here.
So each time you click your mouse, you'll
| | 01:56 |
get 10 particles seperated by this
amount.
| | 02:00 |
Well, if the maximum radius is 0, then
you'll get 10 particles right on top of
| | 02:03 |
each other.
Let's set this to a value of about 2.
| | 02:07 |
Now I'm ready to sketch some particles.
We just go ahead and just draw in the viewport.
| | 02:15 |
Now we don't want to create too many
particles, just for the lesson here, we
| | 02:18 |
want to kind of keep it moderate and not
have too much going on in here, just for
| | 02:21 |
performance reasons.
When you finish sketching you can press
| | 02:26 |
the enter key.
I will mention that there's no way erase particles.
| | 02:31 |
So, if, when you sketch the first time
you don't get what you want, simply
| | 02:34 |
delete the particles.
They're still selected and I can press
| | 02:38 |
the delete key on the keyboard and give
it another shot.
| | 02:41 |
Maybe I want to go back to my particle
tool that's here in the most recent tool
| | 02:44 |
button, maybe I want a larger radius.
Let's give it a radius of 3 instead of 2.
| | 02:50 |
And then I can sketch once again.
So I can't erase them, and it's
| | 02:54 |
completely destructive, so there's no way
for me to move these particles
| | 02:57 |
individually once they've been built.
So if I'm happy with that, once again,
| | 03:03 |
I'll press the Enter key.
Let's go look at that in a perspective
| | 03:06 |
view port.
I'll tap the spacebar and in my side
| | 03:09 |
view here, I'll just choose Perspective.
Perspective.
| | 03:13 |
Tap the spacebar once again.
So we can kind of navigate around and see
| | 03:17 |
what we've got.
Press the 5 key.
| | 03:20 |
And there are our particles.
Now they're born right at the X Z plane
| | 03:26 |
with a Y elevation of 0.
And if I turn my pond back on, you'll see
| | 03:31 |
that half of the particles are below the
water.
| | 03:34 |
I just want to move those up a little
bit.
| | 03:36 |
You can use the Move tool in the usual
way but you will notice that the pivot
| | 03:40 |
point for the particles is always at the
origin.
| | 03:44 |
So I can move that up or I could just set
some value here in the channel box, let's
| | 03:49 |
say 5 centimeters up.
All right so I've sketched my particles.
| | 03:54 |
| | Collapse this transcript |
| Randomizing nParticle radius| 00:00 |
We've created our particles, but they're
very small.
| | 00:03 |
Their radius is very low.
We want to increase that radius so that
| | 00:06 |
we'll have a lot of overlap among those
particles, and we also want to randomize
| | 00:10 |
the radius while we're at it.
Let's go ahead and select those
| | 00:15 |
particles, and go into the Attribute
Editor, Ctrl+A.
| | 00:19 |
And we've got the nParticle Shape Node.
Let's open up the Particle Size section
| | 00:24 |
here and you'll see Radius.
So you can turn that up to a value of
| | 00:28 |
let's say 1.5.
And to randomize this, it's much easier
| | 00:33 |
than if you were using classic particles.
With Maya's old school particles you had
| | 00:38 |
to write a particle creation expression
to make them differently sized.
| | 00:42 |
But one of the great advantages of
nParticles is that that's all built right in.
| | 00:48 |
You can see here there's a Radius Scale
Randomize attribute, and you can just
| | 00:51 |
increase that.
But what you'll see is that it's kind of
| | 00:55 |
got a mind of its own.
What I prefer to do instead of that, is
| | 00:59 |
to use this ramp right here.
And that way I can better control the
| | 01:04 |
variation in particle size.
For that to work, what we want to do is,
| | 01:09 |
where it says Radius Scale Input, we want
to choose from the drop down list,
| | 01:13 |
Randomized ID.
And then, to change the radius, we can
| | 01:19 |
just add some points on this graph here.
So I'll click to create a point, and then
| | 01:24 |
move these around.
There you see we've got a variation here.
| | 01:30 |
And if we want a greater variation, let's
say we want more smaller particles, then
| | 01:33 |
we can keep adding points, and you can
see here now most of the particles are
| | 01:37 |
going to be really small and a few of
them will be quite large.
| | 01:42 |
Having done that then, I probably want to
increase the overall radius.
| | 01:47 |
The end result we want to see is a fair
amount of overlap, and we want to see
| | 01:51 |
that there's a range of size, so that
they're not all the same size.
| | 01:58 |
| | Collapse this transcript |
| Setting render attributes| 00:00 |
We've created our particles, and we want
to start working on the foam shader, but
| | 00:04 |
before we do, we need to set a couple of
key rendering attributes.
| | 00:09 |
I want to mention that if you try to
render this currently, with the native
| | 00:12 |
pond fluid, your particles won't show up
properly, and it's because they're
| | 00:16 |
actually inside the volume of this box.
And it's just a weird quirk of the
| | 00:22 |
software that if these fluid shaded
particles are inside another fluid box,
| | 00:26 |
they won't render.
And it's not really a problem for us,
| | 00:30 |
because in the end we're going to render
this with polygons, and we're not going
| | 00:34 |
to render this native pond fluid anyway.
But just so that we're not confused by
| | 00:39 |
that, or we don't have any issues in our
test renderings, We're going to hide the
| | 00:44 |
pond fluid layer.
Now additionally these particles have
| | 00:49 |
shadow casting and reception enabled by
default, and that's really going to slow
| | 00:53 |
down your test renders.
So that you're not waiting for eons for a
| | 00:58 |
test render to come out, we need to turn
off cast and receive shadows.
| | 01:03 |
So, select the particles and go to the
attribute editor, Control + A.
| | 01:06 |
And in that particles shape node, in the
render stats section, you can disable
| | 01:10 |
Cast and Receive Shadows.
Another weird quirk I want to mention
| | 01:16 |
here is that, if you render in Mental
Ray, these switches won't have any effect.
| | 01:21 |
We are rendering in Maya software in this
case, but in your own scenes, if you
| | 01:25 |
want to follow this sort of procedure,
then this won't work, and you'll need to
| | 01:28 |
use the Light Linker in order to disable
shadows.
| | 01:34 |
Additionally, just to optimize our test
renders, we want to knock the Maya
| | 01:37 |
software quality setting down to a
preview quality, so that we're not
| | 01:40 |
waiting a really long time for each test
render.
| | 01:45 |
I'll go into the Render Settings dialog
to the Maya software tab, and set the
| | 01:49 |
quality down, to preview quality.
So, those are the key render attributes
| | 01:56 |
that we need to set in order to optimize
our scene, for test renders.
| | 02:00 |
| | Collapse this transcript |
| Varying fluid texture| 00:00 |
Let's do a test render of our particles
with just the default fluid shader applied.
| | 00:06 |
Get in really close on these, so we can
see them more clearly, and do just a
| | 00:10 |
standard test render.
That's what our particles look like with
| | 00:14 |
just the default shader applied.
I want to store that image so I can
| | 00:18 |
compare it to others.
And if you look closely at this you may
| | 00:21 |
notice that each one of the particles
looks remarkably similar.
| | 00:25 |
And that's because, in fact, each
particle has exactly the same fluid attributes.
| | 00:31 |
That means each one is going to render
the same.
| | 00:33 |
We got a really kind of repetitive look
on this.
| | 00:37 |
We want to fix that up and the way to do
that is to take the position of each
| | 00:41 |
particle and pipe that into the texture
origin of the fluid that is doing the
| | 00:45 |
actual work of the rendering.
We want to go to the hyper-shade window.
| | 00:53 |
Window > Rendering Editors > Hyper-Shade.
We want to select the particles and in
| | 00:59 |
the hyper-shade click on Graph Materials
on Selected Objects.
| | 01:06 |
And let me maximize the hyper-shade.
By the way I'll mention that if your not
| | 01:11 |
terribly familiar with hyper-shade then
you might want to take a look at my other
| | 01:14 |
course which is called Creating Shader
Networks in Maya and Mental Ray and that
| | 01:17 |
goes into great detail about the
hyper-shade window.
| | 01:22 |
In here we're going to do some magic to
make that texture look a lot more varied.
| | 01:27 |
Let's get in closer with Alt+Right, and
you can pan across with Alt and middle
| | 01:32 |
mouse button.
And you'll see here there's a particle
| | 01:36 |
sampler info node and it's feeding into
this fluid shape node.
| | 01:40 |
And that's whats actually doing the
rendering.
| | 01:44 |
Notice, by the way, there's also a blend
node here.
| | 01:46 |
That only becomes active if you choose
Blobby Particles as your render type in
| | 01:50 |
the N particle shape node.
Currently, because it's set to the
| | 01:55 |
default of Particle Cloud render type,
that means that Maya's going to use this
| | 01:58 |
fluid to render the particles.
If I hover my mouse over this connection
| | 02:05 |
wire you can see that the particle
sampler info node is passing
| | 02:08 |
transparency, incandescence and color
from the particles to the fluid.
| | 02:15 |
In other words, if we change the color in
the N particle node, then that will
| | 02:19 |
change the color in the fluid node.
What we need to do here is we need to
| | 02:25 |
take the position of each particle and
use that information to drive the texture
| | 02:29 |
in the fluid shape.
So I want to right click on the particle
| | 02:34 |
sampler info node.
The world position is a triple digit value.
| | 02:39 |
So I want to go down here to Triple.
And you want to go to World Position >
| | 02:44 |
World Position.
And that's all three x, y and z values.
| | 02:49 |
So I've held my right mouse button down
the whole time.
| | 02:52 |
And then when I've got it hovering over
world position, I'll release the mouse.
| | 02:57 |
Then on the fluid, I want to left click
on the lower left hand corner of that
| | 03:00 |
fluid node.
And what we're looking for here is
| | 03:04 |
Texture Origin.
There it is.
| | 03:07 |
Now that connection's been made.
An again, if I hover my mouse over the
| | 03:11 |
connection wire, you can see it says,
particle sampler info, world position is
| | 03:16 |
connected to fluid, texture origin.
Let's minimize the hyper-shade and see
| | 03:23 |
what has happened here.
I've got my render view minimized as
| | 03:25 |
well, so I'll bring that back up again.
Here it is with just the default texture
| | 03:31 |
on each particle.
And we'll do a render now.
| | 03:35 |
We can see the result after we've
connected the particles' world position
| | 03:39 |
to the fluid's texture origin.
I'll go ahead and store that so we can
| | 03:44 |
compare it.
So this is the one we just rendered and
| | 03:48 |
this is the one with just default
parameters.
| | 03:51 |
So you can see here that these two
particles are exactly the same and then
| | 03:54 |
after we've made that connection now each
particle is different.
| | 04:00 |
There's one more thing we need to do,
which is to get a consistent scale to all
| | 04:04 |
of these particles.
And as you can see here the larger ones,
| | 04:08 |
the texture is kind of large, and on the
smaller particles the texture is small.
| | 04:14 |
So in the next movie, we'll correct that
so that they all appear to be the same size.
| | 04:19 |
| | Collapse this transcript |
| Unifying fluid texture scale| 00:00 |
We varied the shape of the texture on
these particles, but we also want to look
| | 00:05 |
at the scale.
I'm going to open up my Render view, and
| | 00:09 |
take a look at the last rendering that we
did.
| | 00:12 |
And if you look closely, even though, now
we've got a much better texture
| | 00:16 |
throughout, the larger particles have a
larger scaled texture, and the smaller
| | 00:21 |
particles have a smaller texture.
And that just happens by default, Maya's
| | 00:28 |
hardwired to do that.
Smaller particles will get a smaller
| | 00:32 |
fluid texture on them, because the fluid
box is actually sized down to the size of
| | 00:36 |
each radius of each particle.
What we need to do is invert that
| | 00:41 |
relationship, so that a large particle
will have a smaller texture, and a small
| | 00:46 |
particle will have a larger texture.
To do that, we'll go back into the Hyper
| | 00:52 |
Shade window.
Window > Rendering Editors > Hyper Shade.
| | 00:57 |
And with those particles selected, we can
go ahead and graph materials on selected objects.
| | 01:03 |
And once again, you'll see we've got a
particle sampler info node that's
| | 01:06 |
grabbing information from the particles,
and passing that to the fluid that's
| | 01:10 |
actually creating the render and the
texture.
| | 01:15 |
What we need to do here is we need to
take the radius of each particle, invert
| | 01:19 |
the value, and then plug it into the
scale of the texture here on the fluid note.
| | 01:25 |
And one way to do that is to use a remap
value node.
| | 01:30 |
I'll go over here to the create section
in the Hyper Shade and go to Utilities.
| | 01:34 |
And we're looking for Remap Value, there
it is, Remap Value.
| | 01:38 |
So, Click it to create that, and we want
to connect the radius of each particle to
| | 01:42 |
the input of the Remap Value.
And then take the output of the Remap
| | 01:47 |
Value and plug it into the texture scale
of the fluid.
| | 01:50 |
So, on the particle sampler info node,
I'll Right Click on the lower right hand corner.
| | 01:55 |
And radius is a single value, so I'll go
to single and we're looking for radius PP
| | 02:00 |
which is radius per particle, in other
words each particle has it's own unique radius.
| | 02:06 |
I release the mouse and then Left Click
on the lower left hand corner of the
| | 02:11 |
re-map value node and connect it to input
value.
| | 02:17 |
So, now the connection is been made,
radius PP is connected to input value.
| | 02:21 |
Now you want to take the output of the
remap value node, and plug it into this
| | 02:25 |
scale of the texture here.
But we'll need to do it three times,
| | 02:29 |
because we're going to use the one
dimensional remap value output, and of
| | 02:33 |
course scale has three dimensions x, y
and z.
| | 02:38 |
We'll just need to make that connection
three times.
| | 02:40 |
I'll Right Click on the remap value node
on the lower right hand corner.
| | 02:44 |
And take the out value, then Left Click
on the lower hand corner of the fluid
| | 02:47 |
shape node.
And you'll see we've got lots and lots of
| | 02:51 |
options here, what we're looking for is
Texture Scale, here it is up here.
| | 02:57 |
And we want to connect this to texture
scale X, Y and Z.
| | 03:02 |
We'll d X first, so, I release the mouse
and now the connection has been made.
| | 03:08 |
Our values connected texture scale X.
We'll do it again, Right Click out value,
| | 03:14 |
Left Click texture scale Y.
And a third time, Right Click out value,
| | 03:21 |
Left Click, texture scale, Z.
All three of those connections have been
| | 03:30 |
made, out value is driving texture scale
X, Y, and Z.
| | 03:35 |
Our shading network has been built, I can
close the hypershade.
| | 03:38 |
Before I do, I'll select a remap value
node, and then go to the Attribute
| | 03:42 |
Editor, Ctrl+A.
Here's the remap value node.
| | 03:47 |
So, we're using this section here, that's
a one dimensional output of the remap
| | 03:50 |
value node, and currently it's just
passing the data through without changing it.
| | 03:55 |
If the input value is zero, then the
output value is zero, because this point
| | 03:59 |
here is that at position of zero and a
value of zero.
| | 04:05 |
And if the input value is one, then the
output value is one, because this point
| | 04:09 |
is up here at the top right corner.
As I said earlier what we want to do is
| | 04:15 |
invert these values.
So, what I'll do is I'll take the point
| | 04:19 |
on the left and bring that up to the top.
And the point on the right and bring that
| | 04:24 |
down, not quite to the bottom, because if
I take it all the way down to zero I'll
| | 04:27 |
get some illegal values.
So, let's take it to a value of 0.1.
| | 04:32 |
So, I've inverted, the radius, and passed
that now, to the texture scale.
| | 04:39 |
Let's do a test render of that, see what
it looks like.
| | 04:41 |
And it looks kind of like fuzzy spheres.
And the reason this is happening is
| | 04:48 |
because the remap value node has input
and output ranges that max out at a value
| | 04:53 |
of one by default.
And yet, our radius actually goes up to a
| | 04:58 |
value of three or four.
Essentially what's happening here is the
| | 05:02 |
remap value node is kind of clamping the
values down, so that's why we're getting
| | 05:06 |
a very small texture on here.
All we need to do is go into the remap
| | 05:11 |
value mode and open the input and output
ranges section, and set the input max and
| | 05:16 |
output max to a value of three or four.
So, now the remap value node can accept
| | 05:22 |
values from zero to three and then output
values from zero to three.
| | 05:27 |
We'll do another render, that's what we
get after all of our labors in adjusting
| | 05:32 |
these textures, and lets store that image
and compare to some of the other ones.
| | 05:39 |
So, here it is with the scale adjusted
and the position, and then here is a
| | 05:44 |
version where only the position has been
adjusted.
| | 05:50 |
And there's the original version where
neither has been adjusted.
| | 05:54 |
So, we went from here, with the default
settings, to varying the position of the
| | 05:59 |
texture, to finally adjusting the
position and the scale of the texture.
| | 06:07 |
Now we can move on to actually adjusting
this to make it look like a foam shader.
| | 06:11 |
| | Collapse this transcript |
| Adjusting shading attributes| 00:00 |
We've made the connections to our shader
network and now it's time to adjust the
| | 00:04 |
fluid shape texturing attributes in order
to get the look of soap foam.
| | 00:10 |
Let's take a look at what we had before
and we're going to make some major
| | 00:14 |
adjustments to the material on this
fluid.
| | 00:19 |
Let's go to the outliner.
We know Outliner, and we'll see here is
| | 00:23 |
Fluid 1 down here.
That is actually the fluid that is
| | 00:27 |
causing this rendering effect here.
Why don't we rename that?
| | 00:31 |
So, I'll select it and double-click it,
and we call that End Particle Fluid, so
| | 00:35 |
that I know that that's the fluid that's
actually driving the end particle rendering.
| | 00:40 |
So I've got that selected, and I want to
go to the Attribute Editor, Control + A.
| | 00:47 |
And the first thing you want to do in
this fluid shape is break some connections.
| | 00:53 |
If we open up this shading section, here,
then you'll see transparency and color
| | 00:58 |
and also incandescence are all connected
to something.
| | 01:05 |
Remember, we saw previously that the
particle sampler info node was feeding
| | 01:08 |
into these.
Well, if I want to change this here, I'm
| | 01:11 |
going to have to break all those
connections, but I want to warn you that
| | 01:15 |
when you break those connections, if you
immediately try to adjust the color, Maya
| | 01:19 |
may crash.
So, what we need to do is break these connections.
| | 01:24 |
Right click and Break Connection and then
just move onto the next one.
| | 01:29 |
If I click and break connection.
And then on this one I want to delete these.
| | 01:37 |
And then break this connection.
Just to make sure that Maya doesn't
| | 01:41 |
crash, we can kind of wiggle these around
a little bit.
| | 01:46 |
So, these connections have been broken
now and we want to scroll back up here to
| | 01:49 |
the surface section, and right now it's a
volume render, but what I want is
| | 01:53 |
actually a surface rendering to surface
render.
| | 01:58 |
And it's going to be a soft surface.
That means it'll create the outer skin of
| | 02:04 |
the soap foam but it will be a sort of a
soft effect.
| | 02:09 |
With those changes, lets do a region
render and see what this looks like.
| | 02:12 |
So I'll drag the rectangle around here
and click Region Render.
| | 02:15 |
And you can see now it's made some major
changes.
| | 02:20 |
While we're here in the surface section
here, I want to give it some specular
| | 02:23 |
color so we'll have some shiny
highlights.
| | 02:26 |
Do another region render.
Start to see a little bit there, maybe a
| | 02:31 |
little bit more, region render.
Now, scrolling down back to the shading
| | 02:36 |
section, we don't want it to be totally
opaque.
| | 02:39 |
We want some transparency and this is
going to be a really sensitive slider
| | 02:43 |
here, we'll have to come back to this but
I'll set it to maybe about 20% gray.
| | 02:49 |
So, now it's partly transparent.
So the color, of course, we want that to
| | 02:53 |
be white.
Scrolling down a little bit, I want a
| | 02:56 |
little bit of incandescence so it kind of
glows from within.
| | 03:02 |
So click on that incandescence color and
set the value to, let's say, 0.3.
| | 03:07 |
And do another test render.
So it's moving forward.
| | 03:12 |
Now, we've got the opacity.
By now it's set to a center gradient,
| | 03:16 |
meaning that it will be thicker in the
middle, and less thick on the edges.
| | 03:20 |
Just going to set it to a constant value.
And the input bias here, I'll set to 0.
| | 03:26 |
That's just shifting the opacity in one
direction or the other.
| | 03:29 |
So I just want to set that bias to 0.
Do another test render as we go.
| | 03:34 |
So that looks kind of funky, but we're
going to fix this up.
| | 03:38 |
The opacity, I want to have a sharp
cutoff, so it's going to be really opaque
| | 03:42 |
in areas of higher density.
Now scrolling down a little bit more,
| | 03:49 |
you'll see the shading quality is set
down really low, to a value of 0.5.
| | 03:53 |
I'm going to set that to a value of 1.
That's kind of a minimum value for
| | 03:57 |
shading quality.
We won't see much difference here.
| | 03:59 |
But trust me, we need to increase that
up a little bit.
| | 04:03 |
Now we come to the textures.
And this is, of course, the most
| | 04:05 |
important part here.
I want a texture the opacity, as well as
| | 04:08 |
the incandescence.
So I want to turn both of those on.
| | 04:12 |
And the texture type, I'm going to change
to Space Time.
| | 04:16 |
Do another test render.
And now we'll need to go down here and
| | 04:21 |
change yet more attributes.
And I mentioned, by the way, I spent many
| | 04:25 |
hours adjusting these and finding what
the right values are.
| | 04:29 |
So the opacity texture gain needs to
increased up to 1.
| | 04:32 |
And then down here we've got threshold
and amplitude.
| | 04:36 |
going to need to play with those as well.
So there it is with opacity texture gain
| | 04:41 |
turned up to 1.
But the texture itself is too strident,
| | 04:45 |
so I want to bring the amplitude down to
a value of 0.5.
| | 04:48 |
Now it's a bit more consistent, it's
basically whiter all over.
| | 04:55 |
Now, we've got the ratio and the
frequency ratio.
| | 04:57 |
The ratio is basically the noisiness.
So I'll reduce that down a little bit to,
| | 05:04 |
let's say, 0.4, and do a test render.
The frequency ratio is the size of each
| | 05:11 |
noise wave within another noise wave.
So, in other words, we have multiple
| | 05:17 |
levels of noise, and the scale of each
noise relative to its sort of, parent
| | 05:21 |
noise, is determined by this frequency
ratio.
| | 05:25 |
Here currently, what this is saying is,
the smaller noise will be one half the
| | 05:29 |
size of the larger noise.
I'm going to set that to a value of 1.7.
| | 05:37 |
So, that's the texture.
And then scrolling down a bit more, we've
| | 05:39 |
got the frequency.
And this the overall scale of that texture.
| | 05:44 |
And it needs to be a lot smaller, meaning
it's going to need to have a higher
| | 05:48 |
frequency to value of 30.
Seemed to work well for this particular scene.
| | 05:53 |
Now, this is starting to make sense.
Once I set that frequency to a really
| | 05:57 |
high value, we're getting these kind of
little flecks of foam.
| | 06:02 |
All we need to do here now is play around
a little bit with transparency until we
| | 06:06 |
get the look that we want.
Scrolling back up here, I can give it a
| | 06:10 |
greater transparency and do a test
render.
| | 06:15 |
Maybe even more transparency and perhaps
we could also play around with this
| | 06:19 |
opacity curve here, cause that's going to
influence it as well.
| | 06:24 |
Do another region render.
So I think I actually in this case am
| | 06:27 |
going to increase the transparency even
greater and then do a full rendering here.
| | 06:32 |
Because I think we're nearly there.
Okay.
| | 06:35 |
So now we've got something that resembles
soap foam.
| | 06:38 |
We would probably want to adjust some of
these attributes even further, maybe
| | 06:42 |
reduce the specular amount or maybe bring
the color down a bit.
| | 06:47 |
Or perhaps bring the incandescence down a
bit.
| | 06:50 |
Any and all of the above may be necessary
in order to get the look that we want.
| | 06:56 |
And in my example, here, I devoted a lot
of preproduction effort into getting this
| | 07:00 |
exactly right.
And in your own scenes, you'll need to
| | 07:03 |
budget time.
In order to make that happen, you'll have
| | 07:07 |
to devote quite a bit of time and effort
to getting the look that you want.
| | 07:11 |
| | Collapse this transcript |
| Colliding nParticles| 00:01 |
We're ready to drop our particles onto
the surface of the water.
| | 00:04 |
Let me dolly back here a little bit.
As I mentioned in an earlier movie, we
| | 00:09 |
cannot collide the nParticles directly
with a native Maya pond.
| | 00:14 |
It has to be converted to polygons first,
and that's what I've done here.
| | 00:18 |
You see I've got two layers.
I'll unhide the polygons layer.
| | 00:23 |
And while I'm in the Layers pallet here,
I also want to turn off the referencing
| | 00:27 |
on the tub layer, so that I can select
it.
| | 00:30 |
Because both the tub and the water should
be made collision objects.
| | 00:36 |
So to do that, I want to select the
water, the polygons, and go to the
| | 00:40 |
nDynamics menu set.
And go to the nMesh menu, and choose
| | 00:44 |
Create Passive Collider.
A passive collider is a Nucleus object
| | 00:49 |
that can drive the simulation, but will
not be driven by it.
| | 00:55 |
In other words, the movement of the water
will affect the movement of the
| | 00:58 |
particles, but the movement of the
particles will not affect the water,
| | 01:01 |
because it's a passive collider.
So same with the tub.
| | 01:07 |
I'll select it and make it a passive
collider, as well.
| | 01:11 |
Now, all three of the objects, the tub,
the particles, and the water, are Nucleus objects.
| | 01:17 |
And we can go ahead and adjust the
properties of this simulation by going
| | 01:21 |
into the Nucleus solver node.
And we see that here as a small n at the origin.
| | 01:27 |
And it might be difficult to select that,
but we can just select any one of these
| | 01:31 |
three objects and go to the attribute
editor, Ctrl+A.
| | 01:35 |
And just go to the Nucleus solver node
tab here.
| | 01:39 |
And we need to make a couple of
adjustments here.
| | 01:41 |
Most importantly is the space scale.
And that has to do with the physical size
| | 01:47 |
of the simulation.
Nucleus anticipates that we've build our
| | 01:53 |
world at a scale of one 100th.
And if that is the case, then the space
| | 01:58 |
scale of one, by default, will give us a
physically accurate simulation.
| | 02:04 |
However, I've built my scene at a one to
one scale.
| | 02:07 |
For example, my tub is about 150
centimeters wide.
| | 02:09 |
If you've built your scene at one to one
scale, then you'll need to adjust the
| | 02:14 |
space scale attributes in the Nucleus
solver node.
| | 02:20 |
And I've built my world 100 times larger
than Nucleus expects.
| | 02:25 |
And you might think that that means I
need to set my space scale to 100.
| | 02:31 |
But in fact, that's not correct.
We need to set the space scale to the
| | 02:34 |
reciprocal value.
In other words, the space scale needs to
| | 02:39 |
be set to one 100th, or 0.01.
Having done that now, Nucleus understands
| | 02:45 |
that my world is built at one to one
scale.
| | 02:49 |
So we've set the space scale.
Now, we want to go ahead and drop our particles.
| | 02:55 |
But if we press Play now, the particles
don't move, or they might kind of drift
| | 02:59 |
around a little bit.
What we need to do is actually turn a
| | 03:03 |
setting off in the particles.
I want to select these particles, and go
| | 03:09 |
to their shape node.
And in the Dynamic Properties section
| | 03:14 |
here, we'll need to switch off Ignore
Solver Gravity.
| | 03:18 |
Ignore Solver Gravity was enabled when we
first created the particles, because we
| | 03:23 |
chose the thick cloud preset.
So the assumption there is that you're
| | 03:28 |
creating clouds that are floating in the
sky.
| | 03:30 |
You don't want them to fall with Nucleus
gravity.
| | 03:33 |
But here of course, we do want them to
fall with gravity, so I've turned Ignore
| | 03:37 |
Solver Gravity off.
So now, we can go ahead and press Play,
| | 03:40 |
and watch our particles drop.
And they should land on that surface.
| | 03:47 |
Now you see, some of them are slipping
and sliding around a little bit.
| | 03:50 |
I'll hit the Esc key, and rewind.
What we want to do here is add some
| | 03:56 |
stickiness to the water, so that the
particles will stick to the water and not
| | 04:00 |
slide across it's surface.
I'll select the water, and go to it's
| | 04:05 |
nRigidShape node, so that's it's Nucleus
properties.
| | 04:09 |
And here in the collisions section,
there's a stickiness attribute.
| | 04:14 |
And I'm going to turn that up all the way
to a value of two, and then play the
| | 04:17 |
simulation again.
So now those particles are staying put.
| | 04:22 |
Excellent.
So that's where we want them to be on the
| | 04:25 |
first frame of our simulation.
And all we have to do now is select those
| | 04:30 |
particles, and go into the nDynamics menu
set, and go to End Solver, and choose
| | 04:34 |
Initial State > Set From Current.
And that means, the particles will start
| | 04:41 |
out already on the surface of the water,
on the first frame of the simulation.
| | 04:47 |
And when I rewind back to frame one, now
they're sitting on the water at frame one.
| | 04:52 |
Now, I actually have a 100 frame run up
in this simulation.
| | 04:57 |
There's nothing happening in the
animation until frame 101.
| | 05:02 |
What I want to do here is just set up
Nucleus so that it's not calculating
| | 05:06 |
during that time.
I'll go back to the Nucleus solver node,
| | 05:10 |
and in the time attribute section, I'll
set the start frame to 100.
| | 05:15 |
And likewise, I'll set the start frame of
my timeline to frame 100, as well.
| | 05:21 |
And now, if I rewind, we'll start on
frame 100, and the particle's already on
| | 05:26 |
the surface of the water.
Now, we can go ahead and play our
| | 05:31 |
simulation, but it's going to be very,
very slow.
| | 05:34 |
And the reason that it's going to be so
slow is partly because the fluid's been
| | 05:37 |
converted to polygons.
So we won't really be able to play this
| | 05:41 |
in real time.
What we'll want to do is do a playblast.
| | 05:44 |
We'll go ahead and do that.
Go to the Window menu, Playblast Options.
| | 05:52 |
Let's save it out to a QuickTime format,
with H.264 compression, with maximum quality.
| | 06:00 |
And the display size, I'll just set that
to the window size with a scale of one.
| | 06:07 |
We want to save it to a file, of course.
And this is going to save it into the
| | 06:10 |
Movies folder of our current project.
And I just used the same movie file name
| | 06:16 |
as the scene file name.
Go ahead and click Playblast.
| | 06:22 |
Our playblast is completed, and although
the ducky was hidden during that, we can
| | 06:27 |
examine the results of our dynamic
simulation.
| | 06:33 |
And what we see here is that the ripples
in the pond are affecting the particles.
| | 06:39 |
Excellent.
And so that's how we can collide
| | 06:42 |
particles to float them on the surface of
the water.
| | 06:45 |
| | Collapse this transcript |
| Building an nCache| 00:00 |
Our simulation came out okay in the
playblast, and that means we're ready to
| | 00:04 |
do a rendering.
However, before we render, there's a
| | 00:07 |
couple things we want to do.
First of all, in my tests in creating
| | 00:10 |
this course, I found that the rendered
times for this foam shader were extremely long.
| | 00:17 |
We can optimize the rendered times by
going into the Shader and disabling the
| | 00:21 |
lighting in the scene.
I'll need to go into the Outliner and
| | 00:26 |
select the End Particle Fluid Shape and
go to its attributes with Control A.
| | 00:31 |
And in that fluid shape's lighting
section, there's a switch that says Real Lights.
| | 00:37 |
And that's on by default.
And what that means is that the fluid
| | 00:41 |
will be lit by the lights in the scene.
But that's a very slow render.
| | 00:46 |
What I want to do here is actually
disable real lights.
| | 00:49 |
And if real lights are off, then the
fluid will be illuminated by the lighting
| | 00:54 |
built into the fluid shape.
You can see here there's an ambient light
| | 00:59 |
and there's also a key light that are
built into the fluid.
| | 01:03 |
The built in lighting is much faster to
render.
| | 01:06 |
And because this is a foam shader, it's
not really going to be modeled.
| | 01:10 |
It's not going to have much gradient from
light to dark on it.
| | 01:13 |
It's going to be kind of uniformly
sparkly.
| | 01:15 |
And so therefore, there's no need for us
to calculate real lights anyway.
| | 01:19 |
Likewise, the self shadowing can be
disabled.
| | 01:23 |
The foam really won't generate much of a
shadow at all, let alone shadow itself.
| | 01:28 |
So that's to improve our render times.
Also before we can do a batch render of a
| | 01:32 |
dynamic simulation, we will have to cache
the simulation.
| | 01:36 |
Caching means storing the simulation on
disk.
| | 01:40 |
So instead of calculating the simulation
during the render, we will actually just
| | 01:45 |
load the simulation data off disk.
That's very important because if you
| | 01:50 |
don't cache your dynamics, then when you
do your batch render you may see
| | 01:54 |
unexpected results.
It may not behave properly.
| | 01:59 |
What you saw in the view port may not be
the same as what you get back from your
| | 02:02 |
batch render.
It's very important and not optional.
| | 02:07 |
You have to cache any dynamic simulation
in Maya before rendering.
| | 02:12 |
In this case, the only thing I need to
cache are the particles.
| | 02:16 |
want to select that particle, because the
passive colliders are not going to move,
| | 02:21 |
and so they don't need to be cached.
So only the active dynamic object will
| | 02:26 |
need to be cached in this case.
In the end dynamics menu set, I'll go to
| | 02:30 |
end cache, create new cache options.
And these are the default options.
| | 02:34 |
What it's going to do when I click Create
is it's going to save one file for each
| | 02:40 |
frame in the current timeline.
So my timeline is from frame 100 to frame
| | 02:47 |
300, currently.
And it's going to save all that data into
| | 02:53 |
the current project's data folder, and it
will create by default a subfolder which
| | 02:58 |
has the same name as the current scene
file.
| | 03:04 |
The cache files themselves will be named
according to the name of the object you
| | 03:08 |
have selected.
So in other words, I've selected these particles.
| | 03:13 |
And that will be the name of the cache
files themselves.
| | 03:18 |
So when I click Create, it's going to
have to run through the entire 200 frame simulation.
| | 03:23 |
And we'll just have to sit back and wait
for that to finish calculating.
| | 03:27 |
Our particles have finished caching and
that means that now we can actually scrub
| | 03:30 |
through the timeline.
We can skip through to any representative frame.
| | 03:35 |
Which is something that we couldn't do
before.
| | 03:38 |
If I skip forward or backwards in the
timeline, then I would have received an
| | 03:41 |
error message saying that you skipped too
many frames.
| | 03:46 |
But now that it's been cached, Maya
doesn't have to calculate everything up
| | 03:49 |
to the current frame in order to display
the condition of the nucleus simulation.
| | 03:55 |
That means that now we could actually
render this and we won't see any
| | 03:58 |
unpleasant surprises.
It's important to understand that once
| | 04:03 |
the simulation has been cached, if you
need to make any changes to the
| | 04:07 |
simulation then you'll need to delete the
cache.
| | 04:11 |
Right now if I made any changes like
change the stickiness, or the radius of
| | 04:15 |
the particles or, really any changes at
all.
| | 04:19 |
Those changes would not be reflected.
I could go in and change 600 different
| | 04:22 |
variables, and nothing would happen on
the screen.
| | 04:26 |
Because the cache is completely taking
over all of those variables.
| | 04:30 |
So if you need to make changes, you'll
need to delete the cache, just by going
| | 04:34 |
up to inCache and deleting the cache with
the selected objects.
| | 04:40 |
Let's take a look at the cache just so we
can see the files themselves.
| | 04:45 |
I'll minimize Maya, and you'll see in my
current projects exercise files, in the
| | 04:50 |
data folder.
Now, I've got 0109 building in cache.
| | 04:56 |
And these are the files.
And each one of these is a frame in the animation.
| | 05:01 |
You'll there's another one here, pawn
cache.
| | 05:03 |
That was a pre-existing one.
And that was a continuation from the
| | 05:06 |
previous course, which was creating fluid
effects in Maya.
| | 05:10 |
So our cache has been built and we're
ready to do a batch render.
| | 05:14 |
Now I want to mention once again that,
that batch render could be very slow
| | 05:17 |
because the fluid shape node is slow to
render.
| | 05:20 |
And so, I rendered 200 frames and it took
about six hours to render at 1280 by 720.
| | 05:27 |
Let's take a look at that final
rendering.
| | 05:32 |
So that's the end result of our dynamic
foam simulation using N particles.
| | 05:37 |
| | Collapse this transcript |
| Emitting nParticles from an object| 00:00 |
In this exercise we'll create bubbles
inside a glass of water.
| | 00:04 |
And what you'll see here in this scene
are three objects.
| | 00:08 |
We've got a glass, that's the tumbler.
We've got a cylinder that's going to
| | 00:12 |
represent the water in the glass.
And then also, this is a polygonal object
| | 00:17 |
here that's going to be a collision
object.
| | 00:21 |
What we'll do is we'll emit bubbles from
the water.
| | 00:24 |
And they'll rise upward.
And when they collide with this circle,
| | 00:27 |
they will disappear.
You'll note that these objects are all
| | 00:32 |
rendering as wire frame even though I'm
in a shaded display mode here.
| | 00:36 |
Just to show you what that's about, what
I've done is I've changed the object
| | 00:39 |
display for these objects so that they
will always draw as wire frame.
| | 00:44 |
If we just select any one of them and
goes to the attributes, Ctrl+A.
| | 00:49 |
If you look in the object display section
of the mesh shaped node, there's a
| | 00:53 |
drawing overrides section.
And I've turned enable overrides on.
| | 00:59 |
And I've turned shading off.
And adjust the wire frame color here.
| | 01:03 |
So that we can see the particles through
the glass.
| | 01:08 |
It will still render in the usual way.
So let's emit particles from the water.
| | 01:13 |
I want to select the water object, and
then go to the End Dynamics menu set.
| | 01:20 |
And in the End Particles menu, go to
Create End Particles and choose the Balls preset.
| | 01:27 |
Then go back into that menu again and
choose Create End Particles.
| | 01:31 |
And with the water object selected,
choose Emit from Object.
| | 01:37 |
Now if we play our simulation, you'll see
that with the default options for Emit
| | 01:41 |
from Object, the particles are emitting
from the vertices of the water object.
| | 01:48 |
All we need to do is go to the emitter
attributes and change the emission type.
| | 01:54 |
So here's emitter type.
I want to change that to surface.
| | 01:58 |
Rewind and play back.
And now you'll see particles are being
| | 02:01 |
born from every position on the surface
of that cylinder.
| | 02:06 |
We'll make a few more changes here.
I'm going to set the rate down a little
| | 02:09 |
bit so we'll have only about 50 particles
per second.
| | 02:13 |
Scrolling down a little bit more I just
want to turn all these speed attributes off.
| | 02:18 |
Set all of it to zero and that way they
will still respond to gravity but they
| | 02:21 |
won't jump out at the volume of the
glass.
| | 02:26 |
Now we want to play around a little bit
with the particles themselves.
| | 02:31 |
I'm going to select the Particles and go
to their Shape node.
| | 02:34 |
The most important thing we want to do
with these End Particles is to Disable
| | 02:38 |
Solver Gravity and that's going to be
found in the Dynamic Properties section
| | 02:42 |
so open that up.
And turn Ignore Solver Gravity on.
| | 02:47 |
We do not want these particles to respond
to the nucleus gravity.
| | 02:52 |
Play that back.
And now you'll see they're just being
| | 02:55 |
born in place and then just sticking
there to the surface of the water object.
| | 03:00 |
Now we want to get them moving upward.
And we can do that in lots of ways.
| | 03:04 |
The easiest way is directly here in this
dynamic properties section and we can set
| | 03:09 |
this local force in y to a positive
value.
| | 03:13 |
Let's give it a value of 5.
Play back and you'll see now those
| | 03:17 |
particles are moving upward.
Some of the particles may kind of pop out
| | 03:22 |
of the volume of the water.
And the reason that that's happening is
| | 03:27 |
because the particles are actually
colliding with themselves.
| | 03:30 |
All we need to do to prevent that
happening is to go up into the Collision
| | 03:33 |
section, and turn Self Collide off.
Now the particles simply rise upward.
| | 03:41 |
And one more nice little thing that I
want to do here in the end particle shape
| | 03:43 |
node is vary the radius so that they're
not all the same size.
| | 03:48 |
And that's simple enough.
Just in the particle size section, we've
| | 03:51 |
got the overall per object radius, so
that's the general radius for all the particles.
| | 03:58 |
And then we've got a radius scale section
here, I want to set the radius scale
| | 04:02 |
input to randomized ID.
And then just adjust this curve here.
| | 04:07 |
I'll create another point on the graph.
And now we've got a variable radius, so
| | 04:12 |
each particle will have a random radius
based upon the shape of this graph.
| | 04:18 |
So we've got our particles emitting from
the water object.
| | 04:22 |
| | Collapse this transcript |
| Defining an emission ramp| 00:00 |
With our particles emitting form the
surface of the water object, you'll
| | 00:03 |
notice that we're not getting very many
particles at the bottom of the glass.
| | 00:08 |
I'm getting a lot of them at the top.
What we want to do is make is so that we
| | 00:12 |
get more particles at the bottom, and
fewer up here.
| | 00:17 |
And the way to do that is with an
emission ramp.
| | 00:20 |
We can assign a texture to control the
emission rate, so that where the texture
| | 00:25 |
is brighter, we'll get more particles.
To do this, what we need to do is just
| | 00:31 |
temporarily assign a material to the
water object that's acting as an emitter.
| | 00:36 |
And then we'll place a ramp on that
material, and then instance that ramp
| | 00:40 |
into the emitter.
So the first step is, we just want to
| | 00:44 |
make this water object visible again.
I want to select it and go back into
| | 00:48 |
Object Display Drawing Overrides and just
turn that off for a moment.
| | 00:53 |
Then I want to assign a temporary
material.
| | 00:55 |
Just right-click on the object and choose
Assign New Material.
| | 00:59 |
And it doesn't matter what type of
shading material it is, Lambert is fine.
| | 01:04 |
And I want to just rename this so I know
what it is.
| | 01:07 |
This is Emission Rate Lambert.
This is just a temporary material.
| | 01:12 |
We have to assign a material to the
object.
| | 01:16 |
Because the placement of the emission
ramp is going to be dependent on the u
| | 01:22 |
v's of the object.
In the Color section here, in the Color
| | 01:26 |
channel, I want to create a new render
note.
| | 01:29 |
So click on the Checker icon, and it's
going to be a ramp.
| | 01:34 |
And if we want to see that ramp in the
view port, then we're going to want to
| | 01:37 |
hit the six key in the view here, so we
can see textures.
| | 01:41 |
There we go.
Let's go back into that ramp.
| | 01:44 |
I've got the object selected, and I want
to find the Lambert material and then
| | 01:48 |
drill down into the color ramp.
And the ramp should just be black and
| | 01:52 |
white, and anywhere that it's white will
get more particles and anywhere that it's
| | 01:56 |
black will get no particles.
We really only need two colors here.
| | 02:01 |
So let's make this bottom one white, and
make the top one black here.
| | 02:07 |
And move those around a little bit.
So essentially what we're saying is we
| | 02:11 |
want a lot of particles born here.
Fewer particles here and no particles
| | 02:16 |
will be born up here.
So we've got our material assigned.
| | 02:20 |
Now what we need to do is we need to get
the hypershade open and also the emitter
| | 02:25 |
attributes at the same time.
To get the Emitter attributes up, we can
| | 02:31 |
go ahead and select our particles.
And then go to the Emitter node.
| | 02:36 |
And we want to scroll down on the
attributes.
| | 02:39 |
We're looking for Texture Emission
attributes.
| | 02:42 |
And this Texture Rate is what's going to
control the number of particles born per
| | 02:46 |
second from that surface.
And then we also want to open up the hypershade.
| | 02:51 |
Window > Rendering Editors > Hypershade.
And we want to go to the Textures section
| | 02:58 |
here, and here's my ramp that we made
before.
| | 03:00 |
And what we do is we just middle mouse
drag that ramp onto the Texture Rate.
| | 03:07 |
And be sure to turn on the switch that
says Enable Texture Rate.
| | 03:11 |
And now that's done.
We can go back to our Drawing Overrides,
| | 03:16 |
we can select that water object, turn
Overrides back on, and also reassign the
| | 03:20 |
water material that was on there
previously.
| | 03:25 |
The temporary material that we created
has done its job and we don't need it anymore.
| | 03:30 |
We can go ahead and right-click on that
and choose Assign Existing Material.
| | 03:35 |
And there's one here that's labeled Water
Mia Material.
| | 03:39 |
We'll choose that.
Rewind and play it back, and now you'll
| | 03:43 |
see we're getting a lot of particles
being born from the bottom and very few
| | 03:46 |
from the top.
And we can exaggerate that by going back
| | 03:51 |
into the emitter, and change the overall
emission rate.
| | 03:55 |
So, I can go to emitter one, and I can
increase the overall rate.
| | 03:59 |
Let's say 200, just for illustration
purposes.
| | 04:03 |
Now you'll see, we're getting a lot of
particles born from the bottom of the glass.
| | 04:07 |
I'll knock that back down to about 50.
And that's how you can determine the
| | 04:13 |
emission rate, based upon the brightness
of a texture.
| | 04:17 |
| | Collapse this transcript |
| Using the Particle Collision Event Editor| 00:00 |
Our particles are flowing upward just as
we want them to.
| | 00:04 |
Now what we need to do is make them die
when they reach the top of the water.
| | 00:09 |
And to do that, we'll make them collide
with this polygon object.
| | 00:13 |
That's not a curve, it's actually a
polygon surface that I've set the drawing
| | 00:16 |
overrides on.
So, just to illustrate that if I go back
| | 00:19 |
to the Attribute Editor.
And turn Enable Overrides off, you will
| | 00:22 |
see that it's actually a polygon surface.
What we want to do is make that a passive
| | 00:27 |
nucleus collider.
So with that tumbler collider object
| | 00:31 |
selected we'll go into the end mesh menu
and choose create passive collider.
| | 00:36 |
Rewind the stimulation and play it back
and now you'll see that the particles are
| | 00:40 |
bouncing off that surface.
What we want them to do is actually
| | 00:44 |
disappear when they collide.
To make that happen, we'll use a window,
| | 00:49 |
and it's found in N Particles menu.
And it's called the Particle Collision
| | 00:54 |
Event Editor.
Go ahead and open that up.
| | 00:56 |
So what we want to do here is we want the
particle to die when it collides with something.
| | 01:04 |
So we'll go down here and choose original
particle dies, and then click Create Event.
| | 01:12 |
And now once we've created the event you
will see that there is an event listed
| | 01:15 |
over here.
If we had multiple collision events they
| | 01:19 |
would all be listed here.
If we wanted to make changes here we
| | 01:23 |
would select that event and then make
some adjustment in the window, and the
| | 01:26 |
weird thing about this window is there's
no button to update any changes that you make.
| | 01:33 |
So, in other words, when you make a
change, it's enacted immediately and
| | 01:36 |
there's no button to update or edit, so,
don't let that throw you off.
| | 01:41 |
So, we close that window, rewind, and
playback.
| | 01:44 |
And now, what we see is, when those
particles reach the top of the water,
| | 01:47 |
they collide with that collision object,
and then according to the Particle
| | 01:51 |
Collision Event Editor, they reach the
end of their life.
| | 01:55 |
| | Collapse this transcript |
| Rendering refractive bubbles| 00:00 |
We've got our bubbles moving the way that
we want, and they're dying when they
| | 00:03 |
collide with that disc, and the last
thing you want to do is just set them up
| | 00:06 |
to render correctly.
Right now, they're going to render kind
| | 00:12 |
of strangely or not at all, because their
render type is set to blobby, and blobby
| | 00:16 |
particles are set to overlap and these
aren't overlapping at all, and so we may
| | 00:20 |
not see anything.
What we want to do, is just render these
| | 00:26 |
as spheres in Mental Ray.
I'll go ahead and select the particles,
| | 00:30 |
and go to the end particle shape node,
and find the shading section, and set the
| | 00:34 |
particle render type to Spheres.
And that's going to actually render just
| | 00:40 |
fine in Mental Ray currently.
If you needed to render it in Maya
| | 00:44 |
software, then the spheres particle type
wouldn't work because that's a hardware
| | 00:49 |
particle type.
And what you would have to do is use the
| | 00:53 |
Particle Instancer.
You'd have to create a geometrical sphere
| | 00:57 |
and then instance it onto each one of
those particles.
| | 01:00 |
I'm not going to cover how to do that
here.
| | 01:03 |
However, in another course here at
lynda.com, I did go over using the
| | 01:06 |
Particle Instancer.
That course is called Creating Particle
| | 01:10 |
and Fire Effects with Maya.
But in this case, we're rendering in
| | 01:15 |
Mental Ray, and Mental Ray will actually
render hardware particles, so that's good.
| | 01:20 |
And then the last thing we need to do is
to assign a material, I've already got
| | 01:24 |
one in here for the water.
We can just go and just reassign that to
| | 01:28 |
these particles.
Right click and choose Assign Existing
| | 01:31 |
Material, and choose Water Mia Material.
And if you want to render this with
| | 01:38 |
refractive objects inside one another,
then you'll need to make sure that your
| | 01:41 |
Mental Ray settings are set to production
quality.
| | 01:45 |
So that you'll have enough trace depth.
In other words, rays will be able to go
| | 01:49 |
through all of these objects.
So you want to get into your Mental Ray
| | 01:53 |
Settings and go to the Quality tab, and
make sure it's set to Production Quality.
| | 01:58 |
And what that does, among other things,
is increased the traced depth, which is
| | 02:01 |
here in the ray tracing section, here.
These values have to be increased enough
| | 02:07 |
to allow a ray to refract through these
multiple surfaces.
| | 02:11 |
So let's do a render of that.
Our bubbles are actually refracting, we
| | 02:16 |
can see these here.
I think we probably need more of them.
| | 02:20 |
So I'll go ahead, and go back into the
Emitter Node, and increase the rate.
| | 02:25 |
Maybe we'll need to increase it up as
much as 200.
| | 02:28 |
Rewind.
Press Play.
| | 02:31 |
And we would want to do some more test
renders of this, to make sure it's
| | 02:33 |
looking right.
When it is looking the way that we want
| | 02:37 |
it to, we'll need to create Maya in cache
before we actually do the batch render,
| | 02:41 |
as explained in a previous movie in this
chapter.
| | 02:45 |
| | Collapse this transcript |
|
|
2. Pouring Liquid with nParticlesFilling a container using Fill Object| 00:00 |
In the following chapter, we'll look at
how to create a liquid simulation using
| | 00:04 |
Maya nParticles.
I just want to show you how we can fill a
| | 00:09 |
container automatically with nParticles.
But before we do that, I just want to
| | 00:14 |
point out the layout of this scene.
Let's open up the Outliner, Window
| | 00:18 |
Outliner and the important thing I want
to point out to you is that this gin
| | 00:22 |
bottle has got two versions of the
bottle.
| | 00:26 |
There's the gin bottle itself, which is
currently hidden, and then I've also got
| | 00:30 |
a proxy object.
The reason for that is the collisions
| | 00:35 |
didn't really work correctly with the gin
bottle that had an inner and an outer surface.
| | 00:41 |
So I had to create a single walled
surface here.
| | 00:45 |
That's working fine in terms of the
collisions but basically that's a good
| | 00:48 |
best practice is the object that is
dynamic is not the same one that renders.
| | 00:53 |
Additionally, you'll see that I've set
the drawing overrides on all of these so
| | 00:57 |
that they'll render as wire-frame in the
view port so that we can see the
| | 01:01 |
particles inside.
So, we want to fill this proxy object up
| | 01:06 |
with particles.
To do that, we can select the object, and
| | 01:10 |
then go to the N Dynamics menu set, and
go to the nParticles menu.
| | 01:15 |
And under Create nParticles, we want to
choose a preset, want to choose the water preset.
| | 01:22 |
Click on that.
That's going to set the nParticle base
| | 01:26 |
attributes to work with water, in other
words they'll render as blobby particles
| | 01:30 |
An they'll have a liquid simulation mode
enabled.
| | 01:34 |
However, that is certainly not enough to
get a good result.
| | 01:38 |
That's not even the beginning.
That's just a prerequisite that those
| | 01:41 |
settings be set that way.
So you can't expect that just because
| | 01:44 |
you've chosen that water preset that
you're actually going to get physically
| | 01:48 |
accurate simulations.
It doesn't really work that way.
| | 01:52 |
You have to invest a bunch of time
setting a bunch of settings.
| | 01:55 |
So that's just the first thing you have
to do.
| | 01:57 |
With that object still selected, I'll go
back into the nParticles menu and choose
| | 02:01 |
Create nParticles.
And we've got fill object.
| | 02:06 |
And we want to go to the options for
that.
| | 02:09 |
This is a convenient way to fill the
object full of nParticles.
| | 02:14 |
We've got the resolution.
That's the density or the number of particles.
| | 02:19 |
How many particles do we want?
Well, ten is really not enough.
| | 02:23 |
Let's set that up to a value of 30.
And then the other major attribute that
| | 02:28 |
we want to adjust is the particle
density, which is the overlap.
| | 02:32 |
How many particles are allowed to
overlap?
| | 02:35 |
And we need more than what we got here.
It's maxing out at a value of one, which
| | 02:40 |
means there will be no overlap.
But in fact, we basically always need
| | 02:44 |
some amount of overlap.
So, I want to set that to a value of two.
| | 02:49 |
Additionally, if you had a doubled walled
object you would need to enable this, but
| | 02:52 |
as I mentioned previously this proxy the
object only has a single mesh surface, so
| | 02:56 |
it's not double walled.
There we go, we'll click Particle Fill.
| | 03:02 |
It'll take a moment to calculate and now
we've got nParticles filling up our proxy object.
| | 03:08 |
And you can see we've got an nParticle
shape node now, and we additionally have
| | 03:12 |
a nucleus node.
So if we press play, what we'll see is
| | 03:17 |
that the particles explode.
That's happening for a couple of reasons.
| | 03:22 |
One, because we don't have any collisions
yet.
| | 03:26 |
And two, because the settings in the
particle shape node are not set correctly
| | 03:30 |
just yet.
The first thing is to make this gin
| | 03:34 |
bottle a collision object.
So, I can select it, go back into end
| | 03:37 |
mesh and choose Create Passive Collider.
So, if we press play, the particles still
| | 03:42 |
explode but they explode upward through
the spout of the bottle here.
| | 03:47 |
We can select those particles, and then
go to their attributes, Control A.
| | 03:52 |
And what you want to look for is, the
liquid simulation section.
| | 03:58 |
You can open that up, and what you'll see
in here are some very important attributes.
| | 04:02 |
The incompressibility, rests density and
liquid radius scale.
| | 04:08 |
Incompressibility is just what it sounds
like.
| | 04:10 |
It prevents particles from basically
taking up less volume.
| | 04:15 |
So, it's a very low incompressability
value.
| | 04:18 |
I usually bring that up to at least ten.
The rest density is how many particles
| | 04:23 |
are allowed to overlap, and with a value
of two, we're able to get two particles
| | 04:28 |
in the same location.
And then finally the liquid radius scale,
| | 04:34 |
this acts like self collisions.
The particles are actually kind of
| | 04:38 |
bobbing up against each other.
And the liquid radius scale is a scaling
| | 04:43 |
factor that allows particles to overlap.
And currently with a value of one, we
| | 04:49 |
won't get much overlap.
What we need to do is reduce this value.
| | 04:54 |
And what we're saying here, essentially,
is that for the purposes of the liquid
| | 04:58 |
simulation collisions the particles are
half the size that we see on the screen.
| | 05:04 |
And we need to have a lot of overlap
because we're going to create a rendering
| | 05:08 |
with blobby particles.
And blobbies require that we have a fair
| | 05:13 |
amount of overlap between these
particles.
| | 05:17 |
So, now let's play back and see what we
get.
| | 05:20 |
So, with a liquid radius scale of .5,
we're getting a more predictable liquid result.
| | 05:24 |
Now, you'll see that that took quite
awhile to settle down.
| | 05:27 |
It took almost 100 frames to fall.
And that's because, currently the space
| | 05:32 |
scale for the nucleus node is set to a
value of one.
| | 05:36 |
And that's assuming that the world is
built at one one hundredth scale.
| | 05:40 |
But my scene is built at one to one
scale.
| | 05:43 |
I'll need to go into the neuclius node
and scroll down looking for scale attributes.
| | 05:49 |
Open that up.
And because the world here is build at
| | 05:52 |
one to one scale, the space scale
attribute will need to be set down to 0.01.
| | 05:59 |
So now we can go ahead and press Play and
you'll see it moves much faster.
| | 06:03 |
Additionally, the quality of the
simulation is determined in the solver
| | 06:07 |
attributes here and the sub steps of
three is not sufficient for a liquid simulation.
| | 06:13 |
In fact we'll always need to turn that
substeps value up all the way.
| | 06:17 |
And that will prevent particles from sort
of flying out and going crazy.
| | 06:21 |
Additionally, you should know that if you
increase the sub steps, it has the weird
| | 06:26 |
effect of amplifying the
incompressibility which was over in the
| | 06:29 |
particle shape node.
With an incompressibility of ten, we'll
| | 06:34 |
get a certain result if the nucleus node
is set to sub steps of 20, but we'll get
| | 06:38 |
a completely different result if the sub
steps was set down to the default of four.
| | 06:46 |
Basically, you'll always need to increase
the sub steps up and that will amplify
| | 06:50 |
the incompressibility.
Rewind the simulation and play it back.
| | 06:55 |
And so, now it's behaving a little bit
more like what we would expect to from a
| | 06:58 |
liquid simulation.
| | 07:00 |
| | Collapse this transcript |
| Filling a container using a volume emitter| 00:00 |
The Fill Object command is convenient,
but it's destructive.
| | 00:05 |
That means that after you fill the object
full of particles, you cannot change the
| | 00:09 |
number of particles later.
And it's very important that you have the
| | 00:13 |
ability to change the number of
particles.
| | 00:16 |
That's because the number and size of the
particles will determine how the surface
| | 00:21 |
will eventually render.
I found that it's a better practice in
| | 00:26 |
fact, to use a volume emitter instead of
the Fill Object command.
| | 00:30 |
Let's do it that way.
So we're going to go into the nDynamics
| | 00:34 |
menu set, and we'll go into nParticles >
Create nParticles, and make sure that the
| | 00:38 |
water preset is chosen.
And we're going to do Create Emitter.
| | 00:44 |
And it's created at the origin.
Let's tap the spacebar.
| | 00:48 |
What we want to do is just move that up
and position it so that it's inside the
| | 00:52 |
gin bottle.
So I'll get the move tool in the front
| | 00:55 |
view and just position that inside the
bottle.
| | 01:00 |
And then I'll need to move it in the top
view, as well.
| | 01:03 |
Move that forward and Z.
Make sure that it's square inside the bottom.
| | 01:07 |
Now, that's an omni emitter currently.
Let's go back to our camera view and open
| | 01:13 |
the attribute getter /g, Ctrl+A.
And we play this, you'll see we get
| | 01:19 |
particles shooting out.
Well, we don't want an omni emitter, we
| | 01:23 |
want a volume emitter.
So the basic emitter attributes for that
| | 01:27 |
emitter should be set to Volume.
And now you'll see we get a cube.
| | 01:32 |
The particles are built inside that cube.
Let's scale it up with the Scale tool.
| | 01:39 |
Needs to be taller.
And it needs to be just larger in
| | 01:43 |
general, so that it basically fills the
volume of the bottle.
| | 01:48 |
And we want to check that in the various
view ports here to make sure that it's good.
| | 01:51 |
We don't want it to be larger than the
bottle, we want it to be a little bit
| | 01:54 |
smaller than the bottle, so that no
particles are born outside the bottle.
| | 02:01 |
Play that back.
Very good.
| | 02:04 |
We don't want them to fly outward, we
just want them to start with a velocity
| | 02:07 |
of 0 and then just drop with gravity.
Scrolling down, we want to set the volume
| | 02:12 |
speed attributes all to 0, so away from
center, I want to set that to 0, press
| | 02:16 |
play, and you'll see okay, now they're
just falling.
| | 02:23 |
Now, of course we want the proxy object
here to be a collision object.
| | 02:26 |
So I want to select that.
Go into nMash > Create Passive Collider.
| | 02:30 |
Press play again, see what we get.
And our particles fall and collide with
| | 02:35 |
the inside of the bottle.
We don't want those particles to sort of
| | 02:39 |
appear and respond like that.
We want them to all be present on the
| | 02:44 |
first frame of the animation.
And there's a trick to this.
| | 02:48 |
What we'll do, is we'll set the emission
rate to a very, very high number, like a million.
| | 02:54 |
But then we'll limit the number of
particles in the particle shape node.
| | 02:58 |
So let's go into the outliner and
selectings.
| | 03:01 |
We want to first select the emitter node.
Here it is, emitter one.
| | 03:06 |
And we want to increase the rate up to a
very, very high number, like a million.
| | 03:11 |
And press Enter.
Now be careful, because if you press the
| | 03:15 |
play button now, then you may crash your
system, because you're creating way too
| | 03:19 |
many particles all at once.
But then, we'll go into the shape node,
| | 03:24 |
and limit the number of total particles.
And that'll be found in the emission
| | 03:30 |
attributes section.
Max count.
| | 03:34 |
We can set that to a value of let's say
1,000.
| | 03:37 |
What this'll do, is it will create 1,000
particles on frame one of the animation.
| | 03:42 |
Because we've said we want to create a
million particles per second, but we
| | 03:46 |
want to limit it to 1,000.
So rewind and play that back, and you'll
| | 03:50 |
see all those particles are built on one
frame.
| | 03:54 |
So we got our particles built, now we
want to adjust those particle attributes.
| | 03:58 |
Scrolling back up to the top of the
particle shape node, we're going to need
| | 04:02 |
to increase the radius here.
So I don't know exactly how much I need
| | 04:06 |
this to be, but the reason that I'm doing
it with this work flow is because I can
| | 04:10 |
go back and change the radius and the
number of particles after the fact non-destructively.
| | 04:17 |
So with a radius of 0.5, this is the
result that I'm getting.
| | 04:20 |
So scrolling down a bit in the liquid
simulation section once again, we've got
| | 04:25 |
incompressibility, rest density and
liquid radius scale.
| | 04:30 |
I'm going to increase the
incompressibility to about ten, rest
| | 04:33 |
density I'll leave at two, but I'll set
the radius scale down to about 0.5, which
| | 04:37 |
will create more overlap among those
particles.
| | 04:42 |
And then additionally, there's the
viscosity setting.
| | 04:45 |
We can turn that actually down to almost
nothing, because water is not very viscous.
| | 04:51 |
And there's also a very useful attribute
here called Surface Tension.
| | 04:55 |
And what that does, is it's sort of a
self-attraction attribute that causes the
| | 04:58 |
particles to kind of stick together.
And we need that because if the particles
| | 05:03 |
fly apart from one another, then when we
try to render them with blobbies, they
| | 05:06 |
wont render if they're seperate.
So they need to kind of stay together.
| | 05:11 |
I'll turn the surface tension up all the
way.
| | 05:12 |
Rewind and play back.
So you can see, with 1,000 particles with
| | 05:17 |
the liquid radius scale of 0.5, basically
they're all landing at the bottom here.
| | 05:23 |
So basically, I think I can increase the
radius a bit.
| | 05:28 |
So set that overall radius to 0.7, rewind
and play back.
| | 05:34 |
And now we're getting a better volume of
particles.
| | 05:37 |
In your own scenes, you're going to need
to adjust all of these variables.
| | 05:40 |
And you'll need to fin- tune all of these
attributes for your particular scene.
| | 05:45 |
And it's important that you get a decent
playback rate.
| | 05:48 |
Because it's no good to have teeny tiny
particles with millions and zillions of
| | 05:52 |
them, because the simulation playback
will be so slow in your view port that
| | 05:56 |
you will not be able to work.
So you have to try to find a happy medium
| | 06:01 |
between quality and performance, and we
do that by setting the overall number of
| | 06:06 |
particles, their radius, and their amount
of overlap in the liquid simulation
| | 06:10 |
settings here.
I think I need more particles, so I'll go
| | 06:17 |
back to the emission attributes, and set
the max count up to let's say, 2,000
| | 06:21 |
instead of 1,000.
Rewind and play that back.
| | 06:27 |
Now sometimes, you'll see that your
particles are a bit overactive, and they
| | 06:30 |
may actually even explode out of the
container, even if you've set everything
| | 06:34 |
else the way that it sort of should be.
There's one little trick that you can do
| | 06:40 |
here that will prevent those particles
from flying out.
| | 06:44 |
And that is to keyframe the damping
factor on the first few frames of the animation.
| | 06:50 |
Damping is a sort of chill out factor
that reduces the intensity of the simulation.
| | 06:56 |
What we'll do, is I'll rewind back to
frame one, and in my nParticle shape node
| | 07:01 |
up at the top, we're looking in the
dynamic properties area here, and you'll
| | 07:05 |
see Damp.
And what we'll do, is we'll just set it
| | 07:10 |
to a damp value of ten, which is the
maximum here, on frame one, and then key it.
| | 07:16 |
Right-click and set Key.
And then a few frames later, we'll go
| | 07:19 |
forward, let's say, about frame ten, set
the damp value down to zero, and then
| | 07:24 |
right click and Set Key again.
And if we play this back now, what's
| | 07:29 |
happening is that they sort of settle
down more gracefully.
| | 07:33 |
And if your particles are exploding out
of their container, then use this technique.
| | 07:39 |
One more thing you might want to do with
this damp factor, is to make it constant
| | 07:43 |
throughout the first few frames of the
animation and then drop off suddenly.
| | 07:48 |
And to do that, you'll want to set the
keyframes to step tangents.
| | 07:52 |
Go ahead and select the particle shape
node, and go into the graph editor,
| | 07:56 |
Window > Animation Editors > Graph
Editor.
| | 08:00 |
And you can see, here's the damp curve.
We just want to select those keyframes
| | 08:04 |
and set them to step tangents.
And that'll make the damp factor constant
| | 08:08 |
for the first ten frames, and then drop
off to nothing.
| | 08:12 |
Rewind and play back the simulation.
And again, this is a method to try to
| | 08:16 |
prevent those particles from becoming
overactive on the first few frames of the simulation.
| | 08:21 |
| | Collapse this transcript |
| Optimizing liquid simulation| 00:00 |
The key to getting a good simulation is
navigating the relationship between the
| | 00:06 |
radius and the number of particles and
how much they overlap.
| | 00:11 |
Let's go ahead and select our particles.
Go to the out liner and select In
| | 00:15 |
Particle One go to it's attributes,
Ctrl+A.
| | 00:19 |
Now with the settings that we had from
the last movie, what we've got here is
| | 00:23 |
particles with a radius of 0.7.
And we've got a total of 2000 particles
| | 00:28 |
as determined by the setting in the
emission attributes.
| | 00:33 |
So, I've got 2000 particles with a radius
of 0.7.
| | 00:38 |
To get a really good result to our liquid
simulation, we want smaller particles,
| | 00:43 |
and that way we'll have a finer
resolution, it will look better and
| | 00:46 |
behave better.
However, if I simply reduce the radius
| | 00:52 |
down to maybe 0.5 then what will happen
is the amount of volume will be reduced,
| | 00:56 |
and we'll need to increase the number of
particles accordingly.
| | 01:03 |
Let's see what that looks like, if I
reduce the radius to .5, and rewind and
| | 01:06 |
play back.
Now we're getting a lot less volume, when
| | 01:11 |
I've reduced it from .7 to .5.
If I want to get even better quality I
| | 01:16 |
could bring this down even further to,
let's say, .4 for the overall radius.
| | 01:22 |
And now, we're going to get almost no
volume at all.
| | 01:25 |
We're basically getting, like ,maybe
three particles tall here at the bottom
| | 01:29 |
of the gin bottle.
That means that we need more particles,
| | 01:33 |
but, what happens when you increase the
particle count is, your performance gets
| | 01:38 |
dropped down significantly.
Your simulation will run a lot more slowly.
| | 01:44 |
Let's scroll down into that Max Count,
and let's say we increase it to a value
| | 01:49 |
of 10,000 to compensate for the lower
radius.
| | 01:54 |
Rewind and play that back, and now with
10,000 particles the radius of .4, the
| | 01:59 |
simulation rate is much slower.
It's running at maybe three frames a
| | 02:04 |
second now.
However, we are getting a much better
| | 02:08 |
result, and it's looking a lot more
liquid and a lot more like water that
| | 02:12 |
actually flows.
In your own scene you will need to
| | 02:17 |
balance these different attributes, the
number of particles, the radius of the
| | 02:20 |
particles, and also in the liquid
simulation section here.
| | 02:26 |
The rest density and liquid radius scale.
The rest density, once again, is how many
| | 02:31 |
particles are allowed to overlap on top
of one another.
| | 02:34 |
And liquid radius scale is the size of
the particles for the purposes of the
| | 02:38 |
liquid simulation inter particle
collisions.
| | 02:43 |
If I increase the liquid radius scale,
what will happen is we will get less
| | 02:47 |
overlap, because the particle size will
be larger for the purposes of the inter
| | 02:52 |
particle collisions.
Let's see what happens if I increase that
| | 02:57 |
liquid radius scale up to a value of .7
and play that back once again.
| | 03:03 |
What I expect to see from that is, we get
a larger overall volume.
| | 03:09 |
And that is indeed what we're seeing
here.
| | 03:11 |
The bottle is filling up to nearly half
way full now, because I've got a larger radius.
| | 03:17 |
And the rest density also influences that
behavior, too.
| | 03:21 |
If I have a lower value to the rest
density, then not as many particles will
| | 03:25 |
be allowed to overlap.
Let's see what happens when we set that
| | 03:29 |
rest density to a value of let say 1.5.
Rewind and then play back, once again
| | 03:34 |
we're getting a little bit more volume
from that by reducing rest density, we'll
| | 03:39 |
get less overlap.
And in your own scenes once again you
| | 03:45 |
will have to tune all of these variables.
You can see that it's kind of bouncing
| | 03:50 |
and its kind of squashing up and down.
And we can help that along by increasing
| | 03:55 |
the incompressibility, to make it less
compressible.
| | 03:59 |
An remember once again that, that is
influenced by the settings in the
| | 04:03 |
nucleus, solver node.
The solver substeps, will increase the
| | 04:08 |
amount of incompressibility.
So, if I turn that all the way up to 20,
| | 04:13 |
then what I expect to see here is that
those particles will not squash down
| | 04:16 |
quite as much.
They'll be less compressable, and of
| | 04:20 |
course I've also increased the
incompressability attribute itself.
| | 04:24 |
And having done both of those now, we're
getting a much greater volume to our particles.
| | 04:31 |
And they won't stretch and squash as much
as they did before, it will behave more
| | 04:35 |
like water.
We may not be able to work with this in
| | 04:38 |
terms of interactivity in the view port,
so you may have to find a happy medium
| | 04:43 |
between quality and performance.
Maybe you'll need to increase the radius
| | 04:49 |
of the particles in order to get a better
result.
| | 04:52 |
But those are the variables that you need
to look at, and adjust, in your own scenes.
| | 04:58 |
| | Collapse this transcript |
| Setting an initial state| 00:00 |
I've made some more adjustments to the N
Particle Shape Node properties, and so I
| | 00:04 |
can get a pretty good result here.
I want to just show you what those
| | 00:09 |
adjustments are and remind you again that
you'll need to spend quite a bit of time
| | 00:13 |
in your own scenes to tweak out the N
Particle shape known attributes in order
| | 00:17 |
find a balance between performance and
quality.
| | 00:23 |
Let's take a look.
I'll go into the outliner and select the
| | 00:27 |
n-particle node and go to the attributes,
Ctrl A.
| | 00:32 |
What I've done is I've settled on a
radius of 0.5 and I've also randomized
| | 00:36 |
the radius by setting the radius scale
input to randomized ID, and I've changed
| | 00:40 |
the shape of this curve here so that
we'll get some particles larger than others.
| | 00:48 |
That's important so that we don't get a
regular pattern to our water.
| | 00:52 |
Scrolling down a bit further here, in the
Liquid Simulation properties, we've got
| | 00:57 |
an incompressibility of 10, rest density
of 2, and a radius scale of 0.7.
| | 01:04 |
I've reduced the viscosity a little bit
down to 0.01.
| | 01:07 |
And then finally, I set the surface
tension to about 0.5.
| | 01:14 |
When I had a surface tension of one, the
particles were globbing together a little
| | 01:18 |
bit too much.
Additionally in the nucleus node, I've
| | 01:24 |
set the space scale to 0.1.
And that's just because when I set it to
| | 01:29 |
0.01 I was getting a little bit too
overactive of a simulation.
| | 01:33 |
So I've sort of reduced that scale so
that my scene is behaving as if it were
| | 01:38 |
at a 1/10 scale instead of a one to one
scale.
| | 01:43 |
I've left the substeps at 20 basically
having turned it up all the way.
| | 01:47 |
So, I can play my simulation through
again and get it to a point where it
| | 01:51 |
looks good, and then I'll need to set an
initial state.
| | 01:57 |
And that will be the condition of the
simulation on frame one of the animation.
| | 02:02 |
Just want to let that play out until it
settles down.
| | 02:06 |
And round about 50 or so, should be in a
pretty settled down state.
| | 02:11 |
And with those particles selected, I'll
go up into the End Solver menu, and
| | 02:17 |
choose Initial State, Set from current,
and that will be the condition of the
| | 02:22 |
particles on frame one.
And then rewind, and you'll see on frame
| | 02:28 |
one they're already settled down.
Now, I still do have a damp factor.
| | 02:34 |
Remember, we set keyframes on the damp
attributes.
| | 02:38 |
Those are here, still, so I want to
delete those.
| | 02:41 |
I'll go ahead and Shift drag across these
keyframes here and right click and delete.
| | 02:49 |
And I want to verify that my Damp is set
to Zero now.
| | 02:53 |
Go back to that shape node and go back up
into the Dynamic properties and you see,
| | 02:57 |
in fact just as I suspected, it's not
zero.
| | 03:01 |
So I want to set that Damp back down to
zero.
| | 03:03 |
And then play the simulation and what I
should see is that the water is just kind
| | 03:07 |
of drifting around a little bit and
settling down.
| | 03:10 |
And I can set the initial state again
once its actually fully settled down.
| | 03:17 |
And Solve Initial State, set from
Current.
| | 03:21 |
Now, if you need to make changes to your
simulation, maybe after you've done all
| | 03:24 |
this work and then you actually animate
your geometry, and pour the water or
| | 03:27 |
whatever, maybe it's not working the way
you want and you need to go back and make changes.
| | 03:34 |
Basically, what you'll need to do is to
remove the initial state, and that's
| | 03:38 |
easily done, just go back up into End
Solver Initial State, Clear Initial State.
| | 03:44 |
I'm not going to do it now but it's
important to mention that so that if you
| | 03:47 |
need to make changes, you can start from
a fresh slate.
| | 03:50 |
| | Collapse this transcript |
| Animating the geometry| 00:00 |
With our liquid simulation basically
working the way that we want, it's time
| | 00:03 |
to keyframe the object so we can pour
the liquid from one vessel into the other.
| | 00:08 |
To make that happen, we'll need to make
this tumbler a passive collider.
| | 00:13 |
Co ahead and select that tumbler and go
into the N mesh menu and choose Create
| | 00:16 |
Passive Collider.
And now I'm ready to animate this locator here.
| | 00:21 |
The locator is the parent of the passive
collider that's containing the water.
| | 00:26 |
It's also the parent of the renderable
bottle.
| | 00:30 |
But before we make any keyframes, we're
going to want to disable the evaluation
| | 00:33 |
of nucleus.
Because if we try to scrub around in our
| | 00:36 |
timeline while nucleus is enabled we're
going to have performance issues.
| | 00:41 |
We want to go into the Modify menu and
choose Evaluate Nodes and turn off nucleuses.
| | 00:47 |
I want to mention that this Evaluate
Nodes menu can sometimes be problematic
| | 00:52 |
and you may notice that the visual state
of these check boxes does not reflect the
| | 00:56 |
actual state of whether the particular
node type is being evaluated or not.
| | 01:04 |
So, in other words, you can't always
trust whether this is on or off.
| | 01:09 |
And if you're not sure you can always go
up to evaluate all or ignore all, and
| | 01:12 |
that's kind of like the ultimate kill
switch, which will turn everything on or off.
| | 01:16 |
So, now, we can go ahead and create key
frames, since I've scrubbed through here,
| | 01:20 |
I don't have any performance problems.
So, on frame one, I want to keyframe the
| | 01:25 |
position and rotation of the gin bottle
locator.
| | 01:29 |
And there's a shortcut key for making key
frames for position and rotation.
| | 01:33 |
To make a position key it's Shift+W and
to make a rotation key its Shift+E.
| | 01:39 |
And you can see here now I've got key
frames on all position and rotation channels.
| | 01:44 |
I want to go forward in my timeline to
about frame 25 or so and make another
| | 01:48 |
keyframe, grab the Move tool and just
position the bottle and rotate the bottle.
| | 01:54 |
And of course, the water is staying
behind because I've disabled evaluation.
| | 02:00 |
So that's pretty good for the second key
frame.
| | 02:04 |
I'll hit Shift+W and Shift+E, once again,
to create more keyframes there.
| | 02:08 |
And just test that and make sure that's
working.
| | 02:11 |
Be careful that you don't move your
objects too quickly.
| | 02:13 |
It needs to be a physically possible
movement.
| | 02:17 |
If you try to animate the object moving
super fast, than your dynamics are just
| | 02:20 |
going to freak out.
So you just gotta make it actually a
| | 02:24 |
believable speed to the movement.
And if you're not sure if it's running in
| | 02:28 |
real time, of course you'll want to right
click on your timeline and make sure that
| | 02:31 |
your playback speed is set to play every
frame max real time.
| | 02:37 |
So now we'll go forward a little bit,
another second.
| | 02:39 |
Let's say frame 49, and then position and
rotate.
| | 02:45 |
Try to make that so its going to sort of
aim into that tumbler there and then
| | 02:50 |
create two more keyframes Shift+W and
Shift+E, once again test it, play it
| | 02:55 |
back, very good.
We'll want to actually make one more key
| | 03:00 |
frame so we can pour all of the liquid
out.
| | 03:03 |
So I'll go down to about frame 100 or so
and once again position and rotate it so
| | 03:08 |
that it's actually nearly vertical so
that all of that liquid can pour out.
| | 03:15 |
Positioned up a little bit more, Shift+W
and Shift+E.
| | 03:20 |
Rewind and play it back, see what we got.
That's probably okay.
| | 03:25 |
I think we're good to go on that.
We can go back to re-enable the nodes,
| | 03:30 |
Evaluate Nodes > Evaluate All.
We can play that back and see what we get.
| | 03:37 |
Now the preformance is going to be pretty
slow, of course.
| | 03:41 |
And so, in order to really make this
work, we're going to have to do a
| | 03:43 |
playblast so we can evaluate whether it's
playing back at the correct speed.
| | 03:48 |
But I just want to make sure that it's
not actually exploding.
| | 03:52 |
And that the liquid is actually pouring
out and making it into the tumbler okay.
| | 03:58 |
And then in the next movie we'll actually
make a playblast and cache the particles.
| | 04:03 |
| | Collapse this transcript |
| Playblasting and caching the simulation| 00:00 |
We've done an initial test on our
simulation, and now we need to actually
| | 00:04 |
do a playblast to make sure everything's
working correctly and it feels right, and
| | 00:08 |
it's at the correct speed.
And if that checks out okay, then we'll
| | 00:14 |
need to cache our particles so that we
can then render them.
| | 00:18 |
Let's make the playblast first.
I'll go to the Window menu, and choose
| | 00:23 |
Playblast, go to the options, and I want
to save to the format QT, QuickTime, with
| | 00:28 |
encoding of H.264 with the quality all
the way up.
| | 00:33 |
I'll just render the playblast at the
same size as this window, so display size
| | 00:38 |
from window with a scale of one.
And I do want to save the file.
| | 00:43 |
And I'll just use the current file name
as the movie file.
| | 00:49 |
So if it''s not reading out the same
here, I can just change that.
| | 00:52 |
So I'll just call it O2O6 Playblast, and
then go ahead and click Playblast and let
| | 00:57 |
it simulate.
Okay our playblast is finished so let's
| | 01:03 |
go ahead and see what it looks like.
So that looks like a pretty good liquid
| | 01:10 |
simulation to me.
We could probably fine tune that and make
| | 01:13 |
it even better but we've got the
essential process down so I'm going to
| | 01:16 |
sign off on that and go ahead and create
an end cache.
| | 01:21 |
Want to rewind back to frame one and
select the particles.
| | 01:25 |
And of course, if you have trouble
selecting them, you can use the outliner.
| | 01:28 |
We got the particles selected, and just
as we saw in the last chapter, we can
| | 01:32 |
create an end cache.
End Cache > Create New Cache and go to
| | 01:36 |
the options, we can reset the settings.
Just make sure that we got the default
| | 01:42 |
settings here.
And it's going to create a folder inside
| | 01:45 |
the data folder with the current file
name as the new folder name.
| | 01:50 |
And hand particle shape one will be the
name of each file in the cache.
| | 01:56 |
And we're going to do the entire time
slider, which is currently ten seconds
| | 01:59 |
worth, or 240 frames.
Go ahead and create that end cache.
| | 02:06 |
Our end cache is finished calculating and
now we can actually scrub through the
| | 02:09 |
timeline, which is something that we
could not do before.
| | 02:13 |
Once again, I do want to mention that
when you've cached the dynamics you will
| | 02:17 |
not be able to make any changes until you
delete the cache.
| | 02:21 |
Because all the simulation has been
stored on disc.
| | 02:25 |
So, if I went in and changed the dynamic
properties, no change would occur in my
| | 02:29 |
view port, unless I deleted the end
cache.
| | 02:34 |
I'm not going to do that now, because
we've got what we want at this point.
| | 02:37 |
| | Collapse this transcript |
| Controlling nParticle shading| 00:00 |
With our particles cached, we're actually
ready to render them.
| | 00:04 |
And we have choices on how to render
these N particles.
| | 00:07 |
The easiest thing to do is to simply use
the default blobby surface, which is
| | 00:11 |
already turned on by default.
And we can just go ahead and render it now.
| | 00:16 |
However if we did this now I've got my
mental erase settings down to draft
| | 00:19 |
quality and wouldn't be able to see the
particles inside these refractive objects.
| | 00:25 |
So I want to hide them.
Select the tumbler and set its visibility
| | 00:29 |
to zero and also this gin bottle proxy I
want to set its visibility off as well.
| | 00:36 |
And then just scrub through to the
timeline to a representative frame and go
| | 00:40 |
ahead and do an interactive production
render.
| | 00:44 |
I'll select these particles, open up the
attributes, Ctrl+A, and then click IPR
| | 00:49 |
and drag a rectangle around the
particles.
| | 00:53 |
Once that's finishsed updating, we can
start playing around with the properties
| | 00:56 |
in the N particle shape node.
So as you can see, we're getting
| | 01:01 |
reflections and refractions for free,
that's just already enabled.
| | 01:05 |
We don't even need to do anything to turn
that on.
| | 01:07 |
Really, the main thing we want to concern
ourself with is the shading attributes
| | 01:12 |
here in the N particle shape node.
And you'll see the particular render type
| | 01:18 |
is set to blobby surface.
And that happened at the very beginning
| | 01:22 |
of our work flow when we chose the water
preset before we even created our particles.
| | 01:27 |
The main thing we want to look at here is
the threshold value.
| | 01:31 |
And this determines whether the blobby
surface will render or not, based upon
| | 01:35 |
how many particles are overlapping.
With a lower threshold, what we will see
| | 01:41 |
is each individual particle is kind of
rendering more defined and if I have a
| | 01:45 |
really low threshold, even down to zero,
each particle will be very distinct.
| | 01:52 |
And that's not really what we want in
most cases, we want to have a non-zero threshold.
| | 01:58 |
Now if we increase the threshold past the
value of one then what that means is that
| | 02:03 |
we have to have more than one particle
overlapping in order to actually render
| | 02:07 |
the blobby surface.
However with the threshold greater than
| | 02:13 |
one you might see that your mesh starts
to break up and so that's why the default
| | 02:17 |
value was 0.6 and it's actually probably
a pretty good value in this particular scene.
| | 02:25 |
So rendering our particles with the
default blobby surface properties is easy.
| | 02:30 |
But it may not be the most optimal
solution.
| | 02:33 |
We won't be able to smooth the mesh out
and get rid of some of these bumps and
| | 02:37 |
kinks in the liquid.
So if we want that to look smoother, then
| | 02:42 |
we can't really use the blobby surface
method.
| | 02:46 |
What we'll do is we'll convert the
particles to polygons.
| | 02:49 |
We'll do that in the subsequent movie.
| | 02:51 |
| | Collapse this transcript |
| Converting nParticles to polygons| 00:00 |
For better control over the rendering of
end particle liquids, we can convert the
| | 00:05 |
end particles to polygons and then assign
whatever share we want and additionally
| | 00:10 |
there will be some mesh tessellation
controls that will become active once
| | 00:15 |
we've converted The n particles to
polygons.
| | 00:21 |
I'll just go to a representative frame
once again.
| | 00:24 |
And with those n particles selected, go
to the modify menu and choose convert n
| | 00:29 |
particle to polygons.
And as soon as you do that, you will see
| | 00:34 |
that we get a polygonal surface.
It's not a perfect surface because you
| | 00:39 |
can see how it's kind of breaking up a
bit, but we can control that Then go into
| | 00:43 |
that End Particles Shape node and change
that up.
| | 00:49 |
So let's go to the Attributes, Control +
A, and we want to find that End Particle
| | 00:52 |
Shape Node once again.
And now, you'll see that there's a
| | 00:57 |
section that says Output Besh.
Open that up, and these values did not do
| | 01:02 |
anything previously in other words up
until now we couldn't change any of these
| | 01:06 |
values and nothing would happen but now
since we've converted to polygons this is
| | 01:10 |
now activated.
You'll see that we have a threshold value
| | 01:16 |
and that's the same threshold that we saw
previously.
| | 01:19 |
It works just the same as it does for
blobbies.
| | 01:22 |
And in fact, it's actually the same
attribute, it's just in two places at once.
| | 01:26 |
That threshold determines how many
particles need to overlap in order to
| | 01:31 |
create the mesh surface.
And so, with a low value we'll get a
| | 01:36 |
thicker fluid, and with a high value we
may not see much at all.
| | 01:40 |
So we want a kind of a low value in this
case.
| | 01:43 |
And that way it'll kind of be consistent.
Then we've also got the size of the
| | 01:48 |
triangles, and also the number of
triangles, and finally the mesh method.
| | 01:56 |
Whether you want a triangle output or
quad output.
| | 01:59 |
So, if I change this to quad mesh you can
see we're getting little cubes and that's
| | 02:03 |
actually kind of a good thing, because we
can apply a mesh smooth to this later and
| | 02:08 |
actually make this even better.
So I do kind of recommend using quad mesh.
| | 02:16 |
Now back to the triangle size and the
triangle resolution.
| | 02:20 |
So triangle size as the name implies is
how large these triangles are.
| | 02:24 |
And with a lower value, we're going to
get a more detailed mesh.
| | 02:29 |
The max triangle resolution is a limiting
factor.
| | 02:34 |
If we reduce this factor, then what will
happen is it will decimate the mesh.
| | 02:40 |
So if I have a low triangle resolution
of, let's say 10.
| | 02:44 |
Then even if I have a pretty low triangle
size, it's going to limit the overall resolution.
| | 02:50 |
This is the number of polygons that we're
permitted to have.
| | 02:53 |
I would recommend increasing this value.
The default was 100, maybe a value of 200
| | 02:59 |
or more and that way we'll get a lot of
good detail on our mesh.
| | 03:05 |
So if I have a low triangle size and a
high triangle resolution, then we'll get
| | 03:09 |
a pretty well detailed mesh.
Triangle size of 0.1's probably too low.
| | 03:14 |
So we'll try 0.3.
Now, you'll also see there's mesh
| | 03:18 |
smoothing iterations here.
And this is a little bit misleading.
| | 03:23 |
It's not actually going to subdivide the
mesh.
| | 03:26 |
What this does is it relaxes the mesh.
It kind of softens it out.
| | 03:32 |
If I increase the mesh smoothing
iterations up to about four, you can see
| | 03:35 |
what it's doing here, it's kind of
softening it up.
| | 03:39 |
But it's not increasing the level of
detail.
| | 03:41 |
Really I don't need to take it up past
about three or four, you'll see with a
| | 03:45 |
value of two it's kind of softening
things up.
| | 03:50 |
And really, with a value of 3 or 4, it's
kind of reached its point of diminishing
| | 03:54 |
return, so there's no need to take it up
past 3 or 4.
| | 03:59 |
So, those are some of the attributes that
you can play with.
| | 04:02 |
Additionally, you can smooth it, and
soften it up with a subdivision surface algorithm.
| | 04:08 |
And since, we are rendering in (UNKNOWN),
all we need to do is select that polygon
| | 04:12 |
surface, which is currently selected, and
press the 3 key on the keyboard.
| | 04:18 |
So I want to give focus to the main
window and press 3, and it's actually
| | 04:21 |
subdivided the mesh using smooth mesh
preview.
| | 04:26 |
And if I press the 1 key its not sub
divided.
| | 04:29 |
So we can see that a little more clearly
lets go to a perspective panel and just
| | 04:33 |
get in really close on that I'll go to
panels perspective perspective and get in
| | 04:38 |
really quite close so if I press the 1
key there's no smoothing.
| | 04:45 |
And if I press the 3 key, it's smoothing
the mesh.
| | 04:50 |
And to make that even more dramatic, I
can reduce this mesh smoothing iterations
| | 04:54 |
factor back down to zero.
And then over here, if I press one,
| | 04:58 |
that's no smooth mesh preview.
And three, we're getting smooth mesh preview.
| | 05:06 |
Now, if you do need to render in Maya
software, or any other renderer, then you
| | 05:10 |
can just drop a polygon mesh smooth node
on top of this polygon surface.
| | 05:15 |
But again, since we're rendering in
Mental Ray, all we need to do is press
| | 05:19 |
the 3 key to enable Smooth Mesh preview.
So I'll set my mesh smoothing iterations,
| | 05:24 |
or relax factor, to a value of three.
And then press the 3 key in the view port
| | 05:29 |
on the keyboard and then we've basically
got a nice, soft smooth mesh and I can
| | 05:33 |
kind of scrub through here and see what
that looks like.
| | 05:39 |
So that's how we can optimize polygon
output for n particle liquids.
| | 05:45 |
| | Collapse this transcript |
| Shading the mesh| 00:00 |
We converted our end particles to
polygons and adjusted the mesh output properties.
| | 00:06 |
And the last thing you want to do before
batch rendering this, is to assign a
| | 00:09 |
material and turn on motion blur to give
it a little bit more realism.
| | 00:14 |
I've already created a washer material
and it's included in this scene file.
| | 00:19 |
And I'm not going to go over how to
create that dielectric shader here.
| | 00:22 |
I've covered it elsewhere, including in
the course Creating Shader Networks in
| | 00:27 |
Maya and Mental Ray.
So, as not to be redundant, I'll go ahead
| | 00:33 |
and assign it here, I want to select the
polygon mesh output, right-click and
| | 00:38 |
choose Assign Existing Material,
water-mia material.
| | 00:43 |
That's Mental Ray material, and I'll
scrub forward in the timeline to a point
| | 00:48 |
where the water is actually fully in
motion.
| | 00:52 |
And we can go ahead and do a test render
of that with IPR.
| | 00:56 |
Click IPR, and drag a rectangle around
representative area, and see what that
| | 01:01 |
looks like.
So, you got a good water there, and
| | 01:07 |
additionally, we want to turn on Motion
Blur.
| | 01:10 |
We store that image, and close the
window, and go into Mental Ray settings.
| | 01:17 |
Go ahead and click on that, and Motion
Blur is actually already enabled on this
| | 01:21 |
polygon shape.
All I need to do is go into Mental Ray's
| | 01:26 |
quality settings, and scrolling down, I
want to turn Motion Blur to full.
| | 01:33 |
And we'll go ahead and go back to our
render window and do another IPR of that
| | 01:38 |
area there and see what it looks like.
You'll notice that its much slower to
| | 01:46 |
render with Motion Blur.
But its going to much softer and quite a
| | 01:50 |
lot more believable, we can zoom in a
little bit on that with a wheel, store
| | 01:55 |
the image and then compare to the other
version.
| | 02:00 |
So there it is with no motion blur, and
that's with motion blur on.
| | 02:05 |
Just enough to soften that up, so all we
would need to do in order to complete
| | 02:09 |
this project is to batch render it.
I'll go back to the outliner and unhide
| | 02:16 |
some of the things that I hide earlier,
the tumbler turn its visibility on and a
| | 02:21 |
gin bottle.
Go into the Gin Bottle Locator Hierarchy
| | 02:26 |
and turn the gin bottle on, not the proxy
but the gin bottle itself.
| | 02:32 |
And there it is, and so we're in a good
place now to actually batch render.
| | 02:37 |
We'll just need to go back into our
Mental Ray settings and turn the quality
| | 02:41 |
up to production quality.
So, that we'll be able to see refractive
| | 02:46 |
objects inside of other refractive
objects.
| | 02:49 |
| | Collapse this transcript |
| Creating high-quality simulations| 00:00 |
It's fairly common with Dynamic
Simulations, that you don't get the
| | 00:03 |
result that you want on the first try.
And you have to go back and retrace your
| | 00:07 |
steps and use different settings.
That's what we're going to do in this movie.
| | 00:13 |
In the previous movies in this chapter, I
intentionally used very low quality
| | 00:16 |
simulation settings.
Just to make sure that the scene would
| | 00:20 |
open and play back on everyone's
computers.
| | 00:24 |
Now we're going to go and remove that
simulation and rebuild it with
| | 00:27 |
higher-quality settings.
The first step is to remove the cash in
| | 00:32 |
the initial state that already exists on
this simulation, so I'll go into the Outliner.
| | 00:39 |
And to remove the cache, I want to select
the Water Poly Surface, or the End
| | 00:43 |
Particle Surface.
I'm going to N Dynamics, and choose N
| | 00:47 |
Cache, Delete Cache.
Now, if I rewind and play back, we still
| | 00:52 |
see an initial state.
In other words, the water is still at the
| | 00:58 |
bottom of the bottle on frame one, we
need to remove the initial state, as well.
| | 01:02 |
The trick to that, though, is we have to
select the particle node and not the
| | 01:06 |
polygon node.
Remember we converted to polygons in
| | 01:10 |
order to remove the initial state we need
to select the particle node.
| | 01:13 |
Go up to End Solver and choose Initial
State > Clear Initial State, and you see
| | 01:18 |
it just disappeared there.
And now I just wanted to select
| | 01:23 |
polysurface here again, so we can see it
when I rewind and playback, it'll be
| | 01:26 |
highlighted so we can see it more
clearly.
| | 01:30 |
So, you can see now that we're back to
the state of, it's dropping particles
| | 01:33 |
from the emitter, very good.
So, we need to set a new initial state,
| | 01:38 |
and in order to do that, we just want to
disable the animation on the bottle here.
| | 01:43 |
To do that, I'll select this locator, and
that's what driving all that animation,
| | 01:47 |
and then go over to its channel box and
mute all these channels, just temporarily
| | 01:51 |
disable them.
Go to Channels > Mute All, and now I can
| | 01:56 |
rewind to frame one and play back and let
those particles drop.
| | 02:03 |
Select that water polysurface so we can
see it, and play it through until it
| | 02:07 |
settles down and sets an initial state.
But of course, if we did that now we
| | 02:12 |
would just get the same result that we
did before.
| | 02:15 |
So, in order to get a good result here,
we'll want to change up a whole bunch a
| | 02:19 |
values, on the particle shake node, and
also the nucleus node.
| | 02:25 |
So, I'll rewind back to frame one, and go
into the Attribute Editor.
| | 02:28 |
With that polysurface selected go to the
Attribute Editor, and the first thing I
| | 02:33 |
want to do is change the nucleus
properties, go into the nucleus node.
| | 02:39 |
And previously, what I did was I set the
space scale down here, under Scale
| | 02:44 |
Attributes, to .1.
A space scale of .1 means that nucleus
| | 02:49 |
assumes that my world is built at 1 10th
scale.
| | 02:54 |
But in fact, my world is built at one to
one scale, meaning that the space scale
| | 02:59 |
value will have to be 0.01 for most
accurate simulation.
| | 03:05 |
Basically, everything else I'll leave the
same.
| | 03:08 |
The Max Collision Iterations maybe knock
it up one step to a value of five.
| | 03:12 |
But I've got a high sub steps value of
20, and I want to leave it there for
| | 03:16 |
liquid simulations.
Now we want to go in the particle shape
| | 03:21 |
node, and change its attributes, starting
from the particle size, open that up.
| | 03:27 |
Currently there is a radius of 0.5, which
means the particles are very large.
| | 03:30 |
I'm going to reduce that down to, a
radius of 0.3.
| | 03:34 |
And what that's going to do is
effectively reduce the amount of volume,
| | 03:38 |
and it's going to reduce it quite a lot.
We're only going to have like a quarter
| | 03:45 |
of the volume we had previously.
If I have that polysurface selected and
| | 03:50 |
press Play, we'll see we don't get as
much volume as we did before.
| | 03:54 |
I mean, it's barely just filling up the
very bottom of that gin bottle.
| | 03:59 |
You see that reducing the radius by a
small amount has a huge affect on the
| | 04:02 |
amount of volume we see in our liquid.
Scrolling down, we want to go into the
| | 04:07 |
Liquid Simulation properties.
And I'm going to reduce the
| | 04:11 |
incompressibility a little bit to a value
of five.
| | 04:16 |
And with a lower incompressibility,
liquid will bounce more and we'll get a
| | 04:20 |
little more volume out of it.
Next, down here, we'll see the rest
| | 04:25 |
density, I'm going to leave that at a
value of two, but I'm going to increase
| | 04:28 |
the liquid radius scale to a value of
one.
| | 04:32 |
And again, what that's going to do is
give us a little bit more volume that we had.
| | 04:38 |
The Viscosity, I'll leave at 0.01, but
I'll go down into the Surface Tension and
| | 04:42 |
increase that up all the way to a value
of one.
| | 04:46 |
And that'll just keep the liquid sticking
together a little bit better.
| | 04:50 |
I'll rewind that and play it back.
So as you see, we got a little bit more
| | 04:55 |
volume out of that, with the previous
settings we just had barely half this much.
| | 05:01 |
But because again, I've reduced the
icompressability and I've increased the
| | 05:05 |
liquid radius scale, now I'm getting more
volume.
| | 05:10 |
Now we also want to adjust the Mesh
Output.
| | 05:13 |
So, I'll go into the output mesh section
here, and I'll reduce the threshold down
| | 05:17 |
to a value of 0.1.
That's going to cause it to not break
| | 05:21 |
apart quite as much.
The mesh triangle size here I'll leave at
| | 05:25 |
0.3, but I want to increase the max
triangle resolution.
| | 05:29 |
And I do that so that Maya doesn't
automatically decimate the mesh when it
| | 05:33 |
reaches too many triangles.
In other words, there's a top limit on
| | 05:37 |
the number of triangles we're allowed to
have on this.
| | 05:41 |
And if it exceed that value, the
triangles become larger in order maintain
| | 05:45 |
the same number of triangles.
It looks really bad, in fact, so, we need
| | 05:50 |
to make sure that never happens, and
we've got a max triangle resolution
| | 05:54 |
that's high enough to prevent that
decimation from happening.
| | 05:58 |
I think we're in a good place, now, we
can rewind and play back.
| | 06:02 |
And let that settle down, and we can set
inital state.
| | 06:06 |
Just let it play through one second of
animation time.
| | 06:12 |
And let that play through for about a
second and then stop it.
| | 06:15 |
And I want to set an initial state, go
back to the End Particle Node in Solver,
| | 06:20 |
initial state, Set from Current, rewind
it.
| | 06:25 |
Select that surface, so we can see that
in fact it has been settled down on frame one.
| | 06:30 |
And then all we need to do now is just re
enable our animation and we can build our
| | 06:33 |
cache again.
I'll select that locator and then Unmute
| | 06:38 |
all of it's channels.
Now I can play this simulation, I'll
| | 06:41 |
select the water polysurface and play it
through and make sure that it's working OK.
| | 06:47 |
At this point you would want to build a
play blast.
| | 06:50 |
I'm not going to repeat that process
because you've already done it.
| | 06:53 |
But we just want to make sure it's
actually working, which it appears that
| | 06:56 |
it is.
So, I would do a full play blast on this
| | 06:59 |
and actually verify that it was doing
what I want.
| | 07:03 |
Once that's done, then I'll just rebuild
the cache.
| | 07:09 |
So, rewind, end cache, create new cache.
Very good, our cache is completed, I can
| | 07:16 |
select that water polysurface again and
rewind an play it back and, it'll still
| | 07:20 |
be a bit slow, because it's loading those
cache files off the disk.
| | 07:25 |
You see I'm getting only about four
frames per second here now, in the view port.
| | 07:29 |
But I've also done a full rendering, I
unhid the proper gin bottle an hid this proxy.
| | 07:36 |
And did a full rendering, so let's take a
look at that as well.
| | 07:41 |
Here's the result after increasing the
quality settings, and you'll see that it
| | 07:45 |
looks a bit more watery, and that's the
result we were trying to achieve.
| | 07:51 |
We could increase the quality settings
even further and get an even more
| | 07:54 |
realistic result, but just be aware that
your calculation times are going to be
| | 07:57 |
very long in that case.
And if you wanted to, for example, have a
| | 08:02 |
large volume of liquid that filled up the
entire bottle.
| | 08:06 |
Then you would need to have massive
numbers of particles, in the range of
| | 08:10 |
hundreds of thousands or even millions of
particles.
| | 08:14 |
And that would take a very, very long
time to simulate.
| | 08:17 |
And that concludes our chapter on pouring
liquid with end particles.
| | 08:22 |
| | Collapse this transcript |
|
|
3. Volumetric Liquid in a 3D FluidCreating a 3D fluid container| 00:00 |
In our final chapter in Liquid Simulation
in Maya, we're going to use a 3D fluid
| | 00:04 |
container to simulate liquid.
And this is just an alternate method for
| | 00:09 |
achieving that liquid simulation.
The method we saw in the previous chapter
| | 00:14 |
was using N particles.
There are pros and cons to each approach.
| | 00:19 |
The N particle approach works best when
you've got.
| | 00:22 |
A large area that the liquid needs to
spread out in.
| | 00:26 |
The fluid container approach, however, is
a little bit lower maintenance.
| | 00:31 |
In other words, you won't have to adjust
as many attributes and you won't have to
| | 00:34 |
work so hard to get a good result.
But the fluid container approach is
| | 00:39 |
limited in as much as you can't really
get a very large spread to the fluid
| | 00:44 |
because it has to be contained within a
3D fluid container box.
| | 00:50 |
And as the fluid spreads out, that box
will need to be larger and larger, and
| | 00:53 |
that will negatively impact the
performance.
| | 00:56 |
So, let's do the 3D fluid container
method in this exericse.
| | 01:02 |
We'll go to the Dynamics menu set and
choose Fluid Effects > Create 3D Container.
| | 01:09 |
Now, I've set up this scene specifically
so that the container, built at the
| | 01:13 |
origin, will already be roughly where it
needs to be to fill this bucket.
| | 01:18 |
I'll go ahead and move that fluid up so
we can see it little bit better.
| | 01:22 |
The first thing I want to do to it is to
set it to the liquid preset.
| | 01:28 |
We'll need to go to the Attribute Editor,
Ctrl+A.
| | 01:31 |
With that fluid shape node visible in the
Attribute Editor, Click and Hold the
| | 01:35 |
Presets button, and choose Basic Liquid
Replace.
| | 01:39 |
And that's changed a whole lot of the
attributes here in the Fluid Shape mode.
| | 01:43 |
You press Play in your timeline now,
you'll see kind of a strange result where
| | 01:47 |
it sort of vibrates and oscillates.
That's because it's defaulted to an
| | 01:52 |
option called Auto Re-size.
However, there's no density inside the
| | 01:56 |
container, so Auto Re-size is not really
going to work.
| | 02:01 |
We'll have to add density, and basically
set an initial state and then later we
| | 02:05 |
can turn Auto Re-size back on again.
For now, we'll need to turn it off.
| | 02:10 |
We're going to scroll down until I find
the Auto Re-size section here and just
| | 02:14 |
disable it.
Now we can control the size and the base
| | 02:19 |
resolution of that container back up at
the top here.
| | 02:24 |
The size needs to be larger than the
object that we want to fill.
| | 02:29 |
I'm going to set the size to 30
centimeters in x, y, and z.
| | 02:32 |
Then also, the base resolution will need
to be increased.
| | 02:37 |
A base resolution of 5 is a very, very
poor quality simulationn I'm going to set
| | 02:41 |
it to a value of 30.
And you can see here now we've got more
| | 02:45 |
vexels or more volume elements present in
that container.
| | 02:49 |
And that'll be sufficient for our
demonstration.
| | 02:52 |
If you want a really high quality fluid,
you'll need to increase that base
| | 02:56 |
resolution up even higher, maybe as high
as 100 or 200 or even more.
| | 03:01 |
But again, for the purposes of this
exercise a value of 30 will be optimal.
| | 03:06 |
Finally, I just want to move that
container down so that it completely
| | 03:10 |
encloses the bucket.
We've set up our fluid container, and
| | 03:14 |
next we will add some desity to it.
| | 03:17 |
| | Collapse this transcript |
| Emitting density from a volume emitter| 00:00 |
We've set up the basic properties of the
3D fluid container, and now we need to
| | 00:04 |
add some contents to it.
Specifically, we need to add density,
| | 00:09 |
which will be the actual renderable
fluid.
| | 00:12 |
But select that container, go back up
into the Fluid Effects menu, and choose
| | 00:18 |
Add Edit Contents Emitter.
And now, if I tumble around in the scene
| | 00:23 |
you will see that we've got a small
emitter icon there.
| | 00:28 |
Well, this is not really going to create
any density right now.
| | 00:30 |
We're going to need to make it a volume
emitter.
| | 00:33 |
I'll go back to the attribute editor,
Ctrl+A.
| | 00:35 |
And with that fluid emitter node
selected, we'll open up the basic emitter
| | 00:40 |
attributes and set the emitter type to
volume.
| | 00:45 |
And the default type is a cube.
Let's make it a cylinder and scale it up
| | 00:49 |
so it's a little bit smaller than the
bucket.
| | 00:52 |
Scroll down to the volume emiter
attributes and open that up.
| | 00:56 |
We want the volume shape to be a
cylinder, in this case.
| | 01:00 |
And then use the Scale tool to enlarge
that emitter so that it's a little bit
| | 01:03 |
smaller than the bucket.
Let's check that in our orthographic view.
| | 01:09 |
I'll tap the spacebar and go out to the
front view here and just make sure that
| | 01:14 |
it's not touching the sides of the
bucket.
| | 01:18 |
It can't actually be colliding with the
bucket on the first frame of the simulation.
| | 01:24 |
Maybe move it down a little bit with the
Move tool.
| | 01:28 |
So it's basically sized up now.
I can go back to my perspective camera here.
| | 01:33 |
An let's see what happens if we press
play.
| | 01:36 |
We get a little bit of emission here.
You can see, there's our fluid that's
| | 01:40 |
kind of, poking out a little bit there.
We want to increase the amount of emission.
| | 01:46 |
You want to select that emitter.
Make sure that it's the emitter selected
| | 01:50 |
and go into the attribute editor and
scroll back up near the top.
| | 01:55 |
We want to increase the density here.
Density per voxel per second and I'll set
| | 02:00 |
that to a value of, lets say five.
Rewind and play that back and now we're
| | 02:05 |
getting more density emitted into the
fluid container.
| | 02:10 |
Next we will amplify that by speeding up
the fluid simulation.
| | 02:15 |
| | Collapse this transcript |
| Adjusting Simulation Rate Scale| 00:00 |
Here's what we've got so far.
We've emitted density into that fluid container.
| | 00:06 |
But as you can see it's moving pretty
slowly.
| | 00:07 |
I've got 1.5 seconds in the timeline
here, and in 1.5 seconds it's not even
| | 00:11 |
generating enough density to fill that
container.
| | 00:15 |
And additionally as you can see it's
moving very, very slowly.
| | 00:20 |
All we have to do is increase the rate of
the simulation.
| | 00:22 |
And that will make it move faster and it
will also fill up the density of the
| | 00:26 |
container faster.
I'll select the fluid container node, go
| | 00:31 |
into the Attributes, once again CTRL + A,
and scroll down into the Dynamic
| | 00:35 |
Simulation section and open that up.
And we want to increase the simulation
| | 00:42 |
rate scale.
Turn that up to ten times.
| | 00:47 |
Rewind and play back again.
And now you'll see, as it's filling up a
| | 00:51 |
lot faster, and it's actually moving a
lot faster as well.
| | 00:55 |
Currently, now, what's happening is it's
bounded by the box.
| | 01:00 |
But it's doing basically what we want it
to now.
| | 01:04 |
It's not yet set to collide with
anything, so it's just going to fill that
| | 01:07 |
box up.
So, we've increased the simulation rate
| | 01:11 |
scale which once again has sped up the
animation and it has also amplified the
| | 01:16 |
amount of density being added per frame.
| | 01:20 |
| | Collapse this transcript |
| Colliding fluids with geometry| 00:00 |
We've added density to the fluid
container, but it's not currently
| | 00:03 |
colliding with anything.
So if we play it, it'll fill that 3D box
| | 00:07 |
up, up to the top.
What we want to do is to make it collide
| | 00:11 |
with the bucket, and also with the room
that the bucket is in.
| | 00:16 |
You'll notice that I've got two versions
of the bucket here.
| | 00:18 |
I've got this proxy version, and that's
been set up with drawing overrides in its
| | 00:23 |
shape node so it will always just display
as wire frame.
| | 00:28 |
Let's take a look at that really quickly
here.
| | 00:30 |
Control A.
In that proxy shape object, under object
| | 00:33 |
display, drawing overrides.
I've just set the shading flag off so
| | 00:38 |
that it will not be shaded in the
viewport no matter what.
| | 00:42 |
And then additionally in the render stats
I've turned off primary visibility so it
| | 00:46 |
won't render.
The whole reason it exists is to have
| | 00:49 |
something for the fluid to collide with.
I've done this for two reasons.
| | 00:54 |
One because if it's a lower level of
detail the simulation will calculate more quickly.
| | 01:02 |
So I've got a lightweight version of the
buck that acts as a collision object.
| | 01:07 |
And I've got a slightly heavier version
that actually renders.
| | 01:10 |
And the other reason why I would want to
create this proxy object is because the
| | 01:14 |
fluid might have a tendency to sort of
poke through the surface and what I've
| | 01:18 |
done here is I've made that proxy object
slightly smaller so that won't happen.
| | 01:25 |
And you'll notice also I've got two
different layers here, just two
| | 01:28 |
visibility layers.
We can show or hide each one of those
| | 01:32 |
buckets as needed.
So we're going to make the fluid
| | 01:35 |
container collide with the bucket and
also with the room that it's in.
| | 01:40 |
And we want to select all three of those,
in fact we can select the bucket, the
| | 01:44 |
room, and the fluid container all at once
and create those collisions.
| | 01:50 |
I'll select the room.
And then shift select the bucket proxy
| | 01:54 |
object and shift select the 3D fluid
container and go back into the fluid
| | 01:58 |
effects menu and simply choose make
collide.
| | 02:02 |
Rewind and play my simulation and you'll
see that it fills up the bucket and then
| | 02:07 |
it spills out over the edges.
Now just a couple of other miscellaneous
| | 02:13 |
things, I'll play it through for a second
and then pause it.
| | 02:17 |
If we try to render this now, it actually
won't render, and what we see here
| | 02:20 |
actually is a little bit of a shadow and
what we want to do actually, is to go
| | 02:24 |
into the attributes for that fluid shape
node, control A.
| | 02:30 |
And we want to find in the shape note
attributes, the render stats, and open
| | 02:34 |
that up, because for some reason when we
chose the liquid preset, the primary
| | 02:39 |
visibility of the liquid was turned off,
that was just an attribute in that preset.
| | 02:46 |
And now with primary visibility
reenabled, now it will actually render.
| | 02:52 |
And additionally just to make it a little
bit easier for us to see and
| | 02:55 |
differentiate it from the other objects
in the scene, I'm just going to change
| | 02:58 |
the color of the fluid.
And that's found in the shading section.
| | 03:02 |
Open that up and you see we've got color
here.
| | 03:06 |
Just click on that color swatch, and I'll
give it a bit of a light green color here.
| | 03:11 |
So now we've got collisions happening,
and we've made it so that that fluid will
| | 03:14 |
actually render.
| | 03:16 |
| | Collapse this transcript |
| Keyframing density emission| 00:00 |
Currently, let's see what happens if we
press Play.
| | 00:03 |
We see that, the bucket fills up with
fluid, an then spills out over the sides.
| | 00:08 |
We're getting too much density.
What we want to do here is just, key
| | 00:11 |
frame the overall emission rate for just
two frames.
| | 00:15 |
So it'll kind of, spit out a burst of
density and then stop.
| | 00:20 |
To do that, we'll select the Emitter and
go into its Attributes, Control + A.
| | 00:25 |
And you'll see in the basic Emitter
Attributes Section, you've got a rate percent.
| | 00:30 |
And that's the overall rate of emission
that's sort of a multiplier for all of
| | 00:34 |
these other emission properties.
The rate should be at a value of 100% on
| | 00:40 |
frame one and then we'll have it just cut
off two frames later.
| | 00:45 |
Ideally I'd like it to only emit for one
frame, but that doesn't work in Maya.
| | 00:50 |
We need to have two frames of admission.
So on frame one of the timeline, I'll key
| | 00:56 |
frame this rate at 100%, so right click
and set key and I'll go forward two
| | 01:00 |
frames to frame three and then set the
rate down to zero and right click and set
| | 01:05 |
key once again.
Now, if I Rewind and press Play, it just
| | 01:11 |
sends out a little bit of density over
those two frames and then sort of settles down.
| | 01:18 |
We can also increase the overall amount
of density here, and let's set that to a
| | 01:23 |
value of 50.
And Rewind and press Play.
| | 01:27 |
Now we're getting more density.
To really finalize this, what I want is I
| | 01:32 |
want that rate to emit a constant value
over those two frames.
| | 01:38 |
And to do that, I want to to go into the
Graph Editor.
| | 01:42 |
So with that, Emitter Node selected, go
into Window > Animation Editors > Graph
| | 01:46 |
Editor, and here's the curve.
I can press the F key on the keyboard, so
| | 01:50 |
we can see that curve.
This is the overall emission rate.
| | 01:54 |
We wanted to emit a constant amount over
those two frames, we'll simply simply
| | 01:58 |
select this first keyframe and set it to
step tangents.
| | 02:02 |
And now it's emitting the full density
over those two frames.
| | 02:05 |
Go ahead and close these windows, Rewind,
press Play, and now we're getting a full
| | 02:10 |
bucket full of density.
And that's a very handy technique that
| | 02:15 |
you can use throughout Maya when working
with dynamics.
| | 02:19 |
Just keyframe and emission rate.
And get the amount of density or
| | 02:23 |
particles or whatever you need, and then
key that emission rate off once again.
| | 02:27 |
| | Collapse this transcript |
| Setting the initial state| 00:00 |
Currently, we've got a pretty good
simulation.
| | 00:03 |
It's filling up with fluid and it's
colliding properly.
| | 00:06 |
What we want to do here, is just let that
simulation settle down, and then set an
| | 00:10 |
initial state.
So that on frame one, you'll already have
| | 00:14 |
filled the bucket and have settled down
and reached the sort of state of equilibrium.
| | 00:20 |
But before we do that, we need to look
into the overall base resolution of the
| | 00:24 |
fluid container.
Let me select that container and go to
| | 00:29 |
its attributes Ctrl+A.
Previously, we set the base resolution to 30.
| | 00:34 |
What we're getting here is a kind of
gloppy result, it doesn't have a lot of
| | 00:38 |
detail to it.
But be aware that if we increase the base
| | 00:42 |
resolution, then it's going to run very,
very slowly.
| | 00:46 |
If you want to have a high quality
stimulation, if you want to have like a
| | 00:49 |
thin layer of water that's covering the
surface of the ground here, you will need
| | 00:53 |
to have a high base resolution.
But if you do that, just be aware that
| | 00:59 |
it's going to be very slow to calculate.
I'll rewind and change my base resolution
| | 01:04 |
up to let's say, a value of 60.
And you can see here now I'm getting
| | 01:08 |
smaller volume elements, which means that
we're able to have a thinner layer of
| | 01:13 |
fluid, and also the detail of that fluid
will be superior.
| | 01:18 |
However, if I press play, you'll notice
that my playback rate is much, much slower.
| | 01:24 |
I was getting a few frames per second
previously, and now I'm getting less then
| | 01:28 |
one frame per second.
Additionally, if you look closely, you
| | 01:32 |
may notice that the behavior of the fluid
is different once I have changed the base resolution.
| | 01:38 |
I'll press the 5 key, so we can see
shading here.
| | 01:41 |
So, you got better detail here, but
you'll notice that it's actually not
| | 01:44 |
filling the container up as much.
That's a little bit of an unexpected
| | 01:49 |
result, but just be aware if you change
base properties like the resolution, then
| | 01:52 |
basically it's going to change your
entire simulation.
| | 01:57 |
Well we need to make a decision on what
our overall base resolution is going to
| | 02:01 |
be at this point.
Because of the work flow that we're
| | 02:05 |
following here in Maya, it's a
semi-destructive workflow.
| | 02:09 |
We have to do it in a particular order
for it to work.
| | 02:12 |
We have to set the initial state, and
then if we want the water to pour out of
| | 02:16 |
the bucket, then we'll have to turn on
Auto Re-size, which will cause the fluid
| | 02:20 |
container to automatically change size to
contain the fluid.
| | 02:26 |
But we have to do it in that order.
We have to set the initial state and then
| | 02:30 |
enable auto resize.
And because of the quirks of Maya, we
| | 02:33 |
won't be able to go back and change the
base resolution after we've set the
| | 02:37 |
initial state.
What that means basically, is we have to
| | 02:42 |
make a decision now on what our end based
resolution is going to be, because if we
| | 02:45 |
try to go back and change it later, we'll
basically have to redo a bunch of work.
| | 02:50 |
In this case, I'm going to leave it at a
value of 30, because that played back
| | 02:54 |
pretty well in the view port here.
For your own scenes, you'll need to
| | 03:00 |
figure out what looks good and you know,
what you're willing to wait for in terms
| | 03:03 |
of simulation time, and then set your
base resolution and then lead it and
| | 03:07 |
don't change it after the fact.
Here's another thing you can do
| | 03:13 |
optionally, by the way.
If we scroll down, and in the dynamic
| | 03:16 |
simulation section, we can play around
with the solver quality and the substeps.
| | 03:22 |
Solver quality is just what it sounds
like.
| | 03:25 |
If you increase that, it's actually going
to work harder to find the solution to
| | 03:29 |
the fluid.
The value of 50 here is probably okay and
| | 03:33 |
I'm going to leave it at that.
The substeps is how many subframes within
| | 03:38 |
a frame Maya calculates the fluid
solution.
| | 03:42 |
And if we increase this up to a value of
let's say 15, what we'll get is a better
| | 03:47 |
result with a fast moving fluid.
And you'll also notice that ironically,
| | 03:54 |
it has increased the amount of overall
density so much that the fluid is going
| | 03:57 |
out of the bucket.
And that's a bit of a non-intuitive
| | 04:02 |
result until you realize that the number
of substeps here also influences the emission.
| | 04:08 |
Basically, what this is doing is, with
our higher substeps, it's emitting more
| | 04:12 |
density because it's emitting during the
space between frames.
| | 04:18 |
That means that if you increase the
substeps, you'll probably need to reduce
| | 04:21 |
the overall amount of density being
emitted.
| | 04:26 |
But once again, I'm going to set that
back down to a value of five because
| | 04:29 |
that's playing back in near real time
here in my view port, I'm getting five
| | 04:33 |
frames a second instead of 0.5 frames per
second.
| | 04:38 |
So now we're ready to set our initial
state.
| | 04:40 |
I'm going to need more frames in the
timeline, so that the simulation will
| | 04:44 |
have more time to settle down and reach
equilibrium.
| | 04:48 |
I'll set the end of my current time range
to let's say, 100 frames, that should be enough.
| | 04:55 |
Rewind, press play, and just let that
sort of settle down.
| | 05:01 |
Once it's sort of settled down and
flattened out, then I can stop the
| | 05:04 |
playback, and with that fluid container
selected, go back up into the Fluid
| | 05:08 |
Effects menu, and set the initial state.
And now, if I rewind back to frame one,
| | 05:15 |
we see no change here, so that is it's
state on frame one.
| | 05:21 |
However if I press play now, what you'll
see is it actually overflows the bucket.
| | 05:26 |
And the reason that's happening is
because my emitter is still active.
| | 05:30 |
After setting the initial state, I'll
want to go back to that fluid emitter
| | 05:33 |
node and just set the density per voxel
per second to 0, because we've go the
| | 05:37 |
density that we need.
We can rewind and play it back and you
| | 05:42 |
see here, now it's settled down.
You could optionally delete the emitter
| | 05:46 |
and that would achieve the same result.
However, I like to leave these nodes
| | 05:51 |
around because if I need to make changes
later, I can just go back in and increase
| | 05:55 |
that density amount again and set my
initial state once again.
| | 06:00 |
If I delete my emitter, then I have to
retrace more of my steps.
| | 06:05 |
We've set our initial state, which means
we now have a good start condition for
| | 06:09 |
the beginning of our simulation.
| | 06:12 |
| | Collapse this transcript |
| Working with Auto Resize| 00:00 |
We set the initial state for our fluid,
and we're actually ready to go ahead and
| | 00:04 |
animate the bucket tipping over.
But in order for that to work, we'll
| | 00:09 |
need to enable Auto Resize.
If Auto Resize is off, the fluid density
| | 00:14 |
cannot exist outside of this pre-existing
box.
| | 00:19 |
But if we turn on Auto Resize, the 3D
container box will resize automatically
| | 00:23 |
to optimally contain the fluid density.
So to make that happen, we'll select that
| | 00:30 |
fluid container and go back to its
attributes, Ctrl+A.
| | 00:34 |
And in the Auto Resize section, we can
flip that switch back on.
| | 00:39 |
I want to mention here at this point that
this is, unexpectedly, a destructive act.
| | 00:45 |
If you turn Auto Resize on, then you
cannot go back and set a new initial
| | 00:50 |
state on your fluid container.
What that means is that before you flip
| | 00:56 |
this switch on, you need to make sure
that your fluid is in the correct state.
| | 01:01 |
Because if you turn this on, and then you
try to set a new initial state, then your
| | 01:05 |
container will go back to its original
position, and basically you'll lose your work.
| | 01:12 |
So, I turn it on.
And if I press Play, you'll notice that
| | 01:15 |
the box became a little bit smaller.
And it's now optimally sized to include
| | 01:20 |
that density.
There are a few parameters here you can
| | 01:25 |
play around with.
For example, the max resolution is the
| | 01:29 |
maximum number of voxels on a side of the
box, and its set to a value of 200 now,
| | 01:33 |
which is a pretty high value.
We probably won't reach 200, but I'll
| | 01:39 |
leave it at that high value of 200.
And that should be fine for our
| | 01:42 |
simulation here.
Additionally, you've got the auto resize threshold.
| | 01:48 |
That's a threshold that determines
whether or not the box will automatically
| | 01:53 |
resize with a given density.
Effectively what that means is, if you
| | 01:58 |
have a low threshold, then the box will
not tend to resize very much.
| | 02:03 |
It'll tend to get larger, but not get
smaller.
| | 02:05 |
And if you have a high threshold, you'll
have to have a greater density in order
| | 02:09 |
for the box to become larger.
The default value of 0.2 is pretty good,
| | 02:13 |
so I'm going to leave it at that.
Finally, there's the auto resize margin,
| | 02:19 |
and that's just an extra buffer of a set
number of voxels around the density.
| | 02:26 |
And so right now, we've got an auto
resize margin of two, so we get two extra
| | 02:30 |
voxels around the existing density here.
So I'm going to leave it at that.
| | 02:36 |
So we're ready to actually animate the
bucket, I want to rewind back to frame one.
| | 02:41 |
And before I do any keyframing, I am
going to want to disable evaluation on
| | 02:45 |
the fluid shape node.
We'll go into the Modify menu, go to
| | 02:50 |
Evaluate Nodes, and Disable Evaluation on
the Fluids.
| | 02:56 |
So I want to go a few frames forward,
let's say frame five, and set a rotation
| | 03:00 |
key on this locator here.
I make sure that only that locator is
| | 03:05 |
selected, and if you're not sure what's
selected, maybe go into the Outliner,
| | 03:09 |
Window > Outliner.
Select that bucket locator, and I'm just
| | 03:14 |
going to keyframe it in the z-axis only.
So I'll select Rotate Z, and then
| | 03:20 |
right-click and Key Selected.
I'll turn on Auto Key, just to save a
| | 03:24 |
little bit of time.
Here's Auto Key down here.
| | 03:27 |
Turn the little skeleton key icon on.
And I'll go down, let's say, seven frames
| | 03:32 |
later, to frame thirteen.
And then I'll rotate.
| | 03:38 |
And you can see, when I release the
mouse, I've got a new keyframe there.
| | 03:42 |
Let's check this in orthographic view.
I'll tap the spacebar and go to the
| | 03:45 |
front view.
Make sure I've rotated that so it's not
| | 03:47 |
going through the floor.
Okay, and then go a couple frames later,
| | 03:52 |
because I want to little bit of rebound
there.
| | 03:55 |
Let's say, frame 15, rotate it back up a
few degrees, and then a couple frames
| | 03:59 |
later, rotate it back down.
And rewind to play that back.
| | 04:05 |
Looks okay.
I'll turn Auto Key off, and if I want to
| | 04:09 |
go into the finer points of this, of
course, I can go into the Graph Editor.
| | 04:15 |
Window > Animation Editors > Graph
Editor.
| | 04:17 |
Select that Rotate Z channel, and press
the F key.
| | 04:20 |
And I just want to sort of fine tune that
animation a little bit.
| | 04:24 |
I'll select this first keyframe and then,
with the Move tool selected, I'll just
| | 04:27 |
adjust that tangent a little bit.
Select the tangent and then move it.
| | 04:32 |
And so that this looks a little bit
better here, I want to select this
| | 04:35 |
keyframe, and break it's tangents.
And then select each one of these
| | 04:40 |
tangents and move them.
That'll just give us a little bit better
| | 04:44 |
feel to that animation.
Rewind and play that back.
| | 04:50 |
So, we got our bucket tipping over.
Very good.
| | 04:53 |
Tap the spacebar.
Go back out to my perspective view here.
| | 04:55 |
And then re-enable the fluid.
So, go back up to Modify > Evaluate Nodes
| | 04:58 |
> Evaluate All, turn that back on.
Back out a little bit, and with Auto
| | 05:08 |
Resize on, what we should see is that the
fluid box changes size automatically.
| | 05:16 |
We've got a pretty good looking fluid
here now.
| | 05:18 |
And not that many steps to it.
Next we will go back into our fluid
| | 05:22 |
simulation properties and maybe fine tune
them a little bit.
| | 05:25 |
| | Collapse this transcript |
| Adjusting density tension and force| 00:00 |
Our simulation is basically working,
however, if we look at this with a
| | 00:04 |
critical eye, we'll notice that the fluid
is kind of breaking apart.
| | 00:10 |
And that's not really terribly realistic.
You can see on subsequent frames that
| | 00:14 |
we're getting a lot of change in the
density in different areas.
| | 00:19 |
If we were to playblast or render this,
it wouldn't be that convincing because
| | 00:23 |
the fluid is basically breaking up too
much.
| | 00:27 |
There are a couple of attributes that we
can play with in the fluid shape node to
| | 00:31 |
try to keep that fluid stuck to itself.
And in fluid dynamics that's known as
| | 00:36 |
surface tension.
To get the effect of surface tension, we
| | 00:40 |
can play around with a couple of these
attributes.
| | 00:43 |
So I'll select that fluid container and
go to its attributes, Ctrl+A.
| | 00:47 |
And in the Liquids section, you'll see
Density Tension and Tension Force.
| | 00:54 |
And these are two different methods of
trying to keep the fluid stuck to itself.
| | 00:59 |
Density tension adjusts the amount of
density in a voxel to try to keep the
| | 01:04 |
fluid together and tension force adjusts
the velocity of the density, again to try
| | 01:10 |
to keep the fluid together.
Let's try one of these at a time, I'll
| | 01:17 |
set the density tension into a value of
one, and then rewind and play that back.
| | 01:24 |
It does stick together better.
We did get a little bit of an extra
| | 01:28 |
spillage out of the top at the first
frame but basically it's keeping together
| | 01:31 |
a little bit better than it was.
And then we've also got the tension force.
| | 01:37 |
So I'll set the density tension back down
to zero and set the tension force to one.
| | 01:44 |
And again rewind and playback.
With the tension force of one, we're not
| | 01:48 |
getting the fluid spilling out on frame
one, and it's also holding together a
| | 01:53 |
little bit better.
What we would need to do in this scene is
| | 01:58 |
to adjust these values, iteratively, in
other words change the value, and then
| | 02:02 |
play back the simulation to see what we
get, and then go back and change the
| | 02:06 |
value again.
Back and forth, between playback and
| | 02:11 |
adjustment until we reach the state that
we want it to be in.
| | 02:16 |
I'll just take a stab at setting the
density tension up a little bit to, let's
| | 02:20 |
say, 0.2, and the tension force, to let's
say 0.5.
| | 02:25 |
And then play back the simulation.
And I think that looks pretty good.
| | 02:30 |
It's certainly better than what we had.
Given more time, I would make further
| | 02:34 |
adjustments until it looked exactly the
way I want it to.
| | 02:37 |
| | Collapse this transcript |
| Keyframing fluid attributes| 00:00 |
A common misconception concerning
dynamics is that it's a sort of set it
| | 00:04 |
and forget it workflow or you're going to
create a physically accurate simulation
| | 00:09 |
that's just going to run with no kind of
intervention.
| | 00:14 |
That usually doesn't work.
You usually do have to tweak it and cheat
| | 00:18 |
a little bit in order to get the result
that you want.
| | 00:22 |
In this example here, I'm not really
getting exactly the result that I want,
| | 00:26 |
because my fluid is spilling out, but
then it's starting to break up.
| | 00:31 |
And it's spreading around too much.
Now, what I can do to help this is to
| | 00:35 |
keyframe some of the most important fluid
attributes.
| | 00:40 |
So, I'll go ahead and rewind and go into
the shape node attributes Ctrl+A.
| | 00:44 |
And previously we played around with
density tension and tension force and I
| | 00:49 |
set those to values that will be constant
through out the animation but it turns
| | 00:53 |
out that I'll actually get better results
if I selectively keyframe these values.
| | 01:00 |
In order to turn those amounts up or down
at certain times during the simulation.
| | 01:07 |
Additionally, if I want my simulation to
settle down and stop, then I can also key
| | 01:11 |
frame the damp attribute here in the
dynamic simulation section.
| | 01:17 |
Play that back until it gets about one
second in, and then I'll pause my
| | 01:23 |
timeline at frame 24, press stop.
And at frame 24 I want to set keyframes
| | 01:31 |
for density tension, force, and also for
damping.
| | 01:37 |
In this case I'll set density tension and
force to a value of 0.5 and right click
| | 01:44 |
and set key 0.5 once again and set key.
And also in frame 24, I'll set the
| | 01:51 |
damping factor which is currently at a
value of zero and I'll key it at a value
| | 01:56 |
of zero.
And then I'll go a few frames forward,
| | 02:01 |
let's go up to frame 28.
I'm just going forward one frame at a
| | 02:05 |
time here in my timeline.
And at frame 28, I'll set the damp factor
| | 02:10 |
to a value of one, and then key it.
And what that'll do is it will cause the
| | 02:15 |
fluid to actually slow down and stop.
At the same time, I also want to key
| | 02:20 |
frame these density, tension, and force
back down to zero because if those were
| | 02:24 |
at a value of 0.5 near the end of the
simulation what would happen is the fluid
| | 02:29 |
would kind of bunch up a bit too much and
turn into like a pudding.
| | 02:36 |
I want to actually set these back down to
zero and key them once again.
| | 02:42 |
In summary, what I've done is I've key
framed the density tension so that it is
| | 02:47 |
a high value of 0.5 through the first
part of the simulation.
| | 02:53 |
And then it suddenly drops off to zero
over the course of four frames.
| | 02:58 |
And then reciprocally over that same four
frame period, the damping factor is going
| | 03:03 |
to rise from a value of zero to a value
of one, and we could look at that in the
| | 03:07 |
graph editor just to see what that looks
like.
| | 03:13 |
Window Animation Editors > Graph Editor.
And you can see here I've got this sort
| | 03:16 |
of reciprocal action between those
density tension and force, and the damp.
| | 03:24 |
So I'll rewind and play back and see what
we get from that.
| | 03:28 |
You'll see that the fluid is sticking
together a bit better.
| | 03:31 |
And then as it comes near the end of that
simulation it sort of slows down and
| | 03:35 |
stops because of the damping.
And then by the time we reach frame 28,
| | 03:40 |
it has actually completely come to a
rest.
| | 03:44 |
Excellent.
So that's the state of our simulation at
| | 03:46 |
the end and it looks like we splattered
paint all over the floor here.
| | 03:51 |
| | Collapse this transcript |
| Texturing a 3D fluid| 00:00 |
One of the coolest things we can do with
a 3-D fluid is to actually texture it, so
| | 00:04 |
it will have a variation in color, or
opacity, or incandescence.
| | 00:10 |
Currently, there is no texture on here.
I'll just select the 3-D fluid container
| | 00:14 |
and go to its attributes, Ctrl+A, and
open up the Textures section here.
| | 00:19 |
And let's just texture the color in this
case.
| | 00:22 |
And now, we won't see any change here
unless we go back up into the Color
| | 00:26 |
section here and add another color to
this ramp.
| | 00:32 |
We'll just make that a red color so we
can really see the contrast here.
| | 00:36 |
Now I've got a bit of a texture on there.
We can also amplify that, by increasing
| | 00:40 |
the Color Texture Gain here to a value of
one.
| | 00:44 |
We can start playing around with the
properties, such as the Amplitude, or the
| | 00:49 |
Frequency, which is the scale of the
noise.
| | 00:53 |
So you see if I reduce that Freequency
down we'll get a smaller texture on there.
| | 00:58 |
And if we do a render, you can actually
see the texture on the fluid.
| | 01:03 |
Now, if I play the simulation now, it's
not really going to be that convincing,
| | 01:08 |
because the texture is currently not
moving with the fluid.
| | 01:14 |
The texture is staying put and the fluid
is actually moving through the texture.
| | 01:19 |
But we can cause that texture to stick to
the fluid, and all we have to do is
| | 01:23 |
choose the Coordinate Method here.
There is a little bit of an issue with
| | 01:29 |
this, which is you need to rewind back to
frame 1 and then change the Coordinate Method.
| | 01:35 |
You want to set it to grid.
And now, if you press Play, what you will
| | 01:39 |
see is the texture is actually stuck
directly to the fluid.
| | 01:44 |
And it's as if we've got two different
colors of paint mixing here.
| | 01:50 |
And of course if we render that, we will
see that the texture is actually
| | 01:53 |
conforming to the movement of the fluid.
| | 01:57 |
| | Collapse this transcript |
| Creating a fluid nCache| 00:00 |
Our fluid simulation is completed, but
before we can render it, we will have to
| | 00:04 |
create a cache.
And that of course will store all the
| | 00:08 |
simulation data on disk, so that the
render will be consistent.
| | 00:12 |
And what we see in the view port is what
we get when we render.
| | 00:15 |
I'll set my timeline range down to just
36 frames, and then select the fluid
| | 00:20 |
container, go into the Dynamics menu set
to the fluid N cache menu and choose
| | 00:26 |
Create New Cache options.
Just want to check to make sure that
| | 00:32 |
these are correct.
It's going to save the cache into my
| | 00:36 |
current project data folder, and it will
create a sub folder that's named the same
| | 00:40 |
as my current scene file.
Then the cache files, themselves, will be
| | 00:46 |
named the same as my fluid shape.
I'm going to cache the time slider range,
| | 00:52 |
and go ahead and click Create.
And we'll just have to sit back and wait
| | 00:56 |
for that to finish calculating.
Our cache is finished, and now we can
| | 01:01 |
actually scrub through the time line.
We can skip through to any representative
| | 01:05 |
frame, which is something that we
couldn't do before.
| | 01:08 |
You'll notice that we've got a little bit
of an issue here at the beginning.
| | 01:12 |
Remember that I said earlier that we
cannot set the initial state, once we've
| | 01:15 |
turned on order re size.
So, we do have a little bit an issue with
| | 01:19 |
this but we could solve that by simply
starting our rendering on frame five and
| | 01:23 |
then it would be fine.
Likewise at the end here we've got a
| | 01:27 |
little bit of strange behavior with our
fluid.
| | 01:32 |
We could just render up to frame 28 and
that would be one solution to this.
| | 01:37 |
I wouldn't want to have to go back and
redo all those steps, but sometimes in
| | 01:40 |
production you will need to do that, you
might set up initial conditions for the
| | 01:44 |
simulation and then run it.
And then not find out any of your issues
| | 01:49 |
until the very end and you'd have to go
back and basically start over again.
| | 01:53 |
In this case, my issues are coming from
the density tension and tension force attributes.
| | 02:01 |
But we've got a pretty good simulation
here, and it's certainly sufficient for
| | 02:05 |
illustrating Maya's liquid simulation
with fluids.
| | 02:08 |
| | Collapse this transcript |
| Converting a 3D fluid to polygons| 00:00 |
An optional step that we can take with
our simulation is to convert it to polygons.
| | 00:06 |
Very similar to what we did with the end
particle liquid simulation.
| | 00:09 |
If we convert to polygons, we'll have
more control over the tesselation.
| | 00:14 |
The downside of that is, if we convert to
polygons we will lose whatever texturing
| | 00:17 |
work we've done.
And there won't be any way for us to
| | 00:21 |
texture a polygon fluid, because it
doesn't have any UVs, and there's no way
| | 00:26 |
for us to just slap a material on it that
has a texture.
| | 00:32 |
So that will really work if you've got a
fluid that has a uniform appearance, like
| | 00:35 |
if it's water or milk or something like
that.
| | 00:39 |
Then it won't need a texture.
But for fluids that need a texture then,
| | 00:43 |
you can't convert to polygons, because
you won't have the ability to texture
| | 00:46 |
them after conversion.
Let's see what it looks like if we do
| | 00:50 |
convert to polygons.
I'll just park on a representative frame,
| | 00:54 |
and then select my fluid container, and
go into the Modify menu, and choose
| | 00:59 |
Convert Fluid to Polygons.
And you see as soon as I did that I did
| | 01:05 |
lose my texturing.
I could assign any shader I want now, so
| | 01:09 |
if I wanted to create the look of water,
I would assign a dielectric shader like a
| | 01:13 |
mia material with glass.
If I wanted it to be milk, for example,
| | 01:19 |
then I could assign a subssurface
scattering material.
| | 01:23 |
If you want to learn more about how all
that stuff works, I did cover it in my
| | 01:27 |
course, Creating Shader Networks in Maya
and mental ray.
| | 01:32 |
So let's look at the output mesh
properties.
| | 01:35 |
I'll go ahead and select that poly
surface here, and I probably want to
| | 01:39 |
rename it.
I'll call this one Fluid Polygons.
| | 01:46 |
And then go into its attributes, Ctrl+A,
and after converting to polygons, then
| | 01:50 |
and only then will the output mesh
attributes here be relevant.
| | 01:57 |
So I can open that up, and again if I
have not converted to polygons, then
| | 02:00 |
these attributes, although they won't be
grayed out, they won't do anything.
| | 02:06 |
So this stuff only works after you've
converted to polygons.
| | 02:09 |
For the mesh method, you can choose a
quad mesh if you want, and that's kind of
| | 02:14 |
useful because with a quad mesh, then,
you can apply a subdivision surface
| | 02:18 |
algorithm to smooth the fluid out.
It just works better if it's all quadrilaterals.
| | 02:26 |
Below that, you've got the mesh
resolution.
| | 02:29 |
And that, as the name implies, is the
amount of detail on the mesh.
| | 02:33 |
With the default of 1 it's a bit blocky.
You might want to increase that up a bit.
| | 02:40 |
Below that, you'll see Mesh Smoothing
Iterations, and similar to what we saw
| | 02:44 |
with the end particle meshing This Mesh
Smoothing Iterations is a bit of a
| | 02:48 |
misnomer because it's not actually
smoothing the mesh.
| | 02:54 |
It's not subdividing the mesh or creating
more polygons.
| | 02:58 |
Mesh Smoothing Iterations only relaxes
the polygons.
| | 03:03 |
If we get in really close on this, we can
see that with the Mesh Smoothing
| | 03:06 |
Iterations of zero, we get this sort of
stair stepping look here.
| | 03:11 |
But then if we increase the mesh
smoothing iterations to a non-zero value
| | 03:15 |
then it relaxes the mesh and softens out
all those vertices.
| | 03:20 |
Usually a value of three or four is the
maximum you'll ever need to take it up.
| | 03:26 |
And that actually looks pretty good, but
if you need a bit more detail, you'll see
| | 03:29 |
especially around the edges here, it's
looking a bit blocky.
| | 03:33 |
If you've got an extreme closeup, then
you can go ahead and actually smooth the
| | 03:37 |
mesh object.
And since we are rendering in mental ray
| | 03:41 |
here, I can use the mesh smooth preview
by just pressing the 3 key.
| | 03:46 |
And I do get a warning saying, do you
really want to do a smooth mesh preview,
| | 03:51 |
and I'll click on yes.
And now you can see here that it's
| | 03:57 |
softened up that edge quite nicely.
The performance and the view port's going
| | 04:01 |
to be very slow, I just want to warn you.
And if you want to change the amount of
| | 04:05 |
smoothing, or how many polygons are being
subdivided, then you'll need to go into
| | 04:10 |
the polygon shape node.
Currently we're looking at the fluid
| | 04:15 |
shape node, so I'll need to navigate any
attribute editor, and find the polygons
| | 04:19 |
mesh shape node, and go into the smooth
mesh section here and you can adjust the
| | 04:23 |
number of preview division levels here.
So you can see that a little bit more
| | 04:29 |
clearly if I turn display subdivisions
on.
| | 04:33 |
Then you'll see we have these dash lines,
and those dash lines indicate the
| | 04:38 |
subdivided polygons.
And we probably don't need preview
| | 04:43 |
division of two, we could probably knock
that down to just one iteration.
| | 04:48 |
So at zero iterations it's not doing any
subdivision.
| | 04:51 |
And with one iteration, it's subdividing
it enough to make it soft.
| | 04:56 |
With two division levels, which is the
default, it's kind of overkill.
| | 05:02 |
And we really, probably, don't need that
much detail.
| | 05:05 |
So I think in this case a value of one is
optimal.
| | 05:09 |
And this will render just like this in
mental ray, so if we do a quick mental
| | 05:13 |
ray render it will be a smooth mesh.
If you need that result with Maya
| | 05:18 |
software or any other renderer, then you
will need to drop an actual mesh smooth
| | 05:22 |
node onto the mesh object here.
So I can turn smooth mesh preview off
| | 05:28 |
just to illustrate if I went into the
polygons menu set I could choose mesh smooth.
| | 05:34 |
And that will accomplish the same effect.
And it will be renderable in any other renderer.
| | 05:40 |
Not just in mental ray.
And now I've got a new poly smooth face
| | 05:43 |
node here.
I can select that.
| | 05:47 |
And you see its division levels are set
to one by default.
| | 05:51 |
And that wraps up our chapter on a
volumetric liquid in a 3D fluid.
| | 05:56 |
| | Collapse this transcript |
|
|
ConclusionGoodbye| 00:00 |
As we've seen, Maya's end-particles in
fluids give us the power to simulate
| | 00:04 |
liquids with a high degree of physical
accuracy.
| | 00:07 |
To expedite the training process, and to
ensure that the exercise files will run
| | 00:11 |
on nearly any computer, I've used fairly
simple simulation settings.
| | 00:16 |
In a production environment, you'll need
to increase the particle count, or fluid
| | 00:20 |
resolution, to achieve best results.
I hope you've enjoyed this course in
| | 00:25 |
liquid simulation in Maya.
Thanks for watching and goodbye.
| | 00:29 |
| | Collapse this transcript |
|
|