- [Instructor] Well,
I'm just gonna say it. Cloth, it's pretty tough. Yes, there's some cloth that's soft, but that's not what I meant. Simulating CG cloth and fabrics
can be an arduous process beyond simply just
dropping it onto a table. And don't even get me started
on trying to recreate folds, all right? It doesn't have to be this way, though. In this video, we are going
to explore three easy features that can make the cloth
simulation pipeline bend and fold to your
every whim with great ease. I'm Chunck Trafagander with CG Cookie. Let's get into it. All right. And so I'm here in a new blender scene. And the first thing I want to
do is I'm going to go ahead and add a plane, right? Because this is gonna be
our cloth mesh right here. And to start that off
we're gonna need to add a little bit more faces to this guy, because if we go into edit mode, you can see that with one face we're not going to really be able to get the most awe-inspiring cloth simulation. So I'm gonna go ahead and
quickly subdivide this guy. And I'm gonna come down
to this operator panel and I'm gonna go ahead and
actually just give it 40 cuts. So that way you can see that we've got a lot of faces to work with, but it's still small
enough that it's not going to blow my computer up while
I'm also trying to record this. So we've got this guy all set up here, and now I want to go ahead
and I'm going to go into our physics properties, and over here I'm gonna select cloth. And you can see that now if I
hit space bar on my keyboard or come down to my little
timeline here and hit play, you can see that we're going
to have our plane just kind of fall into oblivion. And that's pretty sweet. That means that our cloth
physics are working, but we're going to have
to actually constrain some of these vertices or pin our vertices so that we're going to be
able to work with our plane so that it's not just constantly falling into the never ending
abyss of the 3-D view port. So I'll come back into
edit mode for this guy, and I'm gonna wanna to pin it on this end and this end over here. And so if I come into
the vertex properties, you can see that we have
a vertex groups section. And so I've got these guys selected here. I'm going to hit plus just
to create a new group, and I'll go ahead and
just call this group pin. And now with my vertices selected, I'm going to go and hit a sign. I'll just de-select those. And if I have this group
selected and hit select, you can see that it's going to select everything in the group. So that's pretty sweet. And I'll come back down to the physics and under our cloth, I'm going to go to where it says shape. And you can see that we're
gonna have this pin group, and it's going to accept vertex
groups as our objects here. So I'll select that guy. We only have one vertex group, which is gonna be pin, and that's awesome. So now what I can do, if
I hit play on my keyboard, you can see that where
we've pinned these vertices, it's going to basically
not allow it to move, but the rest of the vertices on our mesh are going to be able to freely move. So that's gonna be pretty handy. We can also come in up top
here and play around with-- if we click on this
guy here--some presets. So if we go to maybe
something like rubber, you can see that it's going
to really bounce around a little bit more, and we're going to get a whole
bunch of different property setups basically from using these. So depending on the kind of
fabric that you're going to be wanting to work with, these might give you a good
starting point to kind of get the effect that you're looking for. I'm going to go back to cotton. So now if I go ahead
and hit the play button and I try and scale this
guy down on the X, say, you can see that it's not really getting the effect that I want, and we're going to have a lot of trouble. And you can see that we're
gonna get a lot of kind of visual glitches as stuff
starts shootin' around and physics start goin' haywire. And so in order to get these ripples and some of these folds in the cloth, we're gonna have to
figure out a different way that we can scale our
object down without actually scaling the object itself. And so this is where the
idea of object constraints comes in. And so if I come down here, you can see that there's this little kinda gear lookin' thing, and if I come into here, you can see that we're
gonna get a lot of different useful resources that
you've probably not used or even really seen before, because it's kind of a scary
area of blender, right? Like what, what is a camera solver? What is a damped track? It's a lot of big, scary words
that really are kind of vague if you've not been around them for any extended period of time. But the constraint that I'm
going to use for this, guys, under transform and copy scale. And what this is going
to allow us to do is I'm going to be able
to create kind of like a parent controller. And when I go ahead and
scale that guy up or down, we're gonna be able to
pretty much copy the scaling factor of that parent object to be used to scale this guy up or down as well. And you can see that's
exactly what it's going to do because we have this target, but we don't have
anything else in our scene to actually be used as this controller. So the first thing I'm
going to do with that is I'm gonna go ahead and add a new plane. And I'm just going to get
rid of these vertices here. And I'm going to move this vertice back into the center here, so that I'm just going
to have this edge, right? We're just gonna have two vertices, and in between it it's
going to be an edge. And the reason I like this guy
is because I like to scale it up and down like this, and it's gonna give me
a very clear indication as to what the scaling of my edges is going to be like, right? Because it's pretty much the same length. Well, not pretty much,
it is the same length as these edges here. So it's a pretty good representation of how it's going to scale down. So I'm gonna select our cloth again, and I'm gonna go ahead
and just add this guide as our target. So now you can see just
straight out of the box here, If I scale this guy down, it's going to scale down our plane here. So in a nutshell, that's
pretty much all it is. But if we take a look at the
constraint modifier here, you can see that we're
going to get a bunch of different options here. And so the first ones I want to focus on is this X, Y, and Z, right? And that should be pretty
obvious as to what it is, right? It's going to copy the
targets X, Y, and Z scale. So if I just uncheck these two here and I go ahead and
scale this guy down now, you can see that it's only
going to affect the X scale. And same thing for the Y if we go ahead and scale this guy down. Again, I'm not constraining
it to any axis. I'm just scaling it down on all three, as you can see kind of up
in the top left corner here. But it's only going to
scale our child object down on the specified access. We can also do more than
one at a time, right? I wanted to scale it down
both on the X and the Y. And in this tutorial, I'm just gonna make sure to scale it down on the X for now, because I only want to
crunch it or scrunch it inwards on the X, but I don't really want
to make the whole object smaller as a whole. And finally, the last
thing that I want to do, is I wanna come down to space. You can see that right now,
the space that the target, this guy here, is being
evaluated in, is in world space. And I'm going to go ahead and
just change that to local. And I'm also going to change
the space that this guy's being evaluated in into local as well. And all that's really
going to allow you to do is if you come up here and you
start moving this guy around and rotating it on pretty
much any access or direction that you want, when you
start to scale it down, it's still going to work pretty
much as it does right here. Where I'll scale it down, and it will scale in on
the X of this guy here. That's pretty much just
the general idea of it. So now that I've got that, I'm going to hit space on my
keyboard to play this guy. And I'm going to scale this guy down. And you can see that immediately, right, we're gonna get all of these kind of folds and these creases here. And that's going to be really cool because that's a super effective way of going about creating cloth. But you can see that after
a certain amount of time, my cloth kind of went flat again. It's like it restarted. And that's pretty much
exactly what it did. If I bring this guy up here, right, and we go ahead and play this. And I'm going to scale this
down just a little bit there. You can see that as it
works towards the end of 250 frames here, it's going to start the
whole simulation over. So what I'm going to do
is just bring our end up to be something like a thousand. So that that way we're going
to be able to get something that we're pretty satisfied with without having to worry
about our whole simulation starting over on us. So that's pretty sweet. I'll bring that right back down. And I'm just going to clear
the scale again with Alt S. So how else can we use this? Because we've kind of developed
a bit of a workflow here for creating some creased or folded cloth. But what's kind of the use case for that? Well, I'm going to take this guy, I'm just gonna duplicate him, rotate it on the X 90 degrees, and in edit mode I'm going
to just bring him up one. So this guy is going to
act like a drape, right? Hanging vertically. And this could be a more prominent reason why you'd want to use
this kind of workflow. I'm going to make sure to
get rid of this bottom row of vertices here from our vertex group. We'll just go ahead and remove it, so that now it's only gonna
dangle from the top there. So if I go ahead and just hide this guy, I maybe gotta change this
to be something like, we'll go to denim up here. And if I hit play and
scale this down, right, you can see that very easily and quickly we're gonna be able to get some pretty cool looking hanging drapes. And if I shade that smooth, immediately we're going to be able to get really nice creases and
really great control over our fabric, and it's going to allow us to
do some pretty crazy stuff. By working with cloth using
a combination of pin groups, copy scale constraints,
and preset fabric physics, we are going to be able to
get a wide variety of results that we can use to capture cloth in pretty much any capacity. Most of the fun comes from experimenting with these different combinations to create realistic, interesting, and sometimes goofy results. Thank you for watching
this CG Cookie tutorial, and happy blending. (buoyant music)