Transcript for:
Houdini Simulations and Dynamics

knock on the door welcome back to Houdini is hip in this part we're finally getting into the fun stuff in the last few parts we looked at rendering and all of the basics but in this part we're finally going to start on simulations and Dynamics so all of the following parts from here on out we're going to be looking at the different types of Dynamics and the different types of simulations starting with the most basic in this part we're looking at Pop networks so what is a pop net well a pop net is a particle operator Network right shortened as partners you'll often hear things like Sops stops and that's just different short-hand phrases used inside of UD for example socks are just surface operators and those are things like geometry so if you're just working with static geometry you're working at the sub level if you're working at a dynamic level you're going to be working with Dynamic operators or tops so we're going to be working with pops particle operators now particles are the most basic type of simulation that you can do inside of Houdini because all they are are a bunch of points being driven by a bunch of rules so we don't have to fortunate really figure out all of those rules for ourselves we just use a bunch of different nodes to Define how particles move and interact and all of those things so what we're going to be doing is creating a spark system so we're just going to have some Sparks falling onto the surface and we're going to have them sort of breaking up and jumping about so let's get straight into it into Houdini so inside of Houdini we've got a fresh file we're not doing anything with the donut anymore we're going to go straight into a brand new thing so let's go ahead and tap in a geometry node this is just our starting point and we're going to call this Sparks inside of here we're going to create a grid so just Tab in a grid node and right over here we just have this 10 by 10 grid so this is 10 meters by 10 meters if we're looking at the size of our particles they're going to be tiny right Sparks are really really small so 10 is going to be a bit big we're going to be using this as an emitter so if you imagine this grid and particles are just falling off of it that's our emitter all right and emitter is just something that emits particles so that can be any sort of shape any sort of object it can be a volume there's plenty of things that it can be but in this case we're just going to use a grid so we're going to scale this grid down just to a one by one and then we're going to move it up so we're going to move it up by 1.5 meters so it's 1.5 meters above the ground next we're going to animate it and this is something that we haven't yet done and this is going to be our first look at our timeline and our timeline is going to be important again later when we look at actual simulations so for now we're going to animate so if we drag along our timeline nothing happens right everything is static but let's go ahead and switch on our transform handles and let's adjust some settings over here so the first thing that I'm going to do is on frame one I'm going to set a keyframe now if you're not familiar with animation a keyframe it's just a set point of data if we have position a over here at frame 1 and position B over here at frame 24 then in between there'll be an interpolation or a movement from position a to position B so each keyframe holds a data point and in between we interpolate between that so that's how you get animation and so we're going to do a super basic animation we're just going to keyframe the first frame so to do that we're going to hold alt and then we're going to click on the parameter so the parameter that we want to change is the center as you'll see when you do that they go green right all of these over here these parameters turn green that means that we have a keyframe at this current frame when we move away from frame one you'll notice that it's now just this blue color that means that it's keyframed so this animation but it doesn't have a keyframe at the current frame because now we're on frame like 49 there's no animation there so we're going to go over to frame 96 and then we're just going to move our grid over so we're going to move it along the x-axis so we'll just move it over here and we'll move it over to about three so we'll just set that to three I'll see that it is currently yellow that means that there's been a change made but we haven't keyframed it so it's keyframe it once again hold alt click on the parameter name and you can also keyframe a single parameter you don't have to keyframe all three of them I'm just doing it like that because it's easy but you don't have to do it that way so there we go if we now go to the start and we drag along you'll see that awkward moves if we play this back it will move really quickly over all right and that's because by default Houdini plays back our timeline as fast as it possibly can but if you wanted to play back at real time you can activate the real-time toggle now when I say real time what I mean is play it back at the actual specified frame rate so we have 96 frames now in Houdini 24 frames per second is the default so every 24 frames represents one second so as you can see over here we have 1 to 24 that's one second 24 to 48 2 seconds 48 72 3 seconds 72 to 96 4 seconds so that's technically how long it should take to play it back and if we activate our real-time toggle in the bottom left that's exactly what will happen it'll take four seconds to go from frame 1 to 96 perfect we've got our grid and it's moving it's animated and we've activated our real-time toggle from here we can go ahead and create a pop Network we're going to press Tab and type pop right over there you'll see Pop Network press enter and drop it over here now you'll notice that there are four inputs for this part Network so we're just going to use the first input for this so go ahead and plug the grid into your first input for your pop Network and what you'll notice is immediately once you set your display flag on your pop network is that we now have a bunch of points where our grid once was and if we play this back you'll notice something a bit strange so we play this back and over time we end up with a bunch of points as our grid moves by right now what I'm going to do is I'm going to template outgrid so templating is a way of viewing another node that we aren't currently using it's useful for comparing things so what we can do over here is next to our display lag on our grid we have the template option just template and what you'll see is this outline for our grid and we can now see that as our grid moves along that's actually what's leaving behind our points right it's an emitter however our points aren't doing anything these are our particles but they're not doing anything just yet the reason is we haven't told them what to do we haven't given them gravity or wind or any sort of forces we haven't let them interact with any objects none of that so we're going to go inside of our pop Network to Define all of that double click on the pop Network level you are now at the Dynamics level and this isn't specific to a pop Network in the top right you'll see it says Dynamics and this is how it'll be in every Dynamics Network whether you're working with pops Vellum flip RBD pyro it'll all be in the same network it'll all be in a Dynamics Network and in this case we're just working with particles so it's called a pop net but radios is the.net that's a Dynamics Network so over here we have a couple of things on the left hand side we have the pop object on the right hand side we have our source and in the middle we have our solver and at the bottom we have an output so I'm going to bring this up full screen you can press Ctrl B to maximize a particular window so hover over window Ctrl B maximize it so let me just explain what's going on here because this is what you're going to see every time you use a Dynamics Network what you have on the left hand side is a pop object or any sort of object this can be a flip object a smoke object anything what that does is it stores the data for your simulation so when you're exporting this or using it later on you're actually using the pop object right you're taking the data from the pop object and that's what you're using on the right hand side we have our source this is always going to be the situation where you have the pop object on the left Source on the right source is just whatever you're bringing into the simulation so you're bringing in some new data and you're feeding it into that Pop object right so you have new information being brought in for every frame or whenever you need it then both of those plug into a solver so we have an object we have a source and we have a solver the solver is like the brains behind it right it's what actually does the work so we're bringing in some information we're solving it in the solver and we're feeding that new information into the object to be stored so the object has our information the solver runs over the information every frame and we're just sourcing new things in and then it gets output and technically we're outputting the pop object the solver has just done some operations on it and this actually makes a lot of sense because a lot of the time when we have a multi-input node the output is generally what the first input was and that's exactly that over here the pop object is what's getting output which is using the solver to iterate on it and make changes so we can go ahead and also drop other nodes right so we can add more sources or we can add forces underneath the solver let's go ahead and add a gravity force so over here we'll plug the Gravity Force under our pop solver just like that so now we have our first force that we want to affect our particles with I'm going to press Ctrl D to minimize this again and if we now play this back you'll notice that we have particles that fall over time we now have gravity and this is useful for plenty of things right and in this case we already have something that potentially looks like rain or something like that what you will notice is when we play it back we have this blue bar that occurs at the bottom in our timeline and this blue bar is what is cached so when I say cached it's what's already been calculated and stored to the memory of your computer to the RAM and you can Define how big your cache size is under the cache tab of the dot network but this tells you okay I've already calculated this many frames we can play this back freely right now this isn't something that's necessarily important when you're working with a small pop Network like this but when you're working with a flip simulation that takes maybe a couple of minutes per frame then this is important right because when things get cached to disk you can play them back you don't have to recalculate them so let's go back inside of our pop net and make some changes inside of here let's add a collider so we're going to add a ground plane so just type ground and you can drop a ground plane we'll drop it over to the left over here and we'll be merging it in so we'll drop a merge node and after our gravity we'll just plug this merge node and then we'll plug our ground plane into the merge node now what you'll notice on the merge node is that there's a relationship of collide relationship and the effector relationship is left effects right so that means that the left input of the merger node affects the right input we want the ground plane to affect the particles so what we're going to do is we're going to swap them around by clicking on these little arrows so click on the arrow and it swaps the inputs around alternatively you could just use Mutual which is fine but I find it looks neater if you just have your colliders on the left hand side so just make sure that your collider is coming into the left input now what that will do is it'll add a ground plane to our simulation and our particles can now collide with that ground plane if we look at our timeline however you'll notice that our timeline is now orange that means that there has been some changes made and what's been cached is no longer relevant it's no longer correct it doesn't reflect the most current change so because we added a ground plane this cache is no longer relevant so we can jump back to the start we can press these double arrows on the left hand side jump back to the start and you'll notice a ground Lane the ground plane has some settings for its position and things but we're just going to leave it as it is and we can all play this back again what you'll notice is that the particles now hit the ground they bounce a little and then they come to rest right now the thing about particles like this is that they don't really have any sort of variation to them they're just falling straight down they're bouncing once or twice and then coming to rest they don't roll or anything like that because they're just points there's nothing defining any sort of particular movement to them they just have a velocity velocity stops right so let's make some changes to improve this firstly our particles are falling in these sheets the reason that happens is because we have particles being emitted too quickly if we go to frame one right and then if we press the arrow key so just right arrow key once you'll notice that we have a new set of particles if we go again and again and again and again you'll notice that particles are being emitted but the amount of distance that they're covering between two frames is too big so what you end up with is a gap between them right so at frame one they over here based on their velocity at frame two they will be here however that's a big gap right so there's no information in between there so what we can actually do is go to our top source and on here we can change some settings right we can tell it that we don't want it to emit this way we want it to Jitter the emission so we can go over to the birth tab of this and at the bottom over here we have the Jitter birth time and we can set this to negative if you hover over it it'll explain what it is and you'll see that the last sentence is this is useful when adding High Velocity particles from images as it won't generate clumps on each frame that's exactly what else is doing jump back to the start play it back that's one problem fixed so the other thing is our particles are just falling right because we have gravity and the gravity is just pulling them straight down that's all that's happening to them however if we go over to the attributes tab over here you'll see that we have this option to inherit velocity now that's useful if our grid has some sort of velocity if we generate velocity on it and we have our grid moving then the points will carry that velocity with them however we can also add to an inherited velocity or set its initial velocity we're going to set the initial velocity and if we set it to a very of one so that's one on every axis it'll give it some random velocity as it's born so if we play that back you'll see that it's now a bit more spread out right it's not so uniform there's a bit of variation to it so cool we have that next we wanted to actually hit the ground plane and do something so we need a collision Behavior we wanted to hit the ground plane and then emit some more Sparks right so it's almost like it's hitting and then breaking up its smallest box so to do that we're going to go ahead and drop a pop Collision Behavior pop Collision behavior and this goes over here by our sources so if this doesn't seem to make sense to you at the moment how we have it is our pop object it's just storing the data so we never really add anything to this left side the right side is our source so we want to add things that affect our source right we want to add behaviors and all sorts of things that actually affect our source then we can tell our solver to actually do the work with this information that we're giving it so now what this pop Collision Behavior does is it tracks when something collides so as you can see these points turn red when they collide with the grand so what this allows us to do is it allows us to use that detection of collision to run some other things so once it's collided what do we want to do we want to image Sparks so first thing that we're going to do is add these to a group right and we can name this group whatever we want I'll just call it impact so that's a group called impact we haven't looked at groups in Houdini just yet but a group is exactly what it sounds like if we have a bunch of points some of them can be added to a group so that they're easy to recall let's say you have a thousand points and you group 100 of them right you can then individually work on that single group you can take those hundred points and you can change their color you can change their size you can do whatever you want with them right as long as they're in a group they're really easy to reference so that's why groups are useful so we're going to have this group name impact if we jump up a level and we middle Mouse on our pop net as this plays back we'll be able to see that at the bottom over here we have two point groups we have impact and we have stream Source first input for now you can ignore all those other attributes those are all generated by our solver so those are things like the age of the particle color whether it's alive or dead it's velocity all of those things so we don't need to worry about that right now we're just looking at the groups so we have impact and we have stream Source first input stream Source first input is auto generated by the pub network if we go back inside it's this over here right Source first input and it's coming from the Stream So that just means that any particles coming in here those are part of source first input so back to our Collision stuff what we want is for these points to die on collision so as they Collide they die if we do that you'll see that those points just disappear as they Collide they just disappear now why do we want that well what we can do is as those points Collide they'll get added to a group and then what we can do is we can take that group and we can emit some new points from that position so as if it's hitting and then exploding and then it will kill the point right so what we can do is we can very easily add a pop replicate node and this is a node used for generating more points from a source of points so over here but you can plug this into second input and we're going to have to change a couple of things so first the constant birth rate we don't want that right constant birth rate just refers to how many points are emitted per second so we're going to switch that to zero and you can also switch the constant activation to zero the impulse count is how many points are generated when this node is run so what we're going to do is we're going to set this impulse count to five and we're also going to change the group we're going to say we only want the group impact right we only want impact to replicate points the other thing that we're going to do is we're going to go over to this shape over here and the shape that we want to emit from is a single point so what this means is when this point impacts and as part of a group emit points in a sphere we don't want that we want to emit from a single point at that impact point so we're just going to set this to point just like that all right so once we have that if we play it back you would assume that this would work right so you play it back and what we're expecting is for a point to hit the ground and then basically explode into some more points so we play this back and that doesn't happen the reason is that the order of these are important right the way this works is your Source first input comes in and then it tries to merge in the pop replicate but this group is only made after the pop replicate is merged in so what we actually need is for this Collision Behavior to be detected before we merge in the pop replicate so all we have to do is bring the pop Collision Behavior above this before we merge in the pop replicate so we can just click on this and you can actually wiggle nodes around you can wiggle it like that to release it and we can drag it over here plug it in there okay so if we try this now let's see what we have okay so that works right what's happening is our points are coming in they collide with the ground when they collide with the ground we create some replicas of them that's why they're actually coming through as red right these aren't those same points that you were seeing before what they're doing is they're actually fetching the attributes of the point that's colliding with the ground so remember the point collides with the ground turns red dies then we replicate points from that and they pick up all of the attributes of that point we can actually see this if we go over to our power replicate node under the attributes we can see that we're inheriting all attributes that means that we're inheriting velocity color scale all of those things so we can actually tell that we don't want to inherit color and all of that we just want to inherit V for velocity right so V is our velocity attribute that's all we want to inherit and we can add some variance to this we can say add to inherited velocity and we have some variance over there and if we go back and play this again you'll notice that we have that so these points are now kind of exploding as they hit the ground cool so we don't want these points to last for very long once a point impacts we want those points to shoot out but then we want them to die off very quickly right as if it were a spark so what we can do is on our pop replicate node go over to the birth Tab and under life expectancy we have this that says 100 that means 100 seconds so remember as we said before 24 frames equals one second so that means 100 times 24. so 2400 we can change this to a tiny value like 0.1 and if we play this back now you'll notice that these points don't live for very long once they've been replicated right and we can mess around with different values for this 0.2 that looks pretty cool what you can do with that is you can change the life variants so life variants it'll take your life expectancy of 0.2 seconds and add a bit of variation to it so each point will vary slightly so it's just for randomization so we can add 0.1 to that and some will last longer than others okay so let's also just add a group node let's go ahead and group this so a pop group and over here we'll just say enable right all we're going to do is just enable and add a group name so the group for this can be something like splash I don't know it's just the points that splash and yeah so everything coming from that stream over there is going to be grouped into Splash so they're not going to be affected by anything on the side they're only going to be affected by things on the side right so if we go up a level and we play this back what we can actually do is we can now use those groups that we created so for example I can drop a color node and over here we can just Target the splash group and we can make them red right or orange or whatever just so that we can see that they're a different group cool so we have some particles over there so that's all we're really going to do in terms of the actual particle stuff the next thing that we're going to do is we're going to work with a little bit of Vex code and the reason we're going to be working with some code is because we need to affect our attributes so we're going to be using some things to change our attributes we're going to be doing things to scale the particles and all of that so let's go ahead and try that let's go ahead and drop an attribute Wrangle you can type aw for short and over here we're just going to plug our pop Network into this attribute Wrangle the first thing that we're going to do is we're going to set a p scale now p-scale is the size of the particle now at the moment all of these are just points right but when we render points points are rendered as spheres and those spheres have their size defined by p-scale so if you render a particle with a p scale of one it'll render as a sphere with a diameter of one so what we can do is we can control that P scale and have this vary the sizes of our spheres right now if you haven't worked with Vex before this might seem a little bit strange but just bear with me I'll try to explain this as best as I can firstly we're going to need to create an attribute so to create an attribute in Vex you just say at and that creates an attribute and then you give it a name so we're going to say at p-scale right so we've created an attribute called at p-scale and we need to make it equal to something so we say equals and let's make it equal to 0.1 now with Vex we have something called syntax and syntax is basically the grammar of coding and so we have at p-scale equals 0.1 and to tell it that We've Ended that line we put a semicolon that's almost like a full stop right so if you're writing an English sentence that's like a full stop if you click away you won't see anything change but if you middle Mouse on this attribute wrangle and you go through all of these attributes you'll see that over there we have P scale and if we go over to our geometry spreadsheet which is where we look at our attributes we can go ahead and find our P scale over here if we type p-scale in the attribute section we can see that all of our points so on the left these are Point numbers all of our points have a p-scale of 0.1 so all of these points that you see have a p scale of 0.1 because we've told it run over points make p-scale equal to 0.1 okay if we want to view our P scale what can we do there's a really nice thing that we can do inside of our viewport if we hover on our viewport and just press D that will bring up these extended display options that we looked at very briefly before but if we go over to our geometry and we go down to particles we can say display particles as and they're currently displayed as points but we can set them to be displayed as lit spheres Blitz spheres will change them all to their correct p-scale right so this is what all render has actually and at the moment they're kind of chunky but that's what bell render has all right so from here I'm not going to make any more changes right now what I want to do is I want to go over to the stage level as we looked at in the last part and set up a bit of a render and so that we can actually see what this looks like and we can come back and forth and kind of make changes and figure out how we want it to look before we do that if you found this video useful so far or this entire series useful please remember to leave a like And subscribe if you want and if you really like this video feel free to hit the join button and become a member it really does help us out so okay straight back into it let's go over to the stage level over there object Network we'll use the drop down go to stage over here we'll use ASAP import with this we'll import our Sparks node and just like that we have these points being brought in over here now what you'll notice is that it's also bringing in our ground plane and that's not actually what we want if we go back over to our object level and to our Sparks the reason it's doing that is because over here in our pop net what it's doing is it's outputting everything that's in the network right so ground plane plus particles all of it we only want our particles so to do that we can just call the name of the pop object right because at the moment it's bringing in the ground plane and the pop object we just want the pop object so instead of saying asterisk which is the same as everything that's what it means it's saying everything in the network we can change this to pop object alternatively you can use the drop down and you have pop object or ground plane so you can choose pop object just like that and we'll just bring that in cool back to our stage we have just our particles being brought in and you'll notice that at this level they're just being displayed as points right again they're not being displayed as those full-size particles what we can do is switch it to Let's Fields but I'm going to leave it as points just so that you remain aware that they are still technically just points right only when we render do they actually become rendered as spheres so over here we can go ahead and switch on the comma render View and this is actually what our render looks like if we have to render this out to disk now this is what we would have just like that what I'm going to do is I'm going to drop a camera node just over here plug it in so we have our soft import and we have our camera plugged into it what we're going to do is we're going to adjust the position of this camera so that it's looking at the particles as it's coming to the camera so if we go back to the first frame we want our camera kind of pointing towards the particles so we're going to place it over here we're going to move our Focus over here and so the settings that you're looking for is something like this so a rotation of 90 90 and 90 on every axis and we can move this a little bit closer to our particles to see yeah that should be cool we'll translate it up very slightly maybe 0.1 or 0.2 something like that and let's take a look through our camera okay something like that is kind of cool I'll move it a bit further back so that it ends over here all right so once we have that we can go ahead and drop a comma render node so we drop a comma node right over here plug the camera into the comma render settings node and we looked at this in the last part let's just sets up our render node so it's the same as having a comma render node at the out level which is creating it ourselves over here if we now look through our camera and we set our display flag on our Karma render settings and then switch to the comma render View you'll notice that we have these particles over here and they look very weird but you know it's fine so cool we have these particles that are massive and they're just falling on our camera we're going to go back up to the object level and make some changes so we now know what this is going to look like when we try and render it out so we can change the scale let's drop this p-scale down to a lower value 0.01 okay that looks better however they're all the same size what happens if you want to add some randomization right so what we can do is we can use a function when we're using Vex functions are things that we can use to make our lives a lot simpler they're little pieces of code that actually call upon a much greater set of code for example we can use a random function to generate a random value for us and so we're going to do that we're going to say that our P scale is equal to 0.01 multiplied by a random value so we type round that's the name of the function and then we open a set of brackets now inside of a set of brackets go your arguments arguments are just the things that this expect this random function expects a particular input and you can check the documentation on this or if you space in backspace over here it'll tell you exactly what it looks for and it'll tell you what the function does and everything it says creates a random number between 0 and 1 from a seed and then it tells you what it needs right so all we have to do is give it some value like if I give this a value of 2 that's a random seed if I give it a value of five that's a different random seed and as you can see it's now multiplying it by this random number that's being generated so this is just a different seed each time right it's always giving us a different value however that's just a constant right every Point gets the same scale what happens if we want to scale them uniquely so each point has a different scale to do that we can generate a random value based on an attribute that's unique to each point so which attribute would that be fortunately the pop Network creates an attribute called ID now the ID attribute is an attribute that is unique per point and it's used to track points over time because if you think about it if you have a simulation where particles are being added and they're dying all of the point numbers are changing it it becomes really difficult to track which point is which because as time progresses and you have more points being added or removed all of your point numbers adjust so what we have is a unique identifier called ID that stays the same no matter where the points are removed or added right they have a unique ID that stays the same to use that ID we just say at ID now you'll notice that it's the same as when we created at p-scale the thing about Vex is that if an attribute exists it will call it and if it doesn't exist it'll create it so at p-scale didn't exist so we created it but that ID exists so we're calling it so we're just saying at p-scale equals 0.01 times random and the thing that we're feeding into that random function is the ID of every point so what you'll notice now is that each point is a different scale we play this back and we just have a bunch of different scale points the next thing that we can do is that we can scale down these points over here so you know the points that are impacting and splashing we can actually scale them down over time so they hit and then they shoot off and over time they scale down all right so we're going to add another attribute angle after this one so we can go over here to the group and we can call Splash remember Splash is just that group of points that are splashing off the surface and I can show you which ones these are if I just set the CD attribute to some value right those are the points so those flash points we want to scale them down over time to do that I'm going to add a line of code and you can ignore that color thing it's just for visualization purposes for now what we're going to do is we're going to say at p-scale and this time we're not going to set it right last time we set it we said it's equal to 0.01 times some random value this time we're going to multiply it and buy some value so we're going to say is equal to at p-scale times a particular value now the attribute that we want to use is an attribute generated Again by the pop Network it's called NH NH defines how far along a particle is in its lifespan so it starts at zero and it goes towards one so as a particle is born it'll be at zero and as it progresses and reaches its end so it's death it'll reach one so zero to one right depending on its age so what we could do is we can multiply our p-scale by that NH attribute so if we multiply by at n h you'll notice that these particles get smaller however they're not actually correct what we want is one minus NH because what we're currently doing is we're saying again multiply P scale but by n h but remember NH is smallest when a particle is born we want the reverse so all we have to do is put this into brackets over here we can say 1 minus NH right so now we're saying the inverse and if we play that back you'll notice that our particles are now shrinking over time and if you want you can reduce the number of particles that you have just so that's easier to see what's going on again we'll be going to the source first input under the birth tab you'll have your constant birth rate we can change this to just something like 500. so we'll only have a tenth of the amount that we used to have and you just have something like that and if you want you can increase the life expectancy of those points so the pop replicate points go over to that tab let's increase it to 0.5 something like that looks much nicer cool so that's looking good if we now go over to our stage level what you'll notice is we have these points and the green we can just ignore that for now we haven't given it a material or anything that's just kind of how they are so we have these points that are just falling and kind of exploding off the ground so that's cool however we want some other things we want a color on these points we want velocity so we have motion blur and then we want to give them some sort of emission brightness so let's do that let's first start with giving them a color so in this attribute Wrangler over here the first line that we have I'm going to add another line to this over here we're going to say V at CD notice that it's a lowercase V and a Capital C remember c d is our color attribute what we're saying here is V and CD we're defining what type of data CD should hold right and we know it's a vector because a vector is anything that's multi-component so something like position right so you'd have VIP because position has three components x y and z CD has three components are G and B right red green blue so V add CD then we make it equal to CH ramp CH ramp is a channel ramp what we can do with that is we can create a ramp or a curve or whatever we want and that will Define the distribution of column it'll make sense when I kind of create it shortly Just For Now understand that CH ramp creates a parameter for us so let's go ahead and open brackets for this because it is a function you'll notice that all of your functions are in this kind of turquoise column once you open your bracket it'll tell you what you need so evaluates around parameter and returns its value the first thing that we need is the string channel so a string is just held within two inverted commas so over here all we're going to do is give it a name we can call this color underscore Ram something like that after the inverted combats we're just going to add a comma and then tell us what to be driven by we're going to be driving it by its age so we're going to say at an age close brackets and then we can add a semicolon because that's like a full stop done what you'll notice now is that all of your points are black right there's nothing really going on here and that's because we're setting V at CD to this channel Ram function that hasn't actually been set up yet to set up our Channel ramp we can go over to the right over here create spare parameters for each unique call of ch what that'll do is it'll create this parameter at the bottom of our attribute triangle it's a custom parameter that we've created right this isn't something that was on the attribute or angle we're actually creating it by using this channel around and this is kind of cool because you can actually create a bunch of different things you can have float drops so I'm just going to show you that quick float f equals CHF and this is a common thing right it'll always be CH something so CHF for a float and we can just call it something like float close brackets and if we look at the bottom here there's nothing there but if we click on create spare parameters over here it'll add one to the bottom and we have this float it doesn't do anything right now but this is useful to know all right okay so let's actually use this ramp now at the moment it's just a spline ramp now a spline ramp is just zero to one right that's all it does so it's not very useful for vectors vectors are generally represented by colors so what we can do is we can actually change how this ramp works if we go up to the top right of this attribute or angle you'll notice this Cog over here this Cog exists for every node right we can click on like the pop net you'll see it up there you can click on this grid see it up there it just defines kind of how this node functions so this attribute or angle we can click over here and we can go edit parameter interface over here you'll see that these are all of the different things on our attribute Wrangle and we can minimize these because you know it makes it seem a bit intimidating like that but this is really all it is right there's some stuff and then we have this color round this is the ramp that we created and if we go over to the right hand side we can set the ramp type to color if we apply and accept it'll turn it from a spline ramp into a color ramp the cool thing is this ramp over here now has some presets right so we can change colors ourselves if we just set it to red or whatever you can see that those points are red initially over here if you set it to like blue right this ramp now represents a vector in the form of colors I'm just going to remove this visualization over here right so now we can see what we're working with okay so what I'm going to do is I'm not going to use this ramp as it is I'm going to click on this Cog over here these are presets so we can set this to whatever we want right something like Inferno or black body I think we'll use black body and then we'll flip it flip it the other way around so what that does is that particle starts out white and as they age over time they move towards the other end of the ramp the way that a ramp works is we have all of these values set up on the ramp but the actual value that it pulls and uses is based on this n age attribute right so this is actually the driving value now remember we said that NH ranges from zero to one as a particle ages so a particle will be white at first because that is zero so when NH is zero we're at the start of our ramp when n age is one we're at the end of our ramp so as the particle ages it moves over to that end over there so a particle starting white and N black we can drag this over and adjust our colors just to make it more interesting something like that okay so if we take a look at this now you'll notice that all of our particles start out white and they hit the ground and they Splash and when they Splash they have these different colors okay so let's go ahead and add a null over here and let's just call this particles out now we have our color however we still learn motion blur and motion blur is actually something that's very easy to set up as long as you have a velocity attribute you can use it to generate motion blur for your camera and fortunately again the pop solver generates velocity if we switch on our display Point Trails over here on the right hand side of our viewport you'll notice that all of them have these trails to them which is really nice because what happens is that is motion right that's what you can use for motion but we can just take that and tell our renderer to use that to Define our motion blur so let's go ahead and do that at the stage level we'll look through our camera we'll play this back a little and as you can see no motion blur if we go to our comma render settings and we go over to the camera effects tab you'll see that there's motion blur the type of motion blur that we want to use is velocity blur because we're using it based on attribute oftentimes motion blur will be figured out just by how much an object moves but if we have an attribute like velocity we can tell it use the attribute so let's just use the velocity attribute and you'll see that all of them get blurred okay they don't really look like Sparks so this is where we're going to have to start looking at materials let's go ahead and drop a material Library over here we can drop a material library and after our sub import we can plug it in over there this material Library allows us to just create some materials it's like a material network but we're now putting it in the stage level so over here double click on your material Network go ahead and drop a principled Shader and we can just call this Sparks what we're going to do is we're not going to use an Albedo multiplier so we don't actually want a base color what we actually want is an emission color so we can go down to the bottom set our emission intensity to 1. and then we can tell it to use the point color right now what this does is the same thing as when we use Point color on our base color right so it's just using that CD attribute but now it's using it for emission so I emission intensity is one and the color of our emission is whatever the point card is CD to assign that all we have to do is auto the full materials and then assign them to some geometry so the geometry that we want to assign it to is whatever's being brought in by the sub import okay so what are our Sparks called let's go ahead and switch to the Solaris viewport so that we have access to this in the bottom left over here so our scene graph and over here you'll see that we have render cameras materials and sub import one sub import one is actually what our particles are called at the moment you can see if we select them they get highlighted if we hide them they disappear the reason it's called sub import one is because when we import using a sub-import node it names whatever we're bringing in dollar OS dollar OS is a piece of code similar to dollar hip that we spoke about not so long ago where dollar hip is where your file is saved dollar OS represents the name of this node right so whatever node you use dollar OS on it will fetch the name of the node so all it's doing is it's fetching the name of sub import 1 and using it for import path prefix so if we change this name to Sparks you'll notice that the name in our scene graph view changes this box as well so now in our material Library all we have to do is save forward slash starts Okay cool so let's go ahead and look at it through our camera again switch on our viewport switch to our comma View and just like that we now have some Sparks the other thing that I'm going to do over here is just add a ground plane right we want these to kind of reflect off of something so let's go ahead and add a grid and you can also create this at the top low right you don't have to be creating it at the stage level but it's easy so I'm just going to do it over here we're going to merge it in just like this and once again notice on this node that uses dollar OS if I set my display flag over here you'll see grid 1. if I change it to something like ground it'll change over there this is extremely useful to avoid naming conflicts because by default when you have multiple nodes like this they can't have the same name so let's make sure that we don't have any conflicts of name that's why dollar OS is such a useful thing to use it might seem like kind of silly if you haven't used Houdini before you're like why is it using this weird piece of code to generate names that's why it's because you can have multiple different nodes but never a conflicting name so it's always perfect for referencing Okay cool so we're going to merge that in over there and on our material Library we can dive inside drop another principle Shader this one you can just call ground and what we'll do with this one is we'll just set its Base called let's see black and we'll drop its roughness to about 0.1 okay if we go up a level on our material Library we can Auto for that material once again we can say forward slash ground that's where we want it assigned perfect now switch.com or render settings and look at that right we have our particles reflecting off the ground and we can actually hide the background or make it dark so that we can see what we have a little bit more clearly and as you can see we now have a pretty nice looking effect we have these particles that are falling from the sky and they're kind of hitting the ground and splashing and it looks pretty nice um what I would do is maybe decrease the size of these so we can go back up to the object level Intel Sparks and over here we can just reduce this right so this p-scale of 0.01 let's just reduce that to 0.05 so half the size it was back to stage that looks pretty good and so we can adjust our camera slightly so that the angle is nicer and if you happen to have some clipping on your camera like you do over here where an object is too close to your camera so it's getting cut off you can go to the view Tab and over here we have a clipping range right so this is the near clipping and that's the far clipping so if we reduce the clipping range for near to zero you won't have any of that clipping anymore okay so over on the sampling tab we have some other options that are kind of interesting we have Focus distance Focus distance we can use for adding Shadow depth of field which would be really nice for something like this so let's skip a little bit ahead this is currently not blurred by depth of field and we can view this if we just disable our motion blur just so that we can see them as just these particles let's try and work with our depth of field so for depth of field to work you have to activate your f-stop right so f-stop of let's do 1.4 that's pretty shallow right so you're going to end up with this really nice bouquet effect where everything is getting blurred however we want to adjust where our focal point is currently it's 4.2 meters away so to adjust it we can go over to our camera switch to the transform handles right so once you have your transform handle selected shift plus F will toggle the focal plane so you can now adjust that focal plane if you press shift F again it'll now make it opaque so that you can see exactly where it is and then shift plus click for wherever you want it to be placed so if you wanted placed over here you can see how that looks and then shift F to switch that off that's pretty good we can adjust our f-stop cool so just so you know how this works the lower your f-stop the more blurring you get but if your f-stop is zero it treats it as if it's deactivated so an f-stop with like 0.1 is super super low and everything gets really blurry an f-stop of like 10 you won't notice much blurring at all an f-stop of like 2.3 is generally a pretty good range so that looks pretty nice and then all we have to do is switch our motion blur back on just like that and switch off display flag and there we have it we have particles that now have motion blur we have depth of field we have everything right so we can have this nice little spark effect going and you can play around with this so what I'm going to do on my side is just make a few minor adjustments tweak it a little bit until I'm happy with the effect and then what I'll do is I'll render it out and make a few adjustments with some post-processing maybe in some compositing software and then I'll have it put up over here for you so you can see what it looks like when it's done and you can end up with the exact same results with what you have over here as what you're seeing over here so I hope that this was helpful and just a quick refresher if you want to render it yourself go over see this last node over here you can say render specified frame range and you can set the range that you want to render and this is defined by the length of your timeline so if you change this final value over here to something like 120 you'll notice that changes to 120 over there so it's just clipping to the actual full length of your timeline and so this can be whatever range you want right 96. 140 whatever and we'll change the value over there and render that number of frames once you're happy with it you can just say render to disk it'll all be rendered to disk based on the path given by the comma settings so over here your output picture dollar hip that's where this file is saved in a folder that it creates called render forward slash the name of this file dot the name of this node dot the frame number dot exr so that will render out the full sequence for you if you'd like to right so if you need a refresher on how to render remember just to check out the previous rendering parts that we did that should answer any questions that you may have if there's anything that I didn't answer in this tutorial series thus far feel free to leave a comment um I'll be as active as I can in the comments just if you have any questions at all leave it in the comments I'll get to them but that's it that brings us to the end of this part feel free to play around with us you're gonna change the color of the Sparks you can change camera angles you can change the thing that it's falling on you can change your emitter you can change what it's impacting right you don't have to use a ground plane if you want to do something cool you can use like a static collider um mess around with those things right use some other knowledge that you may have to add to this and feel free to tag me on Instagram that would be at nine underscore between and I'll check out all of you guys work over there but yeah if you enjoyed this um please remember to like subscribe and maybe join if you really like this it really helps us out so thanks for watching I'll see you next time bye