Applied Houdini Volumes I version 2.0 - Fundamentals

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to applied Houdini volumes one fundamentals in this class we're going to talk about what volumetric simulations are and how they work including what voxels are what vectors are what velocity fields are basically all the nuts and bolts of really understanding what's going on in a simulation rather than just relying on presets to get you to something I want you to understand what's going on behind the scenes so that you can make production quality effects more easily and more confidently and at the end of the lesson we'll end up with the bunch of smoke in the shape of a pig head and moving around like you can see here so without further ado let's go get started all right let's get started moving volumes around in Houdini first things first is we want to set up our project the project is not the file itself the project is just the kind of directory on your desk we'll call it something volumes one and for me version two this did this two years ago and now we're doing it again even better so here it is so you can see it's gonna create this directory on your disk it's going to make all these sub directories that are just for organizations sake this is not the actual Houdini file itself which is the hip file say file save as and click job that will bring us to this variable this dollar sign thing is a variable and that refers to that director that we just made so again the project area so volumes one dot there and I'll just increment the zero as we save things or maybe I won't I should but I probably won't so good so we have the file say via the project setup let us now set up the bare bones of what we're even trying to do and here is a network view when we're going to draw our nodes down here by pressing tab and starting to type something like pig and you'll see test geometry pig head and there it is and what this does is it creates actually a generic geometry node any geometry in our case polygons you probably know what polygons are but maybe you don't polygons are these little flat squares or really triangles there's two triangles for each one of these squares you see and they come together to form the shell of a piece of geometry so hence this is called the geometry node and inside of it we have more nodes that generate the geometry itself so again this is a container that has a position in space it can rotate whatever's inside of it or move it with translate it looked like it was getting bigger really it was coming at the camera you can see translating it changes it there so and the actual thing that made the polygons was this this pig head thing here there's a few different difficulties on it difficulty only really means like a hard difficulty means that this thing is hollow some tools don't work well with hollow pieces of geometry medium means that it is now sealed but it's still kind of high-res and has textures on it you can see the pig skin and everything else and low or easy rather is super simplified and no textures and it's sealed for our purposes we'll just keep it on medium so there it is I'm going to jump back out to the main scene by pressing the object area the object area stores all of our objects this one right now is our pig head and by holding the spacebar and right clicking to zoom in and out middle click to pan and left-click to rotate all with the spacebar we can move our camera into some kind of position where we will see the pig head framed in a nice way and under the lights and cameras tab here press ctrl on your keyboard and click on camera and you can see now we have we're looking through a camera and there it is it was created here also in the object area the camera has a translation and a rotation based on where our perspective was before we control clicked it now I find there's still too much space maybe or I want to change it if I try to move the camera again by holding down space and let's say zooming out I'll actually pop out of the camera and there it is left behind Kirk Cameron but uh is that right Kirk Cameron I'm not sure anyway I'm back in it now by clicking on this and choosing our camera again if I want to move the camera and have it actually update our camera camera click on the lock and now you can see it is updating the parameters here for us now why am i why did I create a camera when there's already internet off again when we're already in a camera out here because we need to designate an actual permanent camera when we're going to render this when we're gonna actually create images final images we need to have a permanently dedicated camera for that so I'm actually gonna move this a little bit more over here obviously can always move this later but that's enough for now so one more thing I'd like to do in terms of setting up the scene is we have our network editor here with our nodes and we have the related parameters here if I make this bigger and click on this little arrow up here split pane left and right like so for both now we have two sets of them so now what I want to be able to do is I want to be able to have two different nodes as parameters visible any given time or maybe I want to be inside this node here but still back in the main scene here so now we've almost done that by setting up the two columns but we can do better by actually clicking on this tack holding and changing these two ones and these twos basically what this is doing is as you might have guessed the 2's are associated with each other and the ones are associated each other so I can click on the camera here I click on that geometry here I could even just be inside of it here where I'm inside the test shot which you pick out here but still at the object level here whatever I click last will be what it shows up over here we could also peg this to one or two or whatever but I like keeping it on the last selected note by default great so we are set up and ready to go okay so right now this note is called test geometry pig head I'm going to rename it to the source because of course the the purpose of this lesson is to make a volume simulation so we're gonna create a volume put it into the simulation where it will move around and then we will render that into final images so again starting with this this is what's going to go into our simulation now these are polygons as I said you can see the individual ones here you can move them around I could isolate it and just look at it forever and it's wonderful isn't it a nice polygon but we don't care this time no polygons so let's go back into the camera what we wanted to do is volumes now one of the many reasons that I'm rear according this lesson is because there's lots of newer better ways of doing things now so the old way we would have done it is with ISO offset to create a volume and I'm not even to talk about it because we're not going to use it vd bees are the name of the game now BD bees are a very specific kind of volume now I haven't even told you what a volume is yet but I'm gonna say VTB a lot so I want you to know that for the purposes of this first lesson VDB and volume are interchangeable VDB from polygons as I said this for polygons is going to create a volume a BTB from the polygons so connect the output of that to the input of this and then if we click the blue thing here to move our you know this is now what's being evaluated everything leading up to this we have a weird looking pig head this is a certain kind of volume that we're going to talk about a lot later comes up quite a bit in effects and it's called a surface B DB or a distance V DB or more commonly known as a signed distance field we don't care turn it off turn this on fog beauty baby now we have and kind of almost see a pig head in there almost if I click on this pink if I hover over this and click on this kind of pinkish looking one I'll see the outline of this note so you can kind of see the fog as it were the kind of line that we're doing is kind of in there if I were to make the voxels well I didn't say box loads this is a good time as any to talk about what foxes are what volumes are so save it and just follow along I'm going to show you something I already made these in advance so what are voxels polygons are flat little things that make up the shell of something but voxels are chunks are actual like cubes inside of an object so it's pretty easy to conceptualize if we think about pictures first pictures have pixels we know that a picture is made up of lots of little squares and together they have color stored in each one and more and more and more and more of them we have it forms up an image eventually oops they do that so what I'm demonstrating here is when we only have four by four pixels each square is a pixel we have apparently I had tallied incorrectly but just to apparently subtract one from that we have more and more resolution the more pixels we have like so until we get to a point where we're happy with it so obviously each of these squares stores data it's storing a color value that's that takes up memory on your computer at a the CPU has to do something per pixel and that takes time so we always the eternal struggle visual effects is defining some kind of balance some kind of balance between we have enough of these things that we can see what we want or that it looks good but we don't want so many that the increase in quality is only a little bit like check this out from right here let's say on 192 where I have 191 rows on each side I have 36,000 bits of data individual data that need to be stored and if I jump up here and now have 58,000 it's a huge increase but look out look at the difference equality it's not much is it so it just depends we can't if we could have a billion rows and a billion columns to have an infinitely perfect picture and we would but we can't we are limited by the memory of the computer so in practice we need to figure out what's the best trade-off now that's pixels that's for a flat image as you might have guessed by now or maybe not voxels are volume pixels they are simply pixels that have a third dimension there are cubes instead of squares so here's the pig again and you can see it's the same idea except that this time there are three dimensions which means that while the pixels increased to 58,000 pixels by the end of this because it's just flat this is insane because we now have to multiply this number by this number by this third number the Z the depth so it's literally exponential it's an exponential increase every time we double the resolution we are multiplying the total amount by eight because it's two on each access two times two times two is eight so it's really problematic towards the end here again here looks like this looks like something and then if I jump to here this looks like something but look how many more voxels there are from here look how fast it goes up at the end I really just played through you can see how slowly it's going up then it's kind of starting to pick up speed here now and then by the end it's just skyrocketing what so again if we could have infinite resolution we will and maybe someday we will has you know computers are getting more memory and faster CPUs all the time so we'll be able to keep pushing this boundary it's just that again to get double the resolution we need eight times as much memory eight times as much power to push it all around it's not double the memory it's eight times the memory so it's kind of a wall that we're hitting it's any case so that's what foxes are they are areas of space that store something for our volume simulations we're going to be storing whether the object exists there or not how much of it exists there let's say from a scale from zero to one or even beyond and then we're also gonna store the direction the air is moving and how fast it's moving so we're gonna you actually have two different volumes one that stores the presence of the smoke because it's gonna be a smoke scent and one that stores the speed and direction which together is called the velocity so that's voxels so we know what boxes are more or less and now I wanted to show you this is what they will look like in our viewport in in a real sense this is the fog like we were starting to make in our scene again just follow along with me or just watch don't don't actually follow along your scene so here is a fog pick you can see if we can kind of see through it it's a fog it's there's values being stored here and what are those values so I made a little sampler thing here density is what we refer to the value stored at any given voxel now remember there are a lot of voxels here and that's why it looks like that you know if there were less voxels you can kind of see the cubes a little easier but as I increase this here in my arbitrary scene this is just the timeline don't that this is normally what this does this is just what frame were on I've tied the amount of voxels to what frame room in a case so I made a little sampler thing here and as they moved through space it's saying how much density is where my sphere is those it move it in you can see along the border there's not quite one and then once we're inside the density is one at any given voxel that we're asking for it's a zero out here it's one where there is a voxel that we can actually see and then sometimes there'll be like a value in between that so you can see right here on the edge Oh point 24 apparently there's kind of a transitional area where it's not quite zero it's not quite fully opaque it's not quite nothing again density can be higher than one but for the sake of our purposes one will be the opaque area here so that is that now that is storing again the presence of smoke how much smoke is at a given box all now we can also store direction and speed and those are called vectors a vector is simply a direction meaning point this far in the X direction left the right let's say this far in the Y direction up to down and Z in the death sense so it's a little arrow essentially it's a little arrow that's points in a direction and depending on how long the arrow is is how fast it is now this is what velocity is in math in general it's a direction and a speed we often in common English think of velocity as just being the speed but technically speaking it's also direction so you can see I can move it around and so it's just an arrow I just want to demonstrate that it's an arrow that can point in different directions and that's pretty much it it's x y&z value much like a point in space like where the sample is is at some location x y&z a vector is also three values except that's not denoting a point in space it's pointing it's denoting a direction in space now in this example my arrow is only ever one unit long meaning if you were to measure from the base to the tip it would be one unit so you can kind of see that here we're pointing straight up and down Y is pretty much 1 and X is pretty much zero and zero now again these arrows can be longer than that to incorporate a speed element a arrow that is three times as tall will denotes a air that is moving three times as fast as the one that is only one unit vector long so let's combine these two concepts turn all that off we have here I move back into my 2d camera for this here is a come on here is a grid of voxels these squares all these squares and you can see we have vectors in each one and obviously they're not the same from square to square you can see that they are all similar to each other so they kind of change direction over space that is characteristic of the way air moves typically you don't have one cell that says the win discrete area of air that is pointing the opposite direction as another one that's called divergence and that is something that we are trying to not have and we're doing simulations any kind of fluid simulation that's what is doing for us the kind people who wrote the smoke Sims the main job they have is to prevent that from happening we want these kind of smooth flows so in any case this is called a vector field meaning it's not just one it is many of them and they take up space now we're looking at it as if it's a 2d slice right now but it's you know just imagine there's depth also so what does this all mean why do I have all these little red dots well the red dots will show you how they have a position and they're gonna want to slide along the arrows and go the directions they're going that's the point of a affection affection is a term that simply means to move along a velocity field so as I moved forward you can see these points up here are kind of doing that kind of curve here these points here are going to the left here and so on they are just kind of sliding along this velocity field so I hope you are seeing how we're combining these concepts together now where we have discrete cells of air which were called voxels the voxels are storing data in this case the direction the wind is the air is moving in and now as that data is represented as vectors so vectors and a vector field are moving these points around now this is a smoke sim and we've been talking endlessly about the density that is also stored so for the last one here it is again actually I got to keep that on here is density imagine this is the pig head but these are just some spheres of fog they move in the exact same way a little slower though apparently but they move this whole same way the particles are just to kind of give you an eye an easier way to understand how specific positions are moved along a velocity field the fog the density values are moved the exact same way so that is how if we can make some kind of velocity field through various means that we'll get into in a moment we can then move our density aka the fog along there to create an interesting simulated effect now technically speaking oh it's gotten to get a little bit more into the weeds the velocity field as you can see is not moving it's just staying in reality in a simulation not only does the density move along the velocity field the velocity field itself is advective through the velocity field so I didn't make a demonstration of that but it's a little more advanced the idea simply is these data this vector data moves too much again the same way if you imagine you sneeze first there is speed right outside of your mouth then a moment later there's the wind further from your mouth is also moving and so on the the speed itself moves through space so but again I didn't I didn't make that here but I think you get the idea I'm very proud of these little demo so I really hope you like them main reason why I wanted to rerecord this lesson so thought these came out pretty good cool so let's get back to the actual project alright so here we are again very cool so that's what we were doing here we were with the VDP from polygons we were creating the density volume which we could kind of see here now we can see it easier right now there's not that many voxels as what I should say if you middle click and hold on this you can see there's only 19 by 19 by 22 voxels with a pitiful 2,000 voxels which is pretty much why it looks like a blob that we can barely see now we can create that we can make that have more voxels by for example if I reduce this by half there will be 8 times as many again they'll be twice as many on every access I could reduce it again now it's starting to fill it up more and we can really start to see it now that thin areas like these ears are always gonna be kind of translucent because you know we're looking through many cells of voxels going away from the camera which builds up this opaque nature of it but you know it's not looking too bad in fact it might be a little easier to see though if we make the background be black so I'm gonna first D in the viewport to bring up the display options if you click background you can change color schemes to dark if you're not already doing that so now we can kind of see it a little bit easier I'm also gonna turn off this ground grid here by clicking this and finally I'm gonna turn off this template thing I don't want to see that anymore so you can see we do have that if I middle click and hold be very careful with this another click and hold if I change these values a little bit and move it up you can see I can change the values on the fly like that if you make it too small again you're gonna run out of memory so be careful or at least your computer will freeze up for a little while while it tries to calculate how many foxes it needs but again this is just to demonstrate that the smaller the voxel size the more voxels there are because this fixed distance or area is being divided if each of each voxel is smaller and smaller there'll be more and more and with there's more and more we get it to be denser and denser densely packed so there you go so now we have the the pighead proper you can actually get some lighting into it I come back out here to the to the main area I can click skylight there's two it makes two nodes that I won't really get into too much basically it makes a Sun here it makes a skylight which is this whole environmental thing here I'm going to turn off enable light in viewport so that we can still see it look black but now we actually have some shadows which is nice if I turned off the sunlight you can see we lose the shadows but now we have some shadows it helps to see a little bit better wonderful so there you go we got a nice pig head the last thing we want to do before we actually move on to the simulation itself is let's go in here and drop down a null and no literally does nothing hence the name but it's a nice little marker to point to our simulation is going to ask for a node to load into itself and we don't want to like point to this because we'll be pointing to this and then we decided to like actually should move it later and like rotate or something you know if the simulation is looking at this it's not going to see anything that happens after that so typically what we do is we make a null that says this is just some generic whatever and anything that happens before it will be considered now and we're not going to actually do that but there you go something else I wanted to point out is the idea of takes you can see we already have this take list tab here but if you don't have that for some reason you can always go to plus new pane tab type take list and then there you go takes our collections of overrides right now we have you know various nodes with various settings on them but we can make store a collection of overrides so right now let's consider when we're in the main take which is the default take that we're in let's say low quality mode so I'm gonna say this can be here low quality boo look how little quality that is gross but then if we go into take list I can say add take double click on that call it HQ and an HQ mode I can say see now I can't change anything but if a right click and hold here and say include intake I could change this to something else so now this node or this parameter rather is active and you can see it here in the take list HQ mode now consists of this specific para parameter being set to this specific number if I go back to main you can see it went back to the original point 0 point yes point zero five you can also do it up here that's what this is quit HQ it goes into high quality mode now I can just work in low quality mode which will be easier on my computer's memory and the CPU and then when I'm ready to do something crazy overnight let's say like I might run a simulation that takes eight hours all that it takes eight hours because it needed a lot of memory and CPU stuff and I don't want to deal with that while I'm working here not when I can just easily work on a low quality version and just switch it over to the high quality version when I don't need to use my computer so I'm just gonna say that go back to that for now so that's another little convenient workflow tip for you there and now with all that set up we will get started with the simulation itself so if we're get into the simulation itself one more thing to setup in the scene might be a ground plane so come back out and here to the object area tab and make grit I grid here a grater is really just a plane a flat plane here on the ground um I'll call it round to that effect by default it's centered at Y is zero there you go but it's kind of our our pig head is kind of just sliced there so I'm gonna say we do is let's let's raise up the pig head so let's go in here in the source let's make sure that we can see everything else here and let's move this up so I'm gonna say middle click and drag it up right now it's this probably right I want it to be just you know hovering above the ground my hope is that when we run the simulation you know it'll well apply some turbulent velocity to move the smoke around but maybe some of it will hit the ground and kind of like push against it or something that might be nice so now we've moved everything we need to update our camera also so go back into your camera click on the lock move it up to here or something like that no no it doesn't really matter but just give us enough space that we can we will see it hit the ground maybe and we can also see it go up so again we'd always update that later again - let's also have the back because we're gonna render all this we're gonna run into the ground plane I want it to kind of curl in the back let's rotate it a little bit like so maybe move it over a little bit and then I'm gonna go into it by double-clicking on it I'm gonna press ask for selection mode which is this arrow here when I press two for point mode which you can do from here you can see points us too and now I'm then I'm selecting points I can just click and drag over them I can press T to translate them up like so I'm going to come back into my camera here this is the renderable area again just this not this grayed out stuff on the top and bottom so once I get out here I'm okay so now I have like a nice little backdrop and I'm going to change primitive type to NURBS I'm not gonna explain what NURBS are except to say that they are like it's a curvy kind of surface that's defined by these points instead of the very literal points of a polygon NURBS are like well you know try to hit these points but don't worry if you don't so there you go kind of a curve you look to it great save that and there we go I'll just hide it for now but we know that it's there and there you go so now we're all set up ready for a simulation you know right so to make our simulation we need to press tab here and say top Network tops our dynamics operators everything up until now inside here in the geometry land when we're inside of these geometry nodes they're called surface operators also known as tops now surface operator makes sense for this because this is literally a surface a hard surface why are volumes called service operators well volumes can technically represent services even though this one doesn't really it's a you know thick cloud doesn't really have a surface but that's the way it is so that's the way it so deal with it now moving on here we have dynamics operators which are not building up any kind of geometry or volume but they are instead running some kind of simulation the simulators themselves are called solvers and here we see all kinds of solvers there's rigidbody solvers liquid solvers smoke blah blah blah and we want the smoke one which is actually you will see a smoke solver don't use that use the Pyrus our pyro solver basically includes the smoke solver but adds a lot more functionality to it and even though we're not gonna do anything with fire okay pyro we might as well just get used to the fact that we're gonna use the pyro solver in every you know ensuing lesson here so there it is so there's the pyro solver which is literally the mechanism or the engine that moves the data around now the data itself is stored in a different node called the smoke object you think it'd be called the pyro object but it's not so there it is there's so this is a container that will store our various volumes it's gonna store our density volume our velocity volume and many other things besides that only the solver cares about that we don't really need to know but this is storing the data this is acting on the data and changing it and then this output much like that null from before it's kind of just a marker that says this is the end it also can you can cache files out with it but we're not going to so there you go now first thing we need to do is change the shape of this we want this is going to be the air the container that stores where the simulation is so we need to find some kind of bounding thing like this that's will pretty well will accurately capture what we're trying to do so make sure there's a show all objects which apparently it is let's turn our pig head back on so we can see it now it's not in the simulation yet just because we can see it but we do need to you know control the bounds of this so that we have we off you have to at least capture it but we also want to have more space around it besides so that it can move around from here so it's not even capturing it there so something like that it's probably still too big I'm gonna say first things first we're however tall it is let's make the center be right in the middle of that so go to right click and hold on this and go to copy parameter these are called parameters and go right down to this one here below it and say paste relative references we now have a little expression aka a bit of a script that says instead of typing a number in here literally just look at the number from the other parameter and I want to do that because I actually only want half of that half of that number will Center this whole box right on the ground so this is y equals 0 is going to be the bottom plane of this box because if this is 0 and the center is 1.25 and 2 times that is 2.5 which is the size the whole thing is resting on the ground you could also just type 1.25 there if you wanted but this is this is convenient because now as I change this you can see it stays resting on the ground no matter how high it gets and I want that because I want a closed boundary I want the negative Y to be the only one that's checked on that means that it will automatically collide with the ground and again we have a ground when we render it I want to see the smoke hit the ground and maybe roll off of it or something like that this is a very cheap and easy kind of collision to do it's fast for the solver and it will you know make it look interesting anyway so as far as the size goes you know the bigger we make the domain like I said earlier the more voxels the simulation also has voxels it's not just our source our source populates voxels with starting values which is you know the density or the pighead is but then they will move out into the simulation which is also storing the current density and the current velocity so the same thing applies to the simulation the more resolution the more boxes we have the slower it's going to run and the more memory it's going to take so let's try if I don't anticipate that it's gonna fly all the way over to here then there's really no reason for me to have it be this wide so instead of five wide let's make it four wide and similarly from front to back we don't with the same thing applies so we can make that four also and that's probably fine so good that's a zero these out too for the sake of it making it easier to follow on at home it's there something like that so save that now again this smoke still doesn't actually exist in the simulation yet we've just used it as a reference to set up what we were doing to actually source it in go to the smoke object initial data seats density SOT path and make this a little bigger for a moment we can either look for it by clicking on this button and saying uh well here's the source and there's that source null that we made or what a nice thing is if I had that open over here I can actually literally click and drag this to here so now you can see in our simulation there it is remember when we clicked on this we were still seeing this node now we click this now we're it back in the simulation again we could at this point probably just permanently link this view to this that way if I click here by accident I don't accidentally not look at the simulation so there you go so now we literally have it here if we press play it will literally run I mean you've now made your first simulation I hope you enjoyed apply Houdini volumes 1 make a big head disappear and that would be a terrible lesson so let's keep going one thing we want to do is we need to determine the resolution of the simulation right now we have a division size of point two now over here we had a division size of point zero five so the incoming density is actually much higher resolution because of ah are smaller than our simulation you can see if I were to match that like so now we're actually seeing it better now if I were to overshoot this like so we're not gonna see much improvement because this is already the incoming volume itself was this resolution because I have a higher resolution my simulation that's fine that will help maybe with the velocities as it moves around but the pig head will be just as let's say coarse or chunky so let's at least for a second go back to that I also want to take a moment to multiply the incoming density by some number Here I am multiplying it by 10 it's a lot easier to see now now it is actually changing the values the density values are literally 10 times larger now but because of that they are more opaque they're harder because there's more density basically it's like thicker smoke it's harder to see through and that is I think desirable in this case so now let's make our simulation work a little bit more dynamically for us right now we're doing everything in terms of the size of the foxes themselves that can be a little unintuitive what I often like to do is instead of doing it by size let's do a division by max axis so right that means let's just let's just denote how many voxels for me I'm usually comfortable running a sim like developing a simulation on my computer when there are 300 foxes across the largest axis and then when I want to do my high quality one later on I'll do 600 so let's do that let's say let's go into the high quality mode and include this and say when we're gonna do our actual sim let's do 600 and let's go back to the main here now the simulation is 300 voxels wide now I don't know how big is that like how large are those individual voxels themselves well the max Axess these are the axes here XY and Z apparently 4 is the maximum access both the X and the Z are that number so technically speaking we could easily figure that out or we can say 4 divided by 300 voxels point 0 1 so you can see again the incoming size of the voxel is too big in fact it's much too big let's dynamically have this number reflect the optimal size so let's do that calculation on the fly that we just did so I'm gonna copy parameter which is the max Axess am I gonna say paste absolute references we did relative before I'm gonna say absolute now there won't be any dot dot slash stuff like this which is like a UNIX style thing that I won't get into so now the vom size is 4 which is huge we don't want that we wanted to say 4 divided by how many voxels there are so copy this one - copy parameter go over to here go to the end of the line say divided by and now do paste absolute references now if I click on this we should see it that should evaluate to the number that we just saw point 0 1 3 3 3 or whatever if I middle click on that we can see it's it's a hundred and 50 voxels approximately on each access and this is 300 voxels that's still correct because remember there are many more voxels besides that in the scene it's not just either original source it's also all this extra space and if we change it to high quality we can see I'll actually need to do so this is important that we did that test right now this is still overriding it so while we now have this cool expression here in HQ mode let's get rid of that to do that we can right click and hold here and say exclude from take now we'll go back to not being a come on I don't know why it's not doing it just go here instead and find it V DB from polygon just delete it there that was weird oh well anyway now it is even smaller see that number in there if I go to the main you can see it's it's double it so now on the fly we get to do that so that's pretty cool I can switch back and forth between main and HQ so there is our simulation if I were to run it again it's slower than it was before but you know it's not bad it's still just disappearing though so let's do something more interesting than that okay so here we are again as I was just playing you know it's going a little slowly if you were fortunate person and you have a really nice graphics card we can speed this up considerably if you go to the pyro solver and go to advanced turn on use OpenCL OpenCL is a language that allows you to run these operations on the graphics card instead and look how much faster it is now significantly faster this is limited by the memory on your graphics card so you know as we the 300 might work but if I go to HQ I might run out of memory or something I don't know I'm not even sure as you can see it's up so you look at that this means basically that I ran out of memory and I have an 11 gigabyte card as of the recording of this so it's often not possible to take full advantage of that so you know maybe by the time you're watching this you'll have a crazy guy whose card that I don't have or maybe you already do who knows I'm gonna turn this off but that's what that's for watch out for that in fact I'll turn this on here and then in the HQ mode I will to include this in to take and turn it off how about that see fancy so now we can take advantage of it while we are in front of the computer and although the results of the sim might be a little bit different because it will be running a different kind of instruction set I mean for our purposes it's probably fine won't be that much different awesome save so there we go now let's actually add a velocity to it let's actually have it do something for once so go to the pyro solver go to shape in later lessons we were actually not going to use these these are built-in forces that are just kind of there for convenience we can make much more complicated ones or at least access these in a way that we have more control but again for an instructor lesson they're fine we'll keep dissipation where you will make it less dissipation is what's making it disappear in fact if I turned it off entirely you'll see nothing really happens simulation is running but there's there are no forces acting on it nothing is making it disappear so nothing happens so dissipation I've reduced 2.05 turbulence will actually finally add a velocity force to it that will move it around or does it because by default we have where are you it's trying to act on the temperature which is yet another field we talk about density there's the vel which is velocity and you can see all these fields I should mention if you middle click and hold on this we can see we have a density field right now let's have the turbulence act on the density and not temperature temperature would be good if we were doing a you know fire explosion one but we're not so finally we see spooky ghosts so that's something and now you can see this blue bar here is how much cash we have in memory right now so we can scrub it easily it's not resetting it right now but once it gets to the end of this bar it has to simulate it that's pretty cool occurs to me that our scene is 240 frames long I don't want to run this for 240 frames so click on this button all in the bottom left here let's change it to something much more reason like 72 and well if you ever want to you can see how we are I'm reaching the end of my cache so now all the earlier frames are being discarded so if I try to go back to them they don't exist that's no good let's use a flipbook to just take a snapshot of every frame that we can then look at you can click and hold and go to flipbook with new settings and they're all probably the defaults are probably all fine I'm just gonna say do it so we'll get as you can see here if you're used to Maya they would call it's a playblast but essentially this is just a image player that comes with Houdini that is storing a snapshot of each of these frames so you can press play and have it do that over and over again while it actually loads it up and that's something this is convenient because I can walk away come back and see like oh is dissipation still too high is there gonna be any smoke left by the end of the frame range maybe the turbulence is too high or something I don't know you know right now it looks all grainy and weird but that's just because it's in our viewport it will actually render much nicer which we'll do soon but this is this is looking pretty cool I'm not gonna change it really from here so I'm just gonna close this and not wait for the rest of it so come back to here I want to demonstrate though let's actually do a few frames again if I middle click and hold on this now you'll see there is a vel filled velocity that's what we talked about earlier in a lesson those are the cells that store the vectors that determine the direction of the air pressure is that thing I also alluded to a little bit where I talked about how the velocity field vectors should all kind of like blend into each other in terms of the direction are going and shouldn't be like pointing away from each other that again is called divergence and this pressure field is something the solver figures out to make ensure that the velocity flows nicely that's based on something called navier-stokes equations which you can look up if you want to have blood pour out of your eyes and yours so we don't want to do that but we do want to just least see the velocity field so click on the smoke object go to guides you can see by default the density guide is on if it wasn't we wouldn't see anything it would still be happening it'll still be but we won't see anything let's go to velocity here and check out this check this out I should say whoa crazy these are velocities these are velocities being charted over I believe one second so if you started at the base of one of them and followed them it shows where the smoke would move starting at that voxel over a second now the you know if the velocity field didn't change otherwise it's kind of hard to see this there's so many there's one per voxel and there is apparently 17 million of them now it's only showing us one slice as you can see we can we can modify all kinds of behavior for this thing so click on the vel really it's post velocity guide and you can see we can change where the plane is by changing this slider you can see how slow that is because it's trying to ask them draw all those lines just keep it at the default of zero one really nice thing you can do now is override divisions we don't need a one of these for every single voxel so if we override it now there's only ten on each axis which is probably not nearly enough so I'm gonna say like fifty maybe cool and now again now it's much faster so that's pretty cool let's let's see what that looks like let's do a play blast so calling a playlist I've been using hoody since Houdini ten and I still call it play blast yeah alright so there it is and we get these are awesome velocity field things moving around like that so this is because of the turbulence the turbulence is adding all this whirly windy business and those velocity fields again are moving the density along with it and that's how we end up with this cool crazy dance here so I'm sure you're convinced seems to work you can see how some of the smoke is hitting the ground you can see right there it's pushing against it very slightly and subtly oh maybe this plume will reach it looks like it's just about to disappear no it kind of hits it yeah it definitely it's it cool so we got our first collision - so that's something save that we're basically done with the simulation and obviously as we'll talk in the next lesson about how to make a much more interesting simulation but for now I'm gonna say make one more geometry node here we go we'll just call it output turn these off so output will get the data from the simulation right now it's just living inside of this simulation box we need to retrieve it so say dot import fields point to that simulation the top net itself the object is this one if we middle click and hold again it's called smoke object one the smoke object one is the container that contains these sub datas pressure data velocity data density data this is the object these are the sub datas so with that in mind the default object is that one the smoke object one you can also just use wildcards I can never remember what it's called so I just do like smoke just like just giving anything that starts and smoke then here we ask for this sub data that we want it so density and there it is that's the solved data and now we have it same thing we're not in the simulation right here but because we're asking for data doesn't exist yet it's triggering the simulation in the background to run like so now I'm gonna drop down a note here called a file cache which does kind of what you would expect it's going to literally cache it's gonna save this data to our disk somewhere so I'm just gonna delete all this and say dollar sign job is that project director we set up all the way back in the beginning I'm gonna say slash sim there's just some arbitrary folder I just made up and then we'll call it simulation dot version zero in case we ever do another one which we won't dollar sign F is another variable which simply means the current frame number bgo is Houdini's native file format for storing data geometry data which could be again polygons or points or lines or volumes or whatever and dot SC is this fancier version of it which I won't get into so I middle click on this you'll see the current frame is here version 0.1 bgo they'll click here v-0 dollar sign F Dawson F evaluates the current frame as I scroll through here you'll see the number changes in this way we can simply save the disk and it will do it you can see it skipped all the way to frame 20 because it already had the first 20 in memory so it was easy enough to just pull it from memory and write it straight to the disk for the rest of these you can see it's running the simulation itself I'm gonna interrupt it I want to wait if I click load from disk now and you don't have to turn that off to run the cache you can always have that on I don't know why it's not on by default you can see those are all the cached files that we got to until we ran out and can't find any but there you go cool so there's our cache we'll always have it you can see we lost the blue line but it doesn't matter because now we're just reading these files from the desk and I'll say out just good practice to have a null for all these things save that like so so what will be nice to do now is go into HQ mode and then now walk away from a computer and have it do it cuz this is gonna take longer it's gonna take eight times longer than it was just taking because it's eight times as many voxels you know more or less so what you can do is you can either say save to disk and just have it do it we just saw where it comes up with a little dialog box that shows you it or what can be nice is you can go to save to disk and background once we save the file first say disk and background is convenient if you want to keep working what it will do is it's going to launch a little scheduler thing here and you'll see it and this is a little job it's like having a little render farm on your computer it's running Houdini again as another process on your computer and it will allow us to continue working here so now I can just key I can still just keep going and doing it or else now that computer is slower now because it's still literally doing this in the background but I can keep working at least if I need to do something that let's say I'm not running my simulation here as well while it's running in the background I could continue setting things up and I will so save it and let's let's set up the last bit okay so although I did say save the disk and background I realize that I'm actually gonna need the cache to review and render and everything anyway so I just let it finish could have just done it in the foreground I guess anyway here it is here's our our cache looks pretty cool again obviously to look way better when we're rendering it especially considering that this is the HQ cache that we did to so this will look really nice now one thing I'm realizing though is that it's got a off-center if I go to 40 here I'm gonna say let's go into our camera let's move our cam I don't know how this happened but this will be better so maybe your camera was already good but mine wasn't but now it is maybe so cool now one thing we also want to make sure is you can see that it's getting chopped off here on the top let's hide that it's jumped off because that was the top of our simulation apparently I guess that made sense when it's my old camera position but now that I moved it and he do ensure that I'm not getting any chopped off values there that would look stupid wonderful okay so I think this would be good oh that looks like it's getting chopped off on the right here too it's possible that it's so thin we won't even see it let's just let's just cut to it now let us render this it's in order to render we need to have things to render and what I like to do here is good practice is let's not rely on these nodes which have the things that we want to render but what will be rendered is is whatever these the render flag is set to so if I had changed it to something else like if I put it here by accident you know trying to Reece in right now and I don't want that I wanted to always render this node so again just kind of as a good practice let's make dedicated nodes for this purpose so we'll call this render smoke and I like to make my all of my non-renderable nodes here click on the color thing make them green and they render both ones and make them red it's just a thing I like to do and so what we end up doing here is just import the exact node that we want to here so in our case we can say the output the null here import that into here and that's it so now this node when we render this will always be rendering that the one that we wanted similarly for the sake of completeness we probably don't need to go this far I'm going to just do one for the ground as well so same thing coming here object merge is the note I'm using here which basically says go get something from somewhere else and put it here so here's an out node on our ground plane put it here and now we have it we need to transform into this object or else we won't get the transform values from here as you saw it didn't work and it looks like it's a little bit off screen here let's move that like that let's move it over a little bit I didn't want that little gap that we saw there okay so there it is so we have our two render nodes although let's make it read really just have this view wider here so I have to keep resizing these we got those we got lights we've got camera we literally have action and what we don't have now are is a render we don't have a render node mantra like so and what we want this to do is say render the frame range out once in 72 go to objects to tell it what to render right now it's gonna try to render anything that's turned on we don't want to do that we want to only render under force objects any object that starts with our NDR which again are these two so RDR underscore asterisk will find these nodes and if you're not sure you can click this and you'll see that they're highlighted so that's kind of cool so it's going to render those it's going to use any light that it can find which is fine we're not ever gonna have lights that we don't need at least not in this lesson the camera is the one that it finds here cam one so that's set to and we could go to render view right now and click render and this will give us a kind of quick lower quality approximation of what we're see in the final render you know zoom out here a little bit so we're getting somewhere we have a thing we have the pig head here in all of its density glory we could click to any other frame like this and it will automatically render it so it's gonna load that cache you can see it's dissipated pretty well by now maybe yeah we'll go back a little bit it's one thing I think we can do to help this is let's make let's go the material palette here which again if you don't have it click the plus and then go find it like so we want a material for our smoke I also click pause on here so this doesn't keep happening let's go get a basic smoke because that's what we're doing here and let's also make a principal shader so that we can add color to the ground so to apply those materials render smoke you can see under the render tab there's a material so simply put the under the mat area mat for materials put the smoke there and for the ground same thing for the principal shader here you can go to here and click on these although I find as it is doing now there's something buggy about this where it says two nodes selected I don't know why it's just that if you come here and go to the mat area instead we can click on them specifically so let us render let's have it start over again and let's see what we have now with our two new materials one thing I know is going to happen is that the principal shader by default has reflectivity turned on which is not really what we want so you can see it's super shiny we're getting this crazy blowout light here let's go to the principal shaders surface area turned reflectivity down to zero we don't need that the basic smoke looks a little bit better now this is using the actual I mentioned pyro solver before is the pyre shader this is literally made for you know rendering smoke so it looks kind of nice by default let's take the principal shader here for the ground let's it kind of blends in with the smoke too much right now so let's find a color I'm gonna click this orange thing here that's too crazy let's make it this is like kind of like a mustardy sandstone look maybe to it I just want to have some nice color to make it and then a have it not be so gray I want the I want the smoke to pop off of that cool so that is looking good again we can just like we can click onto any other frame if we want to see what it looks like on those frames we can also mess with the smoke itself like let's say if you thought that it was too dense you know we multiplied the incoming density into the simulation before by 10 but you can also just do it here after the fact I can multiply it by another 10 and you'll see it's gonna get way more dense now which I don't know it's it's interesting I don't know that it's the look that we want necessarily but uh it's sick it looks like lint now I lost I'm probably gonna leave it how it was so we'll go back to revert to defaults back down to 1 so that's cool we can even change the color of smoke if we wanted to you could change it to blue that might be weird if I tend to find that the colorized smoke doesn't really look very good nothing wrong with Houdini or mantra' I just think that it looks bizarre no this kinda looks okay maybe I'll keep it like that and after all that that looks weird to me looks better when it dissipates I don't know not really if the way it was so once again I'm just gonna click right click here and go to revert to defaults something like that just keep it looking like smoke was that even the default color I don't think it was I'm a control Z it back to where was how it was white okay so there you go it's done that's it and all we need to do is actually render this out so I'm gonna stop it here this is again that's just the preview mode save this again we can render it here going to render to disk it will save it to whatever you have specified here this the default is probably fine it's gonna say there's an e XR file which is good that's the kind of the industry standard file format the dollar sign f4 means that we use the frame the current frame number but we'll padded to four digits so you see we have two zeros in front that can be helpful for some compositing programs to read it into hip name is of course the name of the hip file which is this so as you save new versions that will change here to OS means object string that refers to the name of this note itself which is manager one so you can see all that when I middle click on it here is there the name of the file the name of this node the current frame number and the industry-standard DXR let me think am I missing anything that's probably not I obviously will talk more about all kinds of render settings and simulation stuff in later lessons but I think this is probably good so without further ado let's run this I guess I might as well mention the resolution is actually here on the camera 1280 by 720 if you wanted something higher you could cure like HDTV 1080p Camargue jure picture I think this is fine though for our purposes it will be a slow render the render itself is slower if the volume it is dense like we're doing the very high density one so it's gonna take longer to do but it'll be worth it so anyway enough talking render disk and here's our final result we have a pig disappearing and there and that's it as promised a bit of smoke in the shape of a pig moving around and a smoke simulation in Houdini to load this up for the record you know you just run em play which is a separate program that comes with Houdini that's just simply the the media player and then file open the EXR is wherever you save them on the disk and then there you go and I'll just load them all up at once and yeah so we did it we learned about voxels vectors smoke density volumes and general simulation setups cameras lights materials all in one easy lesson the upcoming apply teeny volume series you also learn about all the complexity of actually sourcing smoke dynamically and all the cool forces and micro solvers they're called to move things around more interesting way all the details of rendering in terms of optimization and just getting to look good shading explosions all that good stuff so check that out I hope you enjoyed this lesson and let's just bask in this cool effect a few more times and that's probably enough all right until next time BAE
Info
Channel: Steven Knipping
Views: 43,639
Rating: undefined out of 5
Keywords: houdini, video, tutorial, lesson, free, fx, vfx, sidefx, smoke, explosion, beginner
Id: 8VrbBE-XnXA
Channel Id: undefined
Length: 72min 12sec (4332 seconds)
Published: Sat Mar 23 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.