Houdini Isnt Scary Project - Part 4: Flip Fluid Dynamics

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back to the lead isn't starid project plot for flu so we've come a long way we've made our seed we've made a ball bounce we've covered a whole bunch of nodes and now we've reached the end game we are now going to turn our ball into a fluid and this is going to be more advanced than we've gone before simply put you could make any type of fluid that you wanted with fluff you're ready not limited and so it has to be quite an elaborate setup usually in our case well very simple setup so it shouldn't be too much to take in so let's not waste any time with the chitchat let's get straight into it from where we left off last we have all of our nodes set up and we have them all neatly put into these boxes and you can resize these boxes and align them if you want so that everything looks really nice and my color palette still up press C to hide that oh now we have a ball flip set up and we're going to now create a top Network so press tab and type top up Network and we can rename this one to ball look dynamics double-click on here and in here we can do a couple of things so we always need a solver let's drop down a flip solver you can type solver grab the flip solver we plug it into your output node now we also need a flip object a grab a flip object and plug it into the first input and we have our first look Network as you can see it has made this giant blob of blue and if you go into your scene with the View mode selected and press G you'll Center on it and you'll notice that this is at a massive scale it's 50 by 50 and this box that you see in light purple is actually the bounds for the simulation so if any fluid goes to that point it'll be stopped over there an awful up solver we can go to that and over to the volume motion tab and under volume limits we have our box size we don't need such a big box so we'll just set it to a 2 by 2 by 2 now I have a press G and I'll see you again we're centered at a more reasonable scale so now on our flip object we need to define which object we want to bring in that will be our fluid we go to our sunk path under the initial data tab and we'll go ahead and scroll down to a ball flip set up and choose off flip source now remember we don't want to I'll flip simulation to run from frame 1 we wanted to run from when this ball it's the ground on the third time so we wanted to run from frame 45 so inside of our ball flip setup perhaps it would be best to freeze it at frame 45 do that we can drop down a time shift node plug it in between our trail and our flip source and over here you'll notice something as we play this back this frame number over here changes if you click on the word you'll understand why it says dollar F that's H script for the current frame so what does node displays is the current frame but we can remove this dollar app and just put 45 now it'll freeze our frame to frame 45 that means that what is being output and put into our flip simulation is only frame 45 now we can go up and on our ball flip dynamics the other thing that we'll do is we'll change our start frame tool change the frame 45 so now it won't simulate for the first 45 frames you'll see that the blue bar only starts at 45 if we go inside here and we now play this back you'll see that it creates this blob and it's just a blob because of particle separation article separation is the distance between each particle so currently Houdini is fetching this ball and it's saying that each particle should be north point 1 in scale but that's not the size that we want we want far smaller particles sweet as opposed to naught point naught naught 5 and then go back to the beginning and now we have this well-defined ball and if this is slowing down you're seeing you it may just be because of the view mode that we have selected as you can see it makes these little spheres those are known as sprites we can go over on time a flip object node and under guides because it's only a guide a visualization you'll see that it has particle selected bingo with the particles tab and say that we actually just want to see particles then I'll just create a whole bunch of dots and that's far better for visualization now we have our ball in our scene and it's been converted to a bunch of particles but we haven't done anything with it yet so let's add a force and we'll be adding it gravity falls but that in off do flips over and if you play this back now don't notice that it just Falls iota falls it falls it falls under it to the bottom and there you can see how the bounds work as the ball of fluid reaches the bounds it gets removed we don't want it to just fall like that we want a Collider so let's drop a static object as we've done before we will also add a merge node so that we can bring the static solver in like your static object in here and remember that left effects right we need to switch these around so that this one is in the left input and this one is to the right now an AW static object we go over to soft pop and this one will be our platform so we can select platform out and rename this to platform underscore Collider we can also rename our flip object to ball underscore look and now if the players back our ball is running off the platform pretty interesting right we now actually have a simulation and if you just stop the simulation you can take a look it looks pretty good and you'll notice that some areas are darker than Albert's this is just the visualization thing again if you go over to your flip object under the guides particles you can see here that the color is driven by this V attribute but depending on how fast the fluid is moving it'll be lighter right that's just the visualization thing so that you can see which areas are moving fast oh great we have that so far what we don't want to just splash like that we want it to be contained in an invisible container so we need to create that container let's go up a level and hide our ball flip dynamics and just drag over I'll set up nodes so that we have some space we're going to add another geometry node so tab geo this one will be calling invisible Collider so invisible Collider back inside and let's create a box we're also going to ghost our other objects that we can see where our platform is relative to this box and then we're going to drop a transform node we're going to do two things with this transform node firstly we're going to scale this box down to naught point five and then move it up and we'll to set this to naught point five so now we can drop a note and this one we can call Collider underscore popped go back up hide your invisible Collider and go into your flip dynamics now we want another Collider so that requires another static object and the static object that it takes is going to be from our sub path we're going to go ahead and find our invisible collider Collider out and now we have a bit of an issue we have a Collider going in but we actually want to colliders going in and it's very simple to fix all we have to do is merge again [Music] merger two colliders together just like that so in this case this relationship doesn't really matter because neither of these actually affect each other in any way so we don't have to switch inputs or anything like that on this new static object we can rename it invisible underscore collider now let's view our collision guide and remember to see your collision guide you have to actually be on the start frame so go over here to frame 45 and will increase our uniform divisions to 100 so that it's a more accurate Collider so if we hide our geometry and our collision guide and we try playing this back you'll notice something that is not exactly what we wanted right that's definitely wrong but why is that wrong the reason is this box is being treated as a solid object and we're trying to put flipped fluid into the center of it so obviously there's going to be some weird into action and things are going to break because we're trying to put things into a solid object so what we actually want to do is not have a solid object but rather a hollow object what we want is all this to be almost like an empty space inside of a bigger container so for this to act just like walls as opposed to a solid block we can go over to our collisions tab on our static object and under volume you can say invert sign and you can read the tooltip if you want a hollow box one method is to build one box inside the other and not use laser scanning a more robust method is to just specify the in a box and you sign in version let's treat everything outside the boxes inside allowing the more robust layer scanning method to be used so that sounds like what we want to play this back the cadet it appears to have worked there's a few things we're going to want to fix but nothing too difficult we've got our flip simulation running so the first thing that we want to fix are these particles that are escaping our box and that actually has to do with sub steps we mentioned sub steps in the last tutorial with the number of calculations between frames so if they aren't enough things can kind of slip through you know so those particles were moving quite quickly and Houdini didn't register that they moved through the collider so for could you need to register that they've moved through the collider we need Houdini to do more calculations on the sub frame bases go over to your flip solver go over to the sub steps tab and you can increase your max sub steps to four newman sub steps to two now we have more sub steps and so as you can see if we play that back that's fixed our issue of particles escaping the other thing is that this is splashing a lot reason being is as this comes in this is basically just like water not even because it doesn't have surface tension or anything like that set up so these particles are moving really quickly and there's nothing constraining them in any way what we want is to change this from this splashy kind of mode a more swirling kind of mode and surprise surprise vtd has something just for that if you go over to the volume motion tab on your solver you'll see the splashy kernel widget the swirly kernel and this just basically changes the way that velocity is calculated it prioritizes swirling motion rather than large splashes next we're also going to add something known as viscosity now you may know what viscosity is if not a basic way to understand it is the thickness of the fluid or example milk is slightly more viscous than water if you pour more contour surface although it does that it kind of sticks to the surface if you pour water basically runs off and then a more extreme example would be something like honey and he is extremely viscous it's quite a thick fluid and the line between flue and solid gets a bit blurred when you're viscosity gets extremely high but we want this to be slightly viscous we want this to be more like milkshake rather than like water so what do you think that we would set up our viscosity given what we know about networks if you said on the object because it's an initial state you'd be right we go up to a flip object that's our ball flip over to the physical tab you'll notice that this has the same things that our rigidbody had as bounce it has friction all of those things we're going to give it viscosity now if you hover over this it will tell you more or less how much viscosity equates to what type of fluid so 1,000 for a thick fluid 10,000 for a dirty fluid we actually just want one maybe 1.5 right really low and so now look about viscosity we need to go over top flips all the tab and actually enable it they will see under volume motion you have these tabs over here go to viscosity enable for scarcity and then we can try playing this back and as you can see it's much smoother all right it holds its shape almost like it's a thicker fluid that's because it is a thicker fluid it's now got viscosity it's not acting more like a moat rake and a lot less like water that looks pretty good I think we're on a good path here we can stop this and if your simulation refuses to stop you can press escape and that will stop a torture computer so slow that you can't move your mouse to the bottom left press escape most times in Houdini pressing escape will stop what's freezing up your computer Oh remember escape pretty useful now an issue that we have with the simulation is that it's really sticking to the corners and we don't really want that we kind of wanted to slide back down and that is actually under the viscosity tab we have this slip on collision if we activate that and then push up our slip scale about naught point eight we can go back to the beginning and play this back with this slip scale pushed up it shouldn't cling to the sides as much it'll still go up because that's the natural way that the fluid would run in real life but then it slips back down how does that look let's see oh but these are just some particles we can actually visualize what this would look like as a fluid if we go up to a flip object and under guides and visualizations to the first tab we can uncheck particles and check surface I've play this back you can see what it would look like as a fluid pretty cool right like this wasn't too difficult and yet you've got this really nice-looking flip simulation but what we want is to actually output this as a geometry because right now we have this in our flips over and all we're doing is visualizing but we actually want to render this out let's go up a level now that our flipped dynamics are sorted out we can create the final render node okay a geometry node put it over here and we can call this ball dynamics let's go inside here and we need to bring in a few things firstly we need to object merge in our original ball so we'll go and find our all flip set up and remember we have this RBD ball art this was this ball that bounces one two three great with our ball brought in we also want a flip simulation we're going to drop it dot input output at the top io node over here needs select our network and that is the ball flip dynamics network the nodes that we want to bring in is the ball flip node so go over here at ball flip over there and you can use the preset liquid but I'm just going to import the fields using this plus and if we switch our display flag to our dot IO yes our particles we can actually save this to disk but what I want to do first is I want to compress it is when you simulate flip it has a lot of attributes on it and it actually gets saved as a very big file a good thing to do is to drop a fluid complex a put a fluid compress down plug your fluid into this and now you'll see that it says particle separation of let might ring a bell particle separation is also inside of our flip dynamics right on your ball flip object you have this particle separation up here and so those two are linked but you can right-click on this and say copy parameter go back over to for dynamics right click on particle separation is relative references then are they linked right perfect what we can do now is drop down if file cache node and the file cache node simply saves this to disk so we can go over here to the geometry file and choose a place to save this and I'll make a file in here called caches and in here I'll make one called flip compress cache dot pala F we want them to be named after the frames dot d GE o dot SE another that's super useful file type d te r SE o is that accept and we'll adjust that start and click over there change this dollar F end just to 96 and then we can save to disk and this will take a moment depending on your computer and this is CPU based so this is dependent on CPU not on GPU so if you have an amazing graphics card it's not really going to help you very much yeah great so it's didn't save to disk and now it doesn't load that by default you have to say load from disk and we just have these blocks right but that's because fluid compress isn't meant to be used in that state we need to use a fluid surface a particle fluid surface then we can plug our file cache into the first input and on here once again we will paste relative references to the particle separation we have fluid and this is a geometry as you can see there's all these polygons to it and it looks pretty good what you can do to smooth it out a bit is go over to faltering take dilate and take smooth and then adjust your smooth if you want to smooth it a bit more you'll notice that it is a bit slow to create this geometry and so of course if you want you can do another file cache we can drop a file cache node and in this file cache node once again open floating file chooser go to our caches or call this one look ngo cache dot dot AF topped eg odesi except change the start end 96 take to disk all right so let's see what we have and it's going slowly because remember load from disk important we activate load from disk and now it'll be super smooth when it plays back awesome and now really the last thing everyone's do is we want to switch between the pole and the fluid we have this ball that bounces right and we have this fluid that plays but we kinda need to switch between them at frame 45 the we can drop down a switch if node now this takes two inputs it takes firstly we'll use our ball that is the default then it takes a second import and when do we want to switch we want to switch if something happens we want to switch off to frame 44 right when it hits frame 45 we want to switch to our flip so in here we say dollar F great al and 44 we play this back 1 2 3 blue pretty awesome right so now we can drop down a now call this ball underscore dynamics underscore out and now all we have to do is get this a material on the render tab material all trader look through cam 1 [Music] and let's go take a look at that in our render view so there we have it we have flip simulation and our ball that bounces and we switch between them and all of a sudden we've got this awesome effect so I hope that this wasn't too complicated I know that there was a lot that we covered and for that reason you can go over to our patreon once again it's a free post you can just check it out look you don't have to subscribe or anything we go over all of this so as diagrams and things to help you understand this a bit better and this is the advanced part of Houdini right it's simulations simulations there's so many settings and so many things that you can do and the reason for that is because you can create anything you want and so that's it we've done it we've created our first project I do hope you enjoyed this as much as I did it was so much fun waiting lists and sharing it with you and your comments are always awesome to read oh thank you for your comments and thank you top patrons they allow us to create content like this for free and if you'd like to become a patron feel free to head over to our patreon and check out our other content over there we have more advanced tutorials so you could watch this and ease into it and then get into a more nuanced content if you want or you can just show some love but you know leaving a like subscribing leaving a comment that's perfectly cool too I hope you do that thank you for watching I'll see you next time with an extra spot where we go over some rendering settings and whatnot but really you can render it from yeah you can figure it out there's nothing too different from what we did without doing it oh yeah thank you for watching I'll see you next time bye
Info
Channel: Nine Between
Views: 34,662
Rating: 4.9936857 out of 5
Keywords: Houdini, vfx, cg, cgi, houdini tutorial, intro to houdini, houdini basics, houdini learn, learn vfx, learn cg, learn, sidefx, blender, visual effects, computer graphics, digital art, maya, vfx basics, introduction, 3d, 3d tutorial, basic 3d, houdini 3d
Id: lxWp0EhaHdo
Channel Id: undefined
Length: 23min 35sec (1415 seconds)
Published: Wed Mar 25 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.