Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In this movie we are going to talk about this smoothstep function, a very useful function. And sometimes you just want to stipulate more exactly where you want a particle to start increasing or stop increasing or opacity to start and stop changing. With smoothstep it gives you this option. Smoothstep is a built-in function. Maya basically enters the value between 0 and 1 over a specified range. So you will have a smoothstep and you will have a start and an end and a unit parameter. And the smoothstep basically means that you are going from 0 to 1 from the start to the end of whatever unit parameter you have picked. To make this simpler I am going to start and make some expressions for you to see.
So I am going to go to a Runtime Before Dynamics Expression for the Radius. And the first expression I am going to put in is I know that my Creation Expressions, I know I have my radius that's starting out at size 0.1. So I always want my particles to be at least size 0.1 for the Radius. So for this expression, what I am going to do is radius Shape1, copy it down here, equals 0.1 plus five times smoothstep. And I am going to have this start happening at frame 100, have it go to frame 500 and the unit parameter is frame. I am going to create this. No red down there. That means I did the right thing.
Okay, so essentially the particle is going to start out at 0.1 size radius and then I am going to go five times the smoothstep value, which will be going from 0 to 1 from frame 100. So the smoothstep value here will be 1 at frame 500 and it will be 0 at frame 100. So at frame 100 the particles will have a radius of 0.1 plus five times zero. And so they will have a radius of 0.1 and at frame 500 they will have a radius of 0.1 plus five times 1. So the biggest radius that these particles will get up to will be a radius of 5 plus 0.1.
Okay, so let's see what happens here. We can see that our particles start getting bigger. Go back and do that again and they are getting bigger and bigger. Let's make sure that I have this Animation Preferences. It's always important when you are working with particles to have the Playback Speed every frame. Save. And there they go again. And so let's do a little render of our particles. Let's see, there they are.
Now the next thing that I want to do is I want to change the opacity of these particles over time. So I am going to go into the Opacity Per Particle expression, a runtime expression. I am going to do equals 1 and I want their opacity to go down minus. So I want their opacity to decrease over a range of frames. I want the opacity to decrease from frame 100 to frame 400.
This is from the time our particle is born at frame 100. Or actually it's not. It's from frame 100 to frame 400 wherein the opacity of these particles is going to decrease, all of the particles, uniformly. I am going to edit that and it's telling me that I have a syntax error. We will add another bracket there and that should take care of that. Okay. So let's see what we have got going now. All right, so we are going to let ourselves get by to-- we said by frame 400, they should be completely transparent.
And look, there is nothing there at frame 400. Now I want to change that. I will go back a little bit. Let's show you that there is something there. For example at frame 200. Let's see what we got at frame 200. Look, we have some particles halfway transparent at frame 200. Okay, now I want the same thing to happen over the course of a particle's lifespan, not by frames, by Lifespan. So right now let's do a Runtime Before Dynamics Expression. I just want to see what my Lifespan is right now.
Let's see. Creation Expression of my Lifespan actually. I am going to change that from 300 to 40 so it will be easier to see. And I am going to edit that. Then I am going to go into Opacity Per Particle, Runtime Before Dynamics Expression and I am going to make 1 - smoothstep, change what that is there. I am going to make it the lifespan so I am going to go particleShape1.lifespanPP.
Then I am going to put age there. Going to get rid of the word frame. I want it to start at 0, the beginning of the particle's life, and I am going to edit this. So now I have something different. So essentially it's going to decrease over the particle's age. Going to go Edit. Now I will show you something fun. That is I have the word age there and let me open up that again. You will notice how it's filled in. In front of age, it's filled in for me, particleShape1. Cute. Okay, so let's run it. Let's go.
Now this is going to be a per particle attribute based on when the particle is born and when it dies. So some of the particles will be transparent and some of them won't. Well, they're so big that they are taking up the whole frame. Let's move back a bit and try that out here. See what we get this way. Hopefully we are going to see some difference. Okay, so you see that some of the particles are opaque and some of them are more transparent because this, since I have done it over a lifespan, it's calculating each particle's lifespan and during the particle's lifespan it's going from opaque, from 1 down to 0. So how much fun did we have with this smoothstep function? Hopefully a lot of fun and we will continue ever onwards.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 35608 Viewers
100 Video lessons · 6131 Viewers
94 Video lessons · 24884 Viewers
83 Video lessons · 10513 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.