Let's Make Coffee: Blender Fluid Sim (Manta Flow) For Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi i'm chris bailey i'm a blender youtuber over at c bailey film today i'm bringing you this tutorial with cg cookie and we're gonna be making coffee that's right a fresh brewed cup of coffee straight to you in blender let's get started [Music] now don't forget to check out cgcookie.com there's a lot of amazing tutorials way more in-depth stuff going on over there you can get a free trial and start it today so go check it out okay so this is gonna be a basic intro to using manta flow and creating fluids in blender so if you've never touched fluids before this is the tutorial for you hopefully we'll be able to get you off the ground and running today for your own projects now i've got this little scene set up with a basic cup and a ground plane and we're going to do is pour some coffee into this cup now every time you do a fluid simulation in blender there's going to be three components you're going to have your domain which is the bounds that describes where your fluid stimulation is going to take place you're going to have your inflow which is what is going to pour the fluid into your scene or generate the fluid and you can have obstacles or colliders within your object you can also have something called an outflow which allows for fluid to leave the scene but those are the main components that you'll have every time you do a simulation so let's go ahead and start with the first component which is the domain now the domain is made by creating a cube okay you just create a normal cube and you scale it up and you want to make sure that it's big enough to contain the area that you're going to need to have your fluid simulation taking place in i'm going to switch to wireframe view so it's a little easier for me to see if you know that you're not going to have fluid go beyond like this point in the cup you can actually scale down your domain so that it's not going to be too big the smaller it is the faster it's going to be able to process and handle computing the fluids now in order to turn this into a domain what i need to do is come over here to the uh physics tab and i'm going to turn on luit now it asks me what type of fluid do i want we can have several different types but we're going to go for a domain type now within the domain type there's a ton of settings and this is actually where you're going to do most of your controls and settings for your fluid simulation but we're going to leave these just for a second okay next thing we need to create is our inflow so i'm going to create just a simple uv sphere now you could use anything really so i'm going to scale it down bring this up i won't bring it too far i want it just kind of just above my cup here so this is going to be my inflow object again you're going to come over to the physics tab you're going to go to fluid and you're going to click that button to turn it on and then right here under type we're going to take uh we're going to pick the option for flow now the last thing we do is come to our cup and we're going to turn this into a collider so let's turn on fluid for this as well and this time we're going to say i want it to be an effector the effector type is set to collision one thing that's important to note is this geometry that i have this mug you can see it's got sort of two sides it's got some thickness to it right so that's going to allow blender to calculate the collision a lot easier but if you have an object like a single plane for example like the ground plane that i have in my scene here you can see this ground plane is just a single piece of geometry it's just one polygon so if that's the case and that's the thing you want to be colliding with your fluid you need to make sure you turn on is planar and that is the thing that helps to uh calculate properly if you've got an unclosed mesh right is what it's called in this case i've got a closed mesh show i don't have to worry about that now we're going to come back over to our domain and we're going to switch the domain type from gas to liquid okay because we're not simulating a gas you'll see that your cube will suddenly become solid again and that's because this cube is going to be the mesh for our fluid once we finish our simulation so it's made the the mesh visible again basically for us i'm going to go ahead and uh go over to my sphere my inflow i'll switch back to wireframe abuse we can see and i'll come over here make sure that my flow type and behavior is set properly so my flow type is going to be liquid and my flow behavior is not going to be geometry it's going to be inflow now the difference between these three geometry basically means if i wanted a ball of liquid to just drop into my scene and hit the hit the floor and splash i would use geometry because it's going to take the geometry of my object so say i took this mug right and put it up in the sky and used geometry as the flow behavior i would have a liquid-shaped mug that falls hits the ground and splashes everywhere but i don't want that i want a continuous flow like a faucet or a spout pouring into my scene so that's why i want to change from geometry i want to set it to inflow now outflow of course what i was talking about earlier if you want to have fluid exit your scene but we're not going to do that here so the next step we want to do is we need to tell blender to take this fluid sim and turn it into some mesh for us okay there are situations where you don't want it to be mesh you want to actually just get the particles and do other things with them but in this particular case we want to have mesh so you're going to come to your domain and you want to scroll down until you see this mesh option we're going to turn that on now immediately everything disappears what's going on well now our mesh has our cube has become the fluid simulation itself so you can see if i hit play we're getting something happening here now it's really important to understand that it's very unstable to run a fluid sim straight in your timeline like this you're not really going to get good results as you can see i mean look at that that's that's not really what we're after so if you ever want to get reliable consistent results be able to see what's actually going on you really need to use the cache to view your fluids so case is right below mesh so we come down here again on the domain and we're going to change this from replay we're going to set it to all and the reason to do that is this is basically going to save your fluid cache as a file on your computer now watch out these files can get big so if you do a lot of simulations you might be slowly heating up your hard drive so keep in mind where it's putting this and check it out now by setting this to all means we actually save this and use it in other scenes as well which is really cool powerful tool but it's going to be a really stable way of us previewing our fluids so set it to all and go ahead and click bake all and it'll start to bake through the simulation now you don't have to bake the entire simulation right we're just testing to see if things are working properly so hit escape and that will turn off the sim so let's see what's happening all right so we're getting a little bit of liquid and it's kind of behaving a bit weird and it doesn't quite work it's sort of just like yeah at least we know now everything is behaving right in some way it's like functioning it's turning into fluids so we're making progress now i'm going to go ahead and free all to get rid of my bank and i'm going to switch to wireframe mute because it gets annoying going back and forth and having the cubes constantly blocking your view and uh what i want to talk about next is the concept of resolution in a fluid so you can see this little box down here in the corner this represents the size of my fluid sim voxels right now a voxel is exactly the same thing as what you find in minecraft right so if you've seen minecraft i mean if you haven't seen minecraft like seriously where have you been i think the past decade but anyways minecraft is made up of voxels all the little cubes that make up like the water the mountains everything in that game is a voxel and a voxel is basically like kind of like a particle but they're divided evenly right so this cube if you imagine this giant square or domain filled with cubes this size whenever a fluid particle enters one of these cubes we're going to get a voxel there so one of those cubes is going to fill with mesh and so it kind of determines the resolution of our fluid so the larger our voxels are the chunkier and the grosser our fluid sim is and the worse off all the simulation stuff is behaving don't get stuck trying to mess with settings to get things looking right if you've got a large resolution size so in order to change that let's come right up here to the top resolution divisions i'll just pull this out a little bit so we can actually read these names so at by default set to 32. now we're going to turn this up i'm going to go to 64. the 64 scale um x64 resolution divisions let's see what that looks like i'm going to come down here again to bake and i will bake okay so i've gone to frame 50 and i've hit escape to stop the sim and you can kind of see that things are starting to look a whole lot better so we haven't really changed any settings in terms of how the fluid behaves all we've done is increase the resolution and you notice we're no longer getting these little weird snakey bits that are kind of going off it's no longer exiting the cup and like sliding off and all that weird stuff that was happening it's actually looking uh like a fluid so if we come over here now i can preview what this is looking like see it splashes down really nicely fills the cup this is now a piece of mesh that you can work with right so i'm going to go ahead and right click and shade smooth and you can start working on your material you can start thinking about how you want to do things you can do things like animate the sphere your inflow and it's going to cause the fluid to move around as it comes into your scene there's a lot you can do with this the next step for me is to really fill this cup up so what i want to do is run my sim long enough to be able to see it all kind of happen but it's going really slow so i kind of want to find a happy medium where i can still get the proper behavior and not have to wait forever for it so i'm going to come back to my domain and i'm going to come down here i'm going to free all and i'll come back up and 64 looks good but let me drop it down i'll drop it down to like 40 and see if that can give me something okay so 40 is giving me something that i can work with a little bit better now it's still giving the weird result here but at least i know now that it's actually behaving the way i expect it to when i do it at a higher resolution now that i'm doing it at a lower resolution i can bake these a lot quicker and kind of plan a bit what i need to do to try and make it work so one thing i'm noticing is it's going to take a long time to fill this cup up at the moment with the size of my inflow so i think i'm going to make it bigger so i'm going to come over here and i'm going to free all again you got to get used to doing this it's a lot of back and forth with fluid sims and i'll scale this up so that it's a bit larger and then i'll come back over to my domain and bake this all right so now you can see that i'm actually filling up my cup because i've got enough fluid coming in i've got a large enough inflow to really make this work and i'm getting some nice results i've got some weird stuff where things are breaking through but remember that's coming from my resolution now in order to turn off the flow and stop pouring the coffee i need to come over here to my inflow and i need to animate this value right here the use flow value so what i want to do is look at basically where's the level of coffee that i want i like as much coffee as possible i don't know about you so i mean a full mug is a good mug in my opinion so i'm going to come right up to here and i'm going to set a keyframe for use flow and then i'm going to just come to this next frame right here turn it off and set another keyframe so now the flow is going to turn off so at this point from frame 39 the flow will stop entering the scene and the fluid will settle okay so i've got my fluid sim and i've run it back at 64 for my resolution once again and i've given it that so i can see what it looks like really kind of sitting up the edge of the cup and i've got my inflow turning off right around here so you can see the effect it's really nice it's able to uh you know fill the cup up now to do my final sim i really want to use a higher resolution so i might even double this again and go all the way up to 128 or even 200 depends on how fast your cpu is and how willing you are to wait for it so the higher you go the more realistic your fluid sim is going to work that's pretty much it next thing you want to think about is okay how would we then texture this to make it look like milk coffee so let's do that i'm going to go into rendered view and make sure that i'm set to eevee i'm going to turn on amy occlusion bloom and screen space reflections and i'm going to take my inflow and i'm actually going to hide it so we don't really need that on for our render now you can turn on your restriction toggles up here by clicking on this little filter and then we turn off from visibility and from render the sphere so it doesn't actually render now sometimes it's helpful to take your collider object that you're using and you can hide it and then make another version of it basically so sometimes you can get clipping or there might be some problems with your sim where it's kind of going outside the bounds of your cup so sometimes what i like to do is actually hide the one that i'm using the sim with and just duplicate it make another one make sure it doesn't have the fluid sim on it so it's its own thing and then what you can do with that is you can scale it up or down to kind of crop in a little bit on your fluid so it sits even tighter against your cup so you can see it come right to the edge here it's going to sit really nicely in there okay so let's work on material now open up my shader editor and i'm going to come over here and i'm going to click new to create a new material with my coffee selected and i'm just going to go and make a couple of simple changes so uh let's go to a frame where we can just see the cough actually it's gonna where it's pouring it'll be nice and i'm gonna take my base color and i'm gonna make it a really kind of dark red like this and then i'm gonna turn up transmission i'm gonna bring it all the way up now transmission's not going to do anything in eev unless you turn on some special settings in cycles this will work automatically out the gate but if i come over here i can go options and i'll just drag this out so you can see it i can turn on my blend mode to alpha hashed or alpha blend depending on the effect and same with the shadow mode and then i can turn on screen space reflection refraction and screen space translucency then what i can do is come over to my render settings and down here to screen space reflections and turn on refraction now my liquid is going to start refracting light a little bit but i need to actually change my ior so i'm going to drag this down and as i drag it down you're going to start to see through the cuff now ior stands for index of refraction right so it's basically how much does it refract the light now you can look up what the exact index of refraction is for coffee but i'm just going to mess around with this until i get something that looks kind of cool and again you can see the transmission makes it go transparent it makes the light shine through it now i'm going to turn my specular up and i'm going to bring my roughness right down because liquid is not rough at all okay i might brighten it up a little bit and there we go we've got ourselves some coffee [Music] i really hope you enjoyed today's tutorial we had a lot of fun and learn some cool things about the basics of fluid simulation and i hope you're off to a great start with your own projects now enjoy your cup of coffee i'll catch you in the next one see you later [Music] you
Info
Channel: CG Cookie
Views: 113,045
Rating: 4.9520826 out of 5
Keywords: Blender tutorial, learn blender, CG Cookie, blender beginner, make coffee in blender, fluid sim in blender, Blender Fluid Sim (Manta Flow) For Beginners, cool fluid sim in blender, blender mantaflow, blender fluid simulation, blender fluid
Id: 6B0QM4Cft5c
Channel Id: undefined
Length: 14min 20sec (860 seconds)
Published: Thu Apr 22 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.