From the course: Learning nCloth

Hands-on with a simulation solver - nCloth Tutorial

From the course: Learning nCloth

Start my 1-month free trial

Hands-on with a simulation solver

- [Instructor] Realize that the computer is a machine that we create so that it can work for us. When I started computer graphics, I was very lazy, and one of the things that actually attracted me to simulation is the fact that it's working by itself and it's really quite magic. So in this video, we're going to look at how simulations work, if we really know nothing, just using very, very simple commands and the very basic commands nCloth in Maya proposes. And we're going to see how we can have actually fan directly using nCloth. First of all, we can just go ahead and create the plane in the polymodeling, and we can make it a little bit bigger. And this plane will be our ground. The second thing we can do is to create another object that we fancy deforming and seeing falling and moving. So I am creating a torus, and you can make it a little bit bigger as well. You can move it up, turn it around. And then now we have this ground and this torus in the viewport. The first thing we can do is to select the torus, and then we can go ahead and open the nCloth pane in the FX Maya setup. We can even open up this pane, if we want, and we can look and we can see that we have two different option directly in the S nCloth pane. We have Create nCloth, and we have Create Passive Collider. Creating a passive collider is about using a mesh and saying to nCloth that it's going to be used in the simulation, and that other objects can collide with it and can interact with. So this object will not really move and will not be deformed. The other option is Create nCloth, and that is really saying to Maya this object will deform, will be a cloth object, will be falling, and will be even interacting with other passive collider. So we can go ahead and select the pPlane1, and hit Create Passive Collider, and we can select the torus and hit Create nCloth. So just after we do that, we have two different parameters to change in the animation settings. The button is right down there. In the under animation preferences, we can look at the time slider option. So one of the very important options that we need to use for simulation is the playback speed. By default, maybe, in your Maya, it will be 24 frame, and you really need to use it in play every frame, because this is how the simulation is working. The simulation needs to play one frame of each other to be able to calculate them. So you need to change the playback speed to play every frame. The other option that you can change is max playback speed. This one might be free by default, and it's best to keep it free. It will force Maya to show and to basically calculate every frame, and it will not skip any frame if, for example, Maya could calculate faster. And then you need to hit Save, like that, Maya will take those new parameters. So now that you have a plane that has been converted as a passive collider in nCloth and you have this torus that has been as well headed to the nCloth simulation, what we can do is hit the button Play, and let's see what is happening. Woohoo, we can see the torus falling, and colliding with the ground. You can hit Stop again and hit Go Back To Start Frame on the playback range, and hit Play again. And what you can see is that the torus is falling slowly, deforming, hitting the ground, and you can see that Maya is continuing to calculate and that the time slider is going. Simulation works exactly like a laundry machine. First, you put the clothes in there, then after, you hit Start, and then you have to wait for nCloth to do its work, calculate. Not going to wash anything, but it will basically make magic. So you can always go back, starting the go back to the start of the playback range, and this button is very, very important, because one of the things that you can do when you do simulation is scrubbing. So for example, if I actually start to go on the timeline and I drag like that, I can see indeed that the torus is simulating, but when I go back, it doesn't go back, it doesn't show, actually, how it was before. And then you have a warning appearing. You have Maya telling you, warning, nucleus simulation skipped, frame change too large. So this is really how simulation is working. Simulation work calculating frame by frame one after the other. So this is the most important in a very important concept to understand is that simulation is a process that happen linearly in time and that nCloth will always need the progress frame to calculate the next one. So it's not possible to jump in time, because if you scrub quickly, Maya is not happy, and it's not going to work. So that is a very important concept. We can all the time go back to the playback range to actually have Maya refreshing and restarting the initial state, then after, we can hit Play and see it falling again, but it's not possible to scrub or to basically jump in time. So as we can see, nCloths work by magic. We just have to have some object as passive collider and they're going to be images, and we can add any other object that will be in nCloth, and we can just hit Play, and we can start to have fun. So for example, you can, as well, change and deform this plane, if you want, you can move those vertices, for example, you can make a little mountains like that, and you can as well move the torus up there. I propose you to go ahead and to create any other object, like this cube, for example. So the only thing that you have is to have a little bit of polygons, because nCloths need some polygon to be able to define them. So for example, you can select this cube, and this is the heights and weights. Let's add some subdivisions. And we can just select this cube and create an nCloth, and hit Play. The action is not as fun as I expected, so I can hit Escape to stop the simulation, go back, and we can just take this cube and move it a little bit foreword. Let's move it out of the torus, it's better if two close object are not intersecting at the beginning of a simulation, and let's hit Play. So we can see this cube falling, interacting with the cliff, and everything is falling down the hill. So as you can see, just using two very simple command, Create Passive Collider and Create nCloth, we can appreciate the illusion of life, Maya making things moving and reacting like in the real world. So I welcome you, and I invite you, to create as many primitives as you want and to make exciting nCloth simulation.

Contents