Mograph Liquids: Controlling FLIP Fluids Via Curve Forces

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] i've recently been re-watching some of jeff wagner's tutorials on what's new in older versions of houdini so going back to the archive and there was one technique that i found really neat and fun kind of useful and with a few adaptions i think it can be really useful and create some really nice renderings such as this we're talking about controlling flip fluids and what i want to do now is take you through manually setting this up instead of using houdini's shelf tools because i think a manual setup can be a bit more intuitive than those notes that houdini shelf tools tends to put all over the place in houdini let's start by dropping down a sphere which will serve as our emitter so i'm gonna dive in here and set my primitive type to be a polygon let's increase the frequency to maybe 12 so now we have a quote-unquote high resolution sphere here let's increase its scale a bit and those values that i'm dialing in here i just found them out by trial and error when preparing the setup and let's move this down a bit to minus 2.6 copy and paste this sphere and move the other sphere up a bit now let's merge both just like this so those are our merged spheres which we want to use as fluid emitters however a sphere itself is a bit too perfect and will result in a weird fluid behavior that doesn't look very organic so let's break up those shapes by using a mountain sob which i'll attach down here and dial in the noise a bit by just increasing its height to 2.2 like so let's attach a null down here call this one out underscore emitter next let's build a control curve for this and you can use any curve you like in this case i'm just going to use some text using the font sop which i'll drop down here let's just ghost this emitter here and highlight the font and i'll just go with an n for intagma and choose another font by just going here and let's just go for the chivo black italic really like this one i think it's a free google font let's scale this in up a bit by increasing its font size to 12 like this and before we can use this as a control curve let's open it up by using the ends sub and set closeu to open which in this case will result in this part of the letter missing here however in my preparations that didn't seem to make huge of an impact you could also set this to unroll with new points instead i'll leave it at open and attach a null which i'll call out on the score curve so both my emitter and the curve are there time to build our simulation by dropping down a dot net like this and i could wire these outs here directly into those input ports here however it's not really necessary let's just dive in there and in here i want to set up a flip solver which goes into the output and needs a flip object which carries the data for the simulation and to control the behavior of the fluid we're going to use a pop curve force in combination with a pop wind so let's wire those together and they go into the flip solver's last slot all right let's set up the emission first so on my flip object here the input type is set to surface up which is good just want to set the sub path to the out emitter that we just created and also set our guides especially those for the particles to be just particles points so i'm not wasting time on trying to render sprites here as for the initial data i want to increase my jitter scale so those points aren't created as regularly as they are and up here this is my main slider the particle separation this is the main slider with which i'll later dial in my simulation's overall quality the smaller the particle separation the more particles i will have in the simulation and thus get more detail and we're going to come back to this parameter later on our flip solver i want to increase my maximum sub steps so if we are getting simulation errors that are too big we'll allow for further sub steps to refine the simulation and on the particle motions tab i want to go to reseeding and disable the resetting of particles what reseeding does is it tries to keep the particle count per unit volume in the simulation constant in this case however this led to additional particles being spawned while the simulation was running and thus just filling my control curve with particles instead of having this sloshing around liquid just want to make sure that separation droplets vorticity and rest are disabled on the volume motions tab i can enable or disable the volumes limits flip fluids is a combination of particle and volume techniques and the maximum size i'm allowing for the volume here is represented by this box that's plenty but it's also adaptively scaled so if we only have a smaller simulation my volumes will automatically adjust to the size of my simulation so we're not wasting ram here i just want to uncheck the visualization of that volume the box size at its default is fine the only other thing we could check is in the solver tab there's a use opencl checkbox which you might want to check later if you're running this in a high-res and have a hefty gpu so far i think that's it for the settings on the flip solver and the flip object let's set up the curve force so in here in the pop curve force let's point the geometry source for the curve to the out underscore curve that we created and you can directly see we're getting these visualizers here indicating the force that we just created in here i want to drag this down and dial back the maximum influence radius a tiny bit to 1.8 and increase our individual forces so they act stronger on our particles on our fluids here i want to set them to be all eight except for the orbit scale which is kind of twisting around those particles while they are being pulled along this curve here and the velocity scale is eight as well down here what i can do is create a falloff that means dial in how strong these forces are at the center of my control volume here that i'm creating versus how strong they are at the edges and the only force i want to tweak a bit is the orbit force again so i'm going in here and setting the interpolation both those points here to be b spline like this and adding a third point in here which i'll give a value of zero and set it to be on position 0.5 so we have a curve like that let's head over to the global forces tab and in here i want to modify the force along length and just delete that last point here so we have a continuous force along the whole curve here all right for now to test this out i think a particle separation of 0.1 should sim decently fast so let's save this keep our fingers crossed enable real time toggle and hit play all right so the curve force it's doing its thing and to break this up a bit i drop down this pop wind here which currently has no velocity and also no noise and i just want to use this winds noise here to break up that simulation a tiny bit so let's reset this and increase the amplitude to maybe 1 the swirl size to 1.5 and the roughness to 0.7 again all these are values that i found out experimentally when preparing the setup here so again let's save and resin and that is looking promising let's leave this particle separation at 0.1 for now because it seems really fast it's by no means any detail that i would use for production or for final rendering but for now let's stick with it and go up one level here so this is the simulation we're currently doing let's highlight it like this and you can see all those particles how do we get those particles to become a fluid well first i want to get all the simulation data or the important simulation data out of this dotnet using a dopp i o node which i'll drop down here and just drag this dot net into this dot network slider on the dot io and then in here on the dot node i'm going to select the flip object that i created within this dotnet here hit accept now let's drag this down a bit and under presets here let's choose the flip fluid that sets up a few imports not only the geometry but also two volumes surface and velocity so when i highlight this here nothing has changed but when i middle mouse on this you can see next to those individual points here i'm getting also those four volumes which is a surface volume and a vector volume that's split into its individual components called velocity after this it might be a good idea to drop down a fluid compress and a file cache and those two nodes are just there for caching out what we simulated the fluid compress is a lossy compression method for those fluid caches that we generated think of it as the jpeg for particles or fluids which is kind of useful to have when you're like me and your ssd is slowly running out of memory with this i was able to compress my final caches down from around 7 800 megabytes down to i think three or four hundred and as you can see this one takes in the particle separation parameter as well so what we want to do is dive into the dotnet here and on the flip object right click into particle separation copy that parameter go up again and on the fluid compress just delete this right click in here and go to paste relative reference so now that's linked with my particle separation that i dial in in the dot net let's just link this up and i could cache this now as bgo if i want it i think that's not necessary yet with this really coarse resolution however when i highlight it you can see those blocks here and those are just a representation placeholder that the fluid compress generates okay how do we turn this into a liquid we're going to use the particle fluid surface that we're going to attach after the file cache here and highlight it also in here you can see a parameter for the particle separation so with our original particle separation still copied let's just delete this right click and paste the relative reference to our original slider within our dot net up here okay that's how our setup is looking so far let's go back to our particle fluids down here and the last trick i want to perform here in preparing this mesh for rendering is when you look at the artwork that i rendered out for this tutorial you can see that for example in the edges of the n you have these kind of very turbulent areas of water and in those areas water typically turns from translucent or transparent to white because there's foam there's lots of bubbles a bit of spray forming there and although i don't want to use a white water solver here i want to do something similar and use my simulations velocity to generate areas in which my water becomes more white translucent-ish than transparent so when i middle mouse on that file cache here you can see that the fluid compress not only did his work by compressing those particles it also converted those two volumes into vdbs turning those three prior velocity volumes into a single vector volume and i want to use this and analyze it using a vdb analyze wire this in and want to take the velocity and generate its curl you might remember from our tutorial on curl and curl trails but one way to look at curl is the rate of rotation around a given axis when you drop for example a ping-pong ball into any liquid that's moving and what i want to do here is use the curls strength to determine where we have lots of vorticity going on so that should spit out a single float volume which is still called velocity weirdly enough that now contains the simulation's curl so i'm going to use an atrip from volume to write back this curl onto our mesh that we generated using the particle fluid surface just setting up this attribute name here pointing it to vel for this curl that we just calculated from the velocity okay let's highlight this middle mouse on it and we can see we've got a val in here and now let's drop down a point wrangle and remap this velocity because currently when we look into the geo spreadsheet for the bell and get its minimum maximum value we can see that's a bit all over the place so the first thing i want to do instead of looking at this curl here as a vector of 3 i just want to get its strength so its magnitude basically which i get by just taking this vel vector's length so let's create a float call it curl amp for curl amplitude and it should be equal to the length of this vector vel that we just created let's just write it out to our points so curl amp equals to curl amp like this and now let's have a look at the geometry spreadsheet again and at the curl amp and you can see this goes from 0 to 20 in that case however i'd like this value to be more in the range between 0 and 1. and also let's skip through this a bit and update our geo spreadsheet and on this frame it's between 0 and 23. so let's go back into our object here and let's remap this curl amp using a fit function and we're going to fit the curl amp that we just read out and it should be between 0 and let's say 25 as the maximum incoming value and we want to remap this to be between 0 and 1 like so to visualize this i could either drop down a visualizer here or write this directly out to the color let's just use the visualizer here and let's visualize a point attribute called curl amp and let's maybe use a ramp instead of just using the straight attribute let's just set this up to be between black and white like so now you can see we're getting a bit of that curl so in more turbulent areas we are getting higher values in this curl amp than in less turbulent areas and depending on your simulation you might want to dial in these values here in my final simulation i ended up using a maximum amp of 50 i think which as this visualize is automatically adjusting its visualization values is not changing so let's set this to minute max again to range between 0 and 1 like this and now you can see if we're changing the input range here the output range also changes in my case a value of 50 for the final simulation resulted in a good look okay let's attach a final null call this one out like so all right that's our setup pretty compact what i want to do next is just save this and now make sure that all my particle separation attributes are linked in the particle fluid surface and then the fluid compress then let's reset this go back into our dot net in here and let's decrease the particle separation to 0.01 and now you can already see this will take a while this will take a bit of ram and also a bit of hard disk space however in some simulations and this one is definitely one of those there is just no substitute for particles and the lack of particles in a fluid simulation is what often catches my eye when i scroll through insta or twitter for example all right let's go up one level and now of course also the conversion of those particles into a fluid takes quite a bit of time here so almost half a minute so it might be a good idea to drop down another file cache after the particle fluid surface node here also you can now see that we are seeing the original polygons of those spheres we created and if i were to take issue with that i could just go up there into those spheres and increase the frequency bit further to maybe 24 and again now we're cooking the simulation and we're trying to convert those particles directly back into a fluid surface so this all takes a while but here we are all right what i typically do now is go to the file cache node make sure my save frame range is checked the geometry file path is decent and hit save to disk and let this simulate of course i prepared a file cache for now so in here what i'm going to do is just load up the file cache out prepared which is this one here took a few hours to simulate i think and let's go to frame 100 i think this file cache is running from frame 7200 and before i want to do this i might want to check load from disk and not have this all simulate again so there we have our cache let's check the particle fluid surface which took about 37 seconds to generate this mesh as you can see now that's a good bit more detailed and now let's see what happens if we write back the curl amplitude that we generated and you can see yes that's giving some nice additional detail in here so let's highlight the out node here and just briefly talk about rendering this in this case i want to use octane and i often get the question when you use octane when you use redshift and the answer is there is not really a system behind it both redshift and octane are very capable gpu-based render engines in my opinion for a more lightweight setup octane can give you analog photographic looking results quicker than redshift while in production with heavy scenes when i need a reliable render engine i'd rather tend to use redshift in this case i'm going to go with octane just going to pin down this tab here close the other tabs and hit ctrl t three times setting one to the out context one to the shop context and one to the material context so let's save this add a camera by control clicking in here let's position this making sure the camera is locked to the viewport so let's just position this to my liking for example maybe like that let's uncheck the lock and go to the side and make sure that my camera is selected with the tool handle and press z over the viewport and just dial in the focus and the depth of field like this okay back to the camera view here and i also would like to add a background in octane i'm just going to do this using a grid which i'll wire in below the camera again let's move out here so it now sits perfectly at the position of the camera let's just go into the grid and set it to be along the x y plane go up again and move that grid out a good bit to maybe minus 60 units like this look through the camera again and scale it so that it fills the frame usually an x scale of 1.7 and then dialing up your uniform scale until the frame is filled and maybe extends a bit past the frame like this okay let's save this go to our octane shelf here click on the octane and render target which creates the octane's output node here under which i want to check that in the motion blur tab we have enable deformation motion blur so my fluid sim will get motion blur that's another one of those details that are often missing in those typical instagram or twitter renders that i'm seeing so make sure that on your fluid sim there's motion blur enabled then in the shop i will set up my octane render engine here setting the environment to be a texture and i want to do path tracing so under the path tracing kernel let's set up my diffuse specular and scattered f12 that was sufficient to get most rays through this soon to be refractive surface here which is going to be water i want to set my gi clamp to something really low like 10 or 15 not much strong light going to be going on in here uncheck alpha shadows that makes it a bit faster and they are not needed in this current rendering here and i want to enable the adaptive sampling if you want to know what adaptive sampling is i've got a really nice premium course on rendering 101 in which i think i'm explaining it let's decrease the noise threshold to something substantially smaller 0.005 and let's decrease the minimum samples to 16 pixel grouping none and down here let's uncheck minimize net traffic to make the update of my ipr bit faster let's load in an hdr in here so i'm just going to point this to an hdr i downloaded from hdr haven let's just make this a relative reference instead of pointing to an absolute path and make sure the gamma is set to 1 and increase its power i think i needed to increase it to around 4. let's save and hit the ipr button takes a bit of pre-processing time and there we have a very purplish and slightly blurred out image let's fix the blur first by going to our render target camera here and unchecking autofocus so now it's taking into account this focus point that i set up previously the purple is indicating that i've got no materials assigned in the scene so let's fix that just close the ipr and go into the matte context and in here i want to drop down an octane material builder let's call this one bg for background dive in there and in here i just want to drop down a very simple diffuse material which i'll set to a rather dark black value 0.02 maybe like this goes into the material out here and then go up one level and just drag this bg note onto the background here and also let's create an octane material builder which we're going gonna call fluid dive in there and in here i wanna do a few things but for the first time let's just go with a very very simple fluid just dropping down a specular material in here while that's straight into the out node and maybe set its index of refraction to 1.33 which is closer to water go up one level and drag the fluid onto this fluid mesh here again let's save and hit the ipr button so after a bit of preparation time getting this image which already is kind of neat i could feel tempted to go into the sharp context into the render target and under the texture environment adjust the hdr's rotation so that these reflections here catch something nice so they are to my liking just experimenting with this and let's go with the rotation of 330 or minus 30 degrees just want to head over into the imager here and let's check neutral response and select one of those lots for example the portrait 800 giving a bit more contrast but now those highlights are blown out so let's dial in the highlight compression maybe something like 0.6 and also in the post-processing tab let's enable this let's decrease the clear power to all zero and increase the bloom to maybe 20 or even 30 which is quite aggressive but then let's counteract this by increasing the cutoff to maybe 0.8 so now we're just getting a bit of glare slash bloom into those areas that are really bright so bloom power of 20 and a cutoff of 0.8 kind of works for me in this case now let's bring this curl amplitude that we calculated with those swirls and those turbulent areas bring that into the shading by going into the material network again into the fluid here and let's create another shader here which is going to be a diffuse shader and i'll set this up to be highly translucent giving it a white diffuse in here and creating another an arc is a grayscale color which are set to be one so white and this goes into the transmission slot here of the material diffuse which now when we wire this up and refresh our rendering results in this milky frothy kind of look here and what i want to do now let's just close this ipr here is on my object here the sphere that's the fluid i want to make sure that in the octane parameters here and if they are not on your object here just go up here in the octane shelf and hit plus obj palms under the attributes here i want to export this let me dive in here little mouse on this i want to export this curl amp and i want to use this in the shader later so in the octane parameters under the attribute tab my curl lamp is a point float attribute so let's just point this to curl amp and now it should be exported and available for me in shading here so in my fluid material in here let's import a float vertex attribute the name is a bit misleading as it's a point attribute and is able to read in the point attribute as well basically the only difference between those two here is one reads in a vector vector three and one reads in a single float no matter if it's a point or a vertex attribute that i exported previously so let's read in the curl amp and use that in a material mixer to control the amount of mixing going on between the specular and the diffuse material here so the frothy and the highly transparent water let's just wire in the diffuse in the top and this specular in the bottom slot i believe that's what i always mix up so let's try it this way and we could also feel tempted to be able to adjust the blending of those to add a gradient node in here it's just a ramp so my curl amp goes into this ramp input here and then after i remapped it into this material mixer's output and i think i just moved those points in a bit in the case of the preview rendering to 0.2 and 0.8 respectively increasing that contrast a bit like so all right let's keep our fingers crossed save this go to the ipr and i think it partially worked however to be sure let's just snapshot this thing here so this opens up my employee in the background and um just want to make sure that i don't have aces enabled for this one so the colors are correct and just to check this out if it's importing correctly and remapping correctly i'll use another diffuse material and i'll just wire this ramped imported value into the diffuse channel here and now just output this diffuse material and yes you can see that i'm blending those values correctly here so again i can adjust those values here drive how strong one or the other shader comes through here in this case let's go with something like this maybe and wire up the old shader chain again let's just converge this a bit and after a few seconds 25-30 seconds let's just snapshot this for comparison and let's compare it against the purely specular purely clear water material also let's leave this to converge a bit let's snapshot this too close the ipr open our mplay and let's compare the one with the white parts with the non-white parts in this case i think some of those areas are a bit too broad for me so i might want to be dialing in this gradient here and also in my material diffuse that's this milky material i might feel tempted to just copy the color grayscale paste it down here wire this into the opacity and dial in the opacity so maybe it has a bit less opacity becomes a bit more fog like a bit more subtle however in this case i will just delete this wire this back in to the main output and try dialing in the look with this main gradient here by adjusting how strongly these two underlying materials get mixed so that's been a quick ride through using flips for some more mography setup and also a few tricks on rendering this in octane and if you guys want to support what we're doing and also gain access to more in-depth tutorials for example on rendering or on volume techniques you might want to consider becoming a patron of ours and to everyone already supporting us thanks so much guys it is through your help that antagoma in this way is possible with a very special thank you going out to important looking pirates chris hebear and rafika nadol thanks so much guys as always we're looking forward to seeing you guys artwork so don't be shy and sharing and until next time it's cheers and goodbye
Info
Channel: Entagma
Views: 27,747
Rating: 4.9956141 out of 5
Keywords:
Id: DhqC13Z_hYc
Channel Id: undefined
Length: 24min 48sec (1488 seconds)
Published: Mon Mar 01 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.