Houdini Tutorial: FEM fibers & Procedural motion

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi folks I've had a few people ask me recently about the FEM solver and so I wanted to share a few things I've learned so it's one of those shadowy areas of Houdini that doesn't necessarily get as much attention as a lot of the other solvers now I'm actually not going to talk all about what's maybe the most standard or at least the most familiar workflow using FEM tad flesh eating soft body dynamics to existing animated rigs for that whole directory to family funds excelent hug workshop instead I want to spend some time talking about how you can use some of that muscle attributes to drive motion procedurally to that end I'm going to cover three different mini projects we'll start with a very basic set up using noise to drive out dynamics which should get us comfortable with the core principles we'll also take this opportunity to have a wrinkly skin dynamics one of the most fun elements of the FEM solver next we'll ditch the randomness in favour of periodic functions and we'll look at how to use muscles and target constraints to drive a simple inchworm style locomotion finally we'll move to an entirely reactive setup with a sort of tentacle than enemy type creature that responds to a secondary target geometry as always you can find the hip for these on my website so without further ado let's get started okay so let's get started with our first setup I'm just gonna drop down a geometry node here and I'll call this one noise we're basically gonna be doing all of our dynamics using noise so I'm gonna jump in here and the first thing we want is a little bit of geometry play with for you to do something real basic so let's just put a spear in here and we're gonna want this to be polygons and I'm going to bump up this resolution a bit to something like this and that'll be a pretty good place to start so for Fe M what we're altima doing is taking a mesh like this which is just a surface polygon and we can see that pretty easily clip here we just have this shell that's what our normal missions look like um what if a.m. does is it replaces this sort of surface based geometry with an entire volume kinda makes a tetrahedral mesh so tetrahedron is one of these guys so it's just like a triangular volume unit this is technically a little simplex on so Fe M basically builds a volume out of all of these little tetrahedra to fill the space that the mesh occupies and the advantage to this is it lets it simulate the entire interior of your mesh so if you have built up forces if you have strain all of that stuff going on the inside of a volume it simulates all of that stuff so to have an IBM simulation we need to convert our meshes into that kind of tetrahedral representation and those she basically is to do this we have solid is bed and solid conform and they do very similar things they're both gonna generate a tetrahedral master the basic way to think about this is that solid Abed is going to try to build like a cage around your geometry so you can see here it's built all these tetrahedra and they're sitting sort of around at the geometry we've died again and this can be really good if your geometry has sort of a regular topology or if it has like little verifying details that you don't really need to capture or simulate in a lot of workflows you're gonna want to use all it in bed because your geometry probably isn't in a really nice triangulated form with nice evenly sized triangles and triangles that aren't overly large so in general for most things we'll use all of it back something really simple like this sphere we have here that has a relatively crude sort of coarse representation we can actually use solid conformed and what solid conform will do is it will take that surface geometry that you have and it will use those it'll make sure that it use of those points on its tetrahedra so this doesn't look like it's done anything but if we go up here on info we just have polygons once we've done conform we have tetrahedron and if we drop our clip here you can see that the entire interior has been filled now with these little tetrahedral elements so solid conform will sort of keep that surface geometry and in this case it actually does a better job than solid at bed does because we already have this sphere that knows exactly how to sort of triangulated surface in a very regular way that's kind of built into that's primitive so solid conform is a good back for us here because we get a really nice fidelity to this sort of original shape but in a lot of use cases you'll probably want to do solid in bed and we'll talk a little bit more about this later so for now we use solid could form and this gives us a bunch of nice tetrahedra and this is basically all we really need to go ahead into our IBM solver so at this point we could just drop a null call this after the NGO and go straight into dumps but what I want to do with this lesson is talk a little bit about fibers and fibers are basically how found sort of handles muscles and what it does is it defines at every point so this entire geometry is filled with points on the interior now at every point you can specify preferred direction in space and that direction is the fiber direction and once you set that up if you control the fiber scale you can tell the whole thing to contract or expand along that direction and what's interesting about this these Corrections can go in any given way they're specified on the point by point basis so we can set up a uniform direction of the whole thing or we could set up sort of directions within the entire material and we're just going to sort of take a look at that idea in this particular setup so if we want these muscle fibers we're going to need to to find some attributes so I'm just gonna go how to add drop magic wrangle and we don't need very much here the main thing we need is a property called material W this W is because this is one component of U V W so you can actually specify directions sort of all three directions and you can define these sort of movies or these three-dimensional UVs which are basically like material coordinates you can define these in a variety of different ways but if you're just doing fibers the only one that you actually care about is material W and so this is just a vector pointing in some preferred direction so just for the sake of argument let's initialize this to Zed axis here so that's the first parameter we're going to need and there's two fiber properties we can play with one is fiber scale and this just said is sort of how how long along this preferred axis so how much stretch or compression do we want a long material W and so 1.0 is basically no change less than one is a contraction and greater than once an expansion so let's just set this to some starting value just so we can have a feel for how this works and the last thing we'll probably want to set up is a property called five or stiffness and basically when you set up material properties in Fe M you're going to set up a variety of different stiffnesses this is how it controls how the overall sort of shape how the dynamics go on at the interior fiber stiffness basically says take whatever the existing stiffness is and multiply it by this amount only in the direction of the fiber and so this basically allows us to set up a more or less stiff muscle than the surrounding sort of tissue if we want to think of it in those terms so in general you'll want your fibers stiffness to be sort of greater than one you want it to be a Scalia sort of stronger than whatever else is around it and so I'm gonna go ahead and set this to something like let's just set it to ten for now we might change this later but this is basically just sort of setting up some some preliminary properties so we can see something happening well let's just call this so fibers and now let's go ahead and jump to our network all go in here and to get us started we can actually build what's probably sort of the simplest top setup you'll ever see we just want our solar and our solid object and certain nothing else so this is a really really nice simple setup we're gonna tweak this a little bit but ultimately film setups aren't that complex so on the solid object here this is where we want to bring in our geometry and so we want to go to the deformation tab here and our initial state is where we want to point to that some geometry we just moved it so bring that in here and sure enough there it is and from now well that's pretty much all we need to set up here so if I were to run this at this point it's not going to do very much but it will actually based on what we set up here we should see it's stretching to about double its size along does that axis so let's just play and sure enough it sort of pops itself out along that axis and we get some sort of interesting kind of dynamics going on there in part because that stiffness is really really strong it's pushing it's kind of kicking out very sort of it's giving a big initial kick which is giving this kind of fun distortion in the beginning but then it sort of 17a back position so that's not super useful but it is showing us sort of that material W is functioning just fine and that our stiffness is really sort of pushing against whatever stiffness the structure itself has this object has and that will basically get us started now defining just a static material W and a static fiber scale out here isn't all that interesting for a lot of setups you probably won't want to change material W but changing the fiber scale is how you're gonna get sort of interaction we're gonna get sort of movement and changes here so well let's start with a really simple example let's just set this back to 1 and what we want to do instead is sort of drive fiber skin and just for the sake of argument I'm just gonna sort of drive it with a periodic function so to do this we need some way to change fiber scale within our doc network so during these simulation steps and usually you would think okay it will probably need something like a sob solver and we just plug that it to a crease off but you'll notice that the thumb solver doesn't have a pretty solve or a post solve or really any input except for the object input so this is a very sort of bearable and solver in terms of what's accessible to the user so if we want to do anything we basically need to reconfigure this set up and what we want to do is drop down multiple segments and these seem fancy or daunting if you haven't worked with them before but they're actually really really straightforward all they're saying is take some object like that through and apply every solver I can't if it's sort of purple are here apply all of them in order to this same object so if all we did was types of M solver in here with the single solid object the multiple solver is basically just saying run this solver on this object and so that's not going to change anything and in fact since we set our fiber she have the one nothing at all belong in here what this means though is that we can also drop a soft solver in here and if we wire this in and just make it go first oops I mixed everything up here in this order so now our SAP silver is basically acting as a pre salt so it's gonna be applied to this object before that them solver is and so that means anything we do in this office over that's how we can change the properties on our solid object so let's go ahead and do that let's do a really basic version let's just say that our fiber scale let's just give it a periodic function let's say our fiber scale will be equal to I'm gonna use fit one one all on pockets in a second let's just drop down and we'll go from 0 1 2 to 1 point maybe even two there we go so what does this all say well sine of time times time times two basically just means roughly every three seconds we're gonna get full cycle sine is going to return negative one to one so it used that's fit 1 1 which means fit from the range negative 1 1 to 1 to some other range and that from zero point two to two basically this means roughly every three seconds we're going to be sort of ranging from contraction by five times to doubling and so if we run this every step we're gonna basically update our fiber scale throughout this model and it's gonna follow this periodic function and it should just sort of policy an end run this sure enough it scratches out compresses in stretches hours and so you can see that it's really easy to sort of control our fiber scale inside a sob solver and we can start to get sort of motion being produced this way now what I want to do for this setup is actually sort of randomly change using some noise both the material W so both the direction of the fibers and this fiber scale and that's going to give us some really interesting dynamics it's gonna give us a sort of churning blob shape here so let's just go back out here and let's sort of initialize our material w to nothing it's not gonna like this value but basically just so that we don't have anything coming in this just feels more natural so we'll just initialize these variables but we're not actually gonna use any of these values except for fiber statements now in here I'm going to sort of get rid of this value and what I want to do at the outset is just three inertia lies everything and what I'm gonna do is I'm gonna set on our material W sure that's a vector so be at material W I'm gonna set back to zero just keep that where it was and I'm gonna set our proper scale to one and so this is basically a basin and now I'm going to use our handy soft attribute noise so we want to start with material W so we're gonna keep our signature 3d because we want 3d noise we want a vector somewhere in space and we're gonna keep our mode to additive because we just initialize this to zero so we're just going to generate some noise and we're gonna add it to this value of zero that's why we do this reinitialize ation step so we don't want to add it on every step to the previous material W we just want to cancel it out and then add a new one music this noise we're gonna call this the cheers of w and instead of using P I actually want to use this variable you can see here which is base P and this gets created by the solver as soon as you start basically when you set up this solid object it things li says okay where are all these positions at the beginning as soon as we sort of bring it in from this fangio where are they at frame 1 or the first frame of the simulation we're gonna store that as base P and so as we move as the simulation updates this thing will sort of turn and move around and stretch and so the individual P values for these points are going to be changing I want to apply my noise to base P basically to its rest space so we're gonna use that attribute base key for our location to drive the noise and we're gonna create material W the only other things I want to do I won't bother changing any of these noise parameters this will all work fine for the scale that we're dealing with here I do want to Center that on mice because we want both positive and negative values otherwise we'll all just point upwards into this positive or I guess where it's positive otherwise all our noise will point this way and our sort of positive direction positive quadrant we want it to be centered with people to have directions in every direction and then I'm also getting animate this so that means over time the noise that we're creating will shift and sort of also move around so now we've set up our fiber directions and we get some randomly stupid v or directions everywhere at each point I'm going to quickly normalize this so I'm gonna say okay yeah material W because normal line is beyond material W you don't necessarily need to do this but it's a bit cleaner and of course this is giving us uniformly in the range basically for that amplitude minus 0.5 two point five on each axis so we're actually getting basically a square of all you move noise so we want to make sure that we normalize this so that's going to give us random directions for our fibers now we just want some random skits so we can use another attribute no it is this one we want to be one dimensional think that we're generating a float this is just our fiber scale we're gonna apply it to bass p.m. and we actually want this to be multiplicative because we're starting we initialized to 1 so we're going to multiply this value of 1 by whatever we put in here that means the range that we give is going to be the range that we get out over because P fiber scale so we want to animate this as well we don't need to Center it but we didn't want to remap it you want to specify our minimum and maximum and let's just go ahead and use those values we've had before I think that was point two and two and so now we're getting a random scale and a random Direction that's sort of animating over time and if we run this we get this kind of fun churning blog effect which is of course not super useful but it does give us this sort of interesting shape that we can play with and maybe use for some other things so that's working out okay um I'd like to do a few more things here the first thing I want to do is sort of get a nice better resolution fascial on here and this is one of the really nice things about family one of the sort of main things about the font workflow is that you simulate on this sort of coarse representation but then you can apply these changes these deformations to something a lot more high-res and we actually don't do this in the normal certain point deform way the thumbs over itself actually supports embedding geometry and it does a kind of fit it does a deformation of your embedded geometry in an even better way than point deform well so let's take a look at setting that up well have that adhere to socks and we'll take our original base geometry and what we'll do here is just subdivide this I'm going to use open subdiv loops so I keep my triangles and I'm going to go up to save three levels this gives me a sort of nice high resolution mesh here compared to our original one but critically this match is still basically entirely there we go this mesh is still basically either contiguous with or inside of our tetrahedral fashion and this is really important when you have your high resolution geometry you want it to be at worst-case overlapping sort of directly with the surface of those tetrahedra and ideally it's nice to have it actually fully encased what you don't want is to have your down tree sticking outside of your touch mutual match because that basically means it's gonna have to make sort of an extrapolation of how it should be deformed and it will still work but it won't look as good and it won't be sort of mapped as nicely and of course it won't be simulated at all so you want to make sure that you're sort of embedding geometry is in the worst case basically completely overlapping with the surface of your tetrahedral matching and in the best case it should be entirely inside okay so that's all we really need to set that up and if we wanted we could even throw some movies on here so let's just get some holder TVs and I'll drop down now and I'll just call this PMV for embedding now we can go back into our top Network and go onto our solid objects and you'll see on this deformation tab way at the bottom here we have this embedding tab and so we can check this and what you'll see if we just look at our solid object over here we have this geometry container so that's the standard container that's holding our tetrahedral imagine if we enable our embedding geometry you can see it creates another geometry container so this little box means that this container is storing geometry this is empty right now but if we point to our higher resolution mesh here our D mu D now we have that meshes being stored in this embedded geometry container and when the FEM solver updates it doesn't just update the geometry it will also update this embedded geometry and that's critical and it's a distinction between sort of the point deform workflow because what you can't do is run a FEM simulation and then figure out what your embedded geometry is you need to specify it at the outset because it actually gets updated as the simulation updates so embedded geometry is going to be changed as this simulation changes so if I run forward you can see that these values are also changing so you want to make sure your embedded geometry is specified before you sort of cash out of your simulation now if we run this again you can see that it looks basically the same we don't really get any of that extra high resolution so what's going on here well by default we're gonna be looking at geometry that's sort of the main thing that we see and we're always gonna see that in dots so if we want to look at our embed a geometry we're gonna have to important that so let's go back to sums and we'll just drop down alt drag our net here and I'll just do a star solid star to make sure we're getting that solid object and we want to match geometry now by default the geometry affections will be the container called geometry that's the one that if you don't specify a geometry data path that's the one it'll look for because basically any solver that has geometry is going to by default store it in the geometry container but if you have multiple containers you can specify some other name and so in our case tweaking this right hedid geometry and now we get our i resolution to aadhyatma tree coming out here now you can see just a little bit here especially if I capture to the light just right in the viewport here you can see that sort of it gives this nice smooth shape it's doing a really good job of deforming this thing based on that underlying mesh but of course you are still limited by your base tetrahedral mesh so if we look at sort of these sort of diamond shapes here this is basically because we have that on top that triangular mesh underlying it and so that information is basically being carried over and there's only so much that you can get from the high resolution mass you're still gonna be constrained by that underlying one you can fix a lot of that with even something like it's smooth you can already basically get rid of a lot of those sort of pieces there and people even farther you get that even nicer sort of shape um so in general you can actually go quite far with your high resolution mesh even with a relatively low resolution underlying geometry so this still looks pretty good but of course it's always worth noting that you are constrained ultimately by your simulated resolution and you know that's fairly intuitive so the other thing I wanted to talk about with this setup was this sort of turning blob thing gives us a nice a nice context for looking at skin effects in a p.m. and this is one of the sort of fun things that we can do with the FEM solver that a lot of the other solvers you know it's a lot harder to do you could potentially sort of fake it in Belem but skin is really nicely supported in fel and this is what gives you a lot of your interesting creature effects and creature dynamics because if you think about it sort of an animal you have your bones grabbing your muscle and you have a fat layer and then you have skin sitting on top and the reason you get wrinkles and skin is because skin is its own shell it's basically a layer that's sitting on top of all that stuff that moves underneath and so when the things move underneath they deform the skin but they're not rigidly locked together so in a p.m. we can basically define a skin layer on top of our interior dynamics and by tweaking sort of the stiffness and constraints of that skin layer we can get some nice wrinkles going on here so let's take a look at that workflow first thing I'm gonna do I'm gonna go back to our original sphere and I want to bump up this resolution a bit once we're looking at skin we basically need our base geometry our simulated geometry to have enough resolution to support wrinkles so right now we could get some pretty large ridges and folds but I want to bump this up a little bit so we can get some sort of smaller details and so it's just like really nice wrinkles in here I can bring this up to let's say maybe even well basically I want to keep my solid conformed total yeah somewhere around eleven thousand that's not so bad we could go a lot higher than this of course I just want it to be able to sort of update fast enough that we can do something useful here but we still have enough detail that we'd probably get some interesting little ridges and folds from this so to get skin what a fan wants is not just a tetrahedral mesh but actually some polygons as well so by default a solid object is just tetrahedrons when we want skin we're actually gonna use what we call a hybrid object because it's a hybrid of tetrahedrons and also a layer of polygons so if you look at this object here we don't actually have any polygons we have it's primitive sir disease and tetrahedrons we want an extra layer of polygons here and this is something solid can form can do nicely we just check this box add surface triangles and now you can see we have the tetrahedra on the inside but we also have this layer of polygons on the inside and if we toggle over here you can see that now we have points primitives vertices polygons and tetrahedra so by clicking this we basically get an extra skin layer and then we'll understand this if we use a hybrid object I'm gonna go ahead and sort of add a special group for those exterior polygons because what I'd like to do is apply all of our material W all of us sort of fiber scale updates to the interior stuff but not to the skin directly I just want the skin to respond to what's going on inside here so let's make a group for our skin call this skin and we can do something really easy here because you can see that these are polygons there are the only polygons so we can actually go in our base group to geometry filter and select just polygons and so now if we click what we've just made group if we split on this group we split on skin you can see that now we just have the polygons coming through in that skin group and we just have the tetrahedra coming in on that remaining group so we'll pipe this in through here we'll set up these values again all of that is fine nothing else really needs to change out here in sums but now let's go into our dock network and we want to replace this solid object with a hybrid object so here's that we're gonna have mostly the same properties here so we'll go to deformation will point that to our initial geometry Geo and we're gonna go to our embedded geometry here and we'll grab that yes we do I just want to check that how big is this now oh it's still not so bad we had sort of higher resolutions begin with and we subdivide at the same amount so I just wanted to make sure it wasn't too crazy but this I sort of high-resolution mesh but it's not you know it's not in the pocket okay we'll head back into tops so we're just gonna swap out our solid object for our hybrid object and I'm gonna go into our stops over here and I just want to use that skin group to restrict what we're doing this is fine but when we do our noise I want to just apply this to anything except skin same here and same for our fiber scale we're basically just going to apply it to the non skin tetrahedra now on the hybrid object you can see that we have on the model tab I guess we didn't even look at the model tab before on a solid object on the model tab we have things that control the stiffness of this object so we have an overall stiffness for the entire shape that will multiply these other values and then we have a shape stiffness and a volume stiffness and these are best understood just by playing around with values here they are interdependent so they don't you can't really treat them as totally independent orthogonal you don't want to drop either them to zero you don't want to go crazy high with either of them you want them to be sort of balanced in a way so these default values are fine for what we're doing right now but in general you know volume stiffness is trying to preserve the volume so if you allow shape stiffness to be really low volume stiffness really high what you'll get is something that the form is really nicely but still prefer preserves its overall volume if you've ever really high shape stiffness then it's basically going to try to maintain it's sort of its contour its overall shape in addition to trying to maintain its volume you can play with these different values this default will give you something soft something that will squish but preserve its overall volume works reasonably well now on a hybrid object we have both a shell and a solid and so the solid has the same properties as a basic solid object so it has overall and then shape and volume the shell which is the exterior polygons as a thickness value and a shape stiffness and a bend stiffness and so I'm just gonna move over to a little visualization I made because to understand how to get nice wrinkles we want to understand this shape and bed stiffness and if you hover over them shape stiffness this is basically the sustained deformation tangent to the shell so that's all along the surface Bend stiffness it says it's resisting local deformation in the direction normal to the show so watching okay and basically what this ultimately means is that well I'll show you the visualization let's go out here I have this stiffness demo over here and right away we see something we're gonna see a lot probably in this tutorial if you view 2d knee a bit you've probably seen this before the scene we often sort of forgets how to update itself and we have geometry that's not actually visible anywhere but it forgets to get rid of it sometimes you can just toggle away it back but often you have to basically create an entirely new scene viewer and get rid of the old one for a table date properly because that thing wasn't really there I found while working with found that this happens a lot especially when I'm doing fem I don't really know exactly what makes you teeny upset this way but it's easy enough to fix it just means we're going to be creating a lot of extra scene views every time our geometry doesn't update correctly in the interviewer here but and we're fine and so what I've got here are two identical spheres I basically did sort of the same setup that we looked at before the only difference is I initially measured the area of each primitive here and then I just moved one copy over to one side one copy to the other side and inside our doc Network I had one of these objects with very high shape stiffness and no been stiffness on the skin and the other one has no shape stiffness with very high Bend sickness when I bring them back out with the import and measure the area again and I basically just calculate an area ratio so let's just go ahead and visualize that and so if I play here let's give ourselves a bit more space okay so what we can see here on this side we have the high bench stiffness on this side the high sheeps difference and you can see just by looking at the shape stiffness and starting to get these little folds they're not very dramatic in this case but critically none of these are changing color over here we have a lot of triangles that are smaller than they used to be and a lot of triangles that are larger than they used to be and basically what's happening is a bench stiffness wants to preserve the normals it wants to keep a nice smooth sort of normals pointing outwards and it doesn't want normals to rapidly change from sort of one point to its neighboring point it's doing that by allowing the shape to compress so if the forces are pushing these regions together when you have high bench stiffness but low shape stiffness it just allows these triangles to get compressed so the individual shapes are changing the normals are being preserved and so you end up getting this nice smooth contour it's almost like you have a really stiff elastic shell sitting on top of something on the interior it's gonna try to keep itself nice and smooth in shape stiffness we don't see any of this discoloration or this sort of visualization coloration and that's telling us that our shapes aren't changing at all the areas of these triangles are basically identical to how they were coming in what happens instead is if we're trying to push these regions together it says well the only way to do that is to increase folds because I don't want to allow these triangles to shrink or expand so the only way to get them to sort of obey those forces is to let them full to let them sort of change the normals so all this is to say that if you want wrinkles what you really want to do is bump up the shape stiffness Bend stiffness will give you a nice smooth contour like a very elastic smooth tough shell shape stiffness is going to give you these nice wrinkles so if we want wrinkles we really want to boost shape stiffness so let's switch that off and head back to our noise here and so if we want to I shape stiffness then that's gonna give us our wrinkles and so by default it's got a shape stiffness around 2000 and event stiffness of 0 so we'll take a look at that but actually to get really nice wrinkles I'm going to crank this from quite a comic but let's just start with this and let's head out and take a look at our imported geometry here now it's gonna be upset initially because we're still pointing for that solid object we want a hybrid object so let's just a start on our hybrid and there we go and we've got another one of our scene update issues there we go that's fixed this time so now right away you can see that we are starting to get some of these interesting sort of folds so as we go through here we're getting this sort of extra movement that extra interaction of that surface so that's looking pretty good I might even throw because we put let's smooth this a little bit I'm gonna leave this move off actually for now because it takes time but let's just throw a quick shade on here because we did bug you these on that's not updating does have you these why is it done shop there we go again we have to update that scene view so if we run this through these you these can just help us to see a little bit more of these distortions that we're getting and you can see we're starting to get some of this sort of wrinkling appearance but it's not nearly as much as I would like and so what we saw before is to get really nice wrinkles what we need to do is really crank that shape stiffness so I'm gonna go back to here go to my favorite object and I actually want to boost this quite high I'm gonna boost this up to something insane like let's do 26 so this is a really strong shape stiffness but it's gonna give us some really nice wrinkles so let's just rub that okay now if we go back out to our geometry here now we can see we're getting these really nice wrinkles coming through it's really sort of puckering and it's looking like over here we've got some really nice wrinkles going on there basically whenever it's sort of indents whenever that geometry is pulling inwards this has no choice but to kind of buckle and give these interesting ridges and folds going on here and so if you want that nice wrinkly exterior that's what you're going to want to do you're going to want to make sure that you have a really high surface stiffness being applied here or shape stiffness rather and actually we can see it better without those DVDs on there participated you can see that we do still have some of this sort of triangular patterns going through but now if we give it a little bit of smoothing you can see we get this sort of really nice that's a really interesting folds and grooves here and yeah that's basically all I wanted to talk about in this first set up really just a basic introduction to this idea of our material directions and our fiber scale and how we can sort of modify this inside the simulation to sort of push and pull on our different fibers and then of course adding skin because that's always fun so main takeaway there if you want wrinkly skin hi sheep stiffness okay now for our second setup instead of using noise I want to use something a little bit more strategic or a little bit more deliberate here I'm gonna call this line periodic and it's a secondary name sorta inchworm because what we want to do is basically now use periodic functions and be a little bit more deliberate about our fiber scale to set up a kind of inchworm style movement so I'm gonna head inside a new geometry here and I'm just gonna drop down box I want this to be kind of kind of long and kind of flat so I'm gonna give it something like I don't want it quite as tall as it is wide I wanted to basically have a very clear sort of bottom and a top and then I'm gonna make it fair a bit longer here maybe longer that axis so here's our basic shape I want this to be resting on the ground because it's actually going to be moving along the ground and so that's where it will start I'm going to drop down a remesh here get it nice and triangulated I want these triangles a bit smaller that's looking pretty good I'm gonna bump up the iterations to get a little bit more regular that should be a decent enough start and now I'd like this a little bit more rounded we want to make this kind of like a little worm so this box is not quite right so let's just do something like a really strong smooth here and now we've got this kind of funny capsule shape and that will do just fine it's not exactly the most exciting model or anything but it will give us sort of what we're looking for to basically set up these dynamics so with that taken care of let's talk a little bit about what we want to do inside of that and so I can illustrate this really easily basically what an inchworm does is it sort of contracts and expands over and over again and when it contracts it basically latches to the ground at sort of one end folds itself up which brings it at the back end and then it holds on with the back end and pushes out forward again so we wanted to kind of contract and relax contract and relax and the way we're going to do this we can see pride show a little demonstration here I'm gonna measure area on these primitives I'll call this rest area then I'm gonna drop it Bend some get a measured area again and I'll call this Bend there and then wrangle here and I'll just say change equals area dress and we're gonna head down here and we're gonna visualize that just click on that attribute and you should get a visualizer here there we go no the Ben saw I just want to sort of set this up so our couch over origin is at the sort of end of it so that's gonna be 1 2 5 and 1.5 should be over here our capture direction is long said and our Lancaster so now if we bend this thing go not getting my visualizer suggests to me that we might need a new CPU till no visualizer why is that oh that's right I've done this before um area is on primitives Mary hears on primitives I did a planar angle here so Bend area and rest area on primitives I just made it these are 0 of course so I think is changing I want to do this primitives now our area change there we go now we can see and all I really wanted to show here is that when we bend what we're doing is compressing the triangles on the inner side and expanding them on the outer side and this makes sense if you think of this as like an arc of a circle this circumference is going to be smaller than the circumference as we contract in and what this tells us is that if we want to cause our shape to bend what we can do is contracts all the fibers along the bottom and expand them along the top and that will cause it to sort of bend in if we flip that then we expand the ones along the bottom and contract them along the top then we'll bend in the other direction and so we can set up a really easy sort of directional bending by using kind of a top and a bottom group and causing one to contract while the other expands so that's what we're gonna set up here that's our ultimate aim fix this there we go so of course we're gonna need to start by just creating our tetrahedral geometry I'm gonna use conform again just because we do have these nice triangles there's not too many of them it's only five thousand tenths so that's no big deal so we'll take this of our basic sort of tetrahedral mesh then I'm gonna go ahead and create a couple groups I want these to be point groups because we're gonna be manipulating our fibers on the points so I'm gonna have a top group and I'll just keep this in bounding regions and let's make this matched to our original box so I'm gonna grab this size I'm going to paste those relative references here and I'm just gonna make sure it's expanded a little bit on exit said that gets this box here but this time we want the top because I said it's a top group so let's just shift it up and there we go very grab base with the top half of the points and this doesn't have to be too exact but this should do just fine for the bottom will do basically the same thing but this time we're going to not shift it up so we'll just leave it zero there and we'll only grab the bottom ones there we go so now we have a top and a bottom group that's all we really need we'll drop an attribute Wrangell and set up our fibers and so this time what we want is to basically contract the bottom and expand the top or vice versa we want to do it along a consists of axis here so this is a case where we're basically just going to set our material W at the beginning and we're never going to change it again so our long axis is that axis here and that's what we want or our fiber axis so we'll save our material W is just 0px I'm gonna leave our fiber scale at 1/4 now we're gonna be modifying that inside and stop solver and I'm gonna go ahead and say our fiber stiffness I actually want this to be pretty high but not too quickly something like 20 should be fine and this again we're also not going to change so it's really just fiber scale we're gonna be modified so it's almost all we need up here let's just drop our geometry I'm not gonna worry about embedding geometry here because I just want to show sort of the idea of how to set up this movement at this workflow obviously this funny little laws in shape is not super interesting so there's no real point and also bulking it out to a higher resolution version so if you want to do that then you know go ahead and do the same workflow we did last time but I just want to focus on our basic dynamics here so here's our thumb geometry I'm not network and this time we want a little bit more we do want to ground length it's gonna be moving long ground we want some gravity so it's stimulating properly so I'll just fire those together right off the bat I'll put down a multiple solver and then we want our solid object oops else do our solid object stop solver and our salt right why are those in here why are this here and this will be our basic setup so again nothing too complicated but here we go and go to the ground plane I'm gonna take its friction down a little bit just so this thing can kind of move around a bit and I don't actually want to display it because of our scene view this grid here is actually our current solid objects this is just geometry that shouldn't be visible let's see if we can get rid of it nope it's duck seed new there we go this is the default FEM geometry which we don't want so we'll just go to deformation and bring in this guy and bring in our pure energy and there we have that so here's what we're gonna be working with and let's go ahead and set this up in our songs over so to get us started let's just look at sort of a periodic contraction and expansion and we'll see that it's not really gonna move itself because we need something extra before that happens but let's just see how we can get this to sort of behave in the way we might want I'm going to drop down your angle I'm going to do another one of these little reinitialize steps and all I want here is just a set by your scale we're gonna add some extra stuff in here in a bit but for now this is this is a now for our contraction what we want to do is grab this based on say a periodic function so you wanted to sort of regularly contract and expand to kind of like the very first thing we did with that sphere earlier so I gotta make a variable I'm just gonna call this off and I'm going to do it one block because we're going from negative 1 to 1 and we're going to do a sign like time and I'm multiply that's Drive so every 2 seconds there's a little pulse let's go up to 4 and for now I'm just gonna fit this to 0 to 1 so we're just taking the range negative 1 to 1 and nothing into 0 to 1 and the reason I want to do this is because I want to feed this into a ramp and so a ramp expects 0 to 1 so we're just gonna set that up right away so this pulse variable is gonna range from 0 up to 1 and then back to zero back to 1 etc etc and although just keep looping that way so now we can use this to drive our fiber skin and critically we'll do this separately for our top of our bottle so if it's our top group we're gonna say 5 or scale people's we're gonna fit the output of a ramp this whole study so rampant gonna return about even 0 to 1 and we're passing in a value and 0 to 1 so it basically just read maps those two into the shape that we're gonna give it on the ramp so we're gonna fit that value into basically our minimum and our maximum output here and what we want for an inchworm is we want it to sort of contract on the bottom so it should really get in here we want it to go really contracted on the bottom to really expand it on the top but we don't want it to necessarily flip in the other direction so we want it to give us look an inverted U but we don't want it to sort of flip up in this direction so we want it's resting to be certain like one on one end of our periodic function but then contracted on the other so for the top that means our minimum value should be basically resting one our maximum value should be more expanded for our bottom our minimum value should be more contracted less than one that our maximum should be one so for our math here but the top we're gonna go from something like one two let's say three and then for our bottom bring us a our five scale one passage bolts in this case we want them out from subject lower than one let's say one six five up to one I'll click this little button here so we get our ramps created and what I want to do is basically these are going to range fairly smoothly I actually want the transition to be a little bit more abrupt so I'm gonna grab these I'm going to make it a bit of a smoother interpolation and then I'm gonna add some steps here and it doesn't really matter which way we do this as long as we flip it so if we're increasing in this direction for the top then we want to decrease for the bottom it's not 2 cubic I'm just gonna flip these oops there's lots of I want value there it is this one down zero so now these are flipped so when one is going up the other will go down that's what we want but I also want this to be a little bit more step so I'm gonna add a couple extra points here I'm going to put one and say 5 5 and we'll bring that all the way up to save point eight I don't put this at four or five and bring it all the way down to there just making a little bit of a step function here I'm gonna do the reverse over here so at four or five at 0.8 and then at five five will go down to your point - so now we'll be getting these things flipping and so if we do this what we should see we use our initial sort of step of itching or our inchworm so what it should do is basically contract and then relax sure enough we got our contraction relaxes back to flat and then it contracts again and relaxes back to flat so now we're getting this nice sort of initial scaffold behavior for the inchworm but you'll see that it's not really going anywhere it does need to be drifting a little bit in the negative Z direction because it's not fully symmetrical so this isn't like a perfectly symmetrical mesh here so there's a little bit of force imbalances and that's causing it to drift a little bit but this isn't really what we're looking for French warm movement to really get it to start to locomote what we need to do is let it grab the ground somehow so we need the front to be able to grab while it's contracting and then back should grab flowing relaxes so to set this up we're gonna need some target constraints and if we look at the solid object here you can see this tab for target deformation and in the most sort of classic format how you would use this if you would specify you would have some other animated geometry that has the same topology the exact same set of points as your tetrahedral mention so you have sort of your arrest version and your animated version and then you would use your animated version of the target or for your sort of simulated version and it would sort of two very recent strength try to match that and that's how you would normally use this you can also specify this yourself that you can set up individual target points for each point and you can change the strength individually by point by point so what we're going to do to grab the ground is we're gonna say certain points are going to be sort of locked to their current position when we grab in space and that will give it sort of our rigid sort of constraint at that point so if the ground at the front will basically say these points should be stuck commissioned to use those harder point their current point and then when we release it'll be free to move again so we're going to use this sort of target strength information but we're not going to pass in an animated geometry we're just going to update this stuff ourselves so the one thing we need to set up out here is another few groups and in particular we need sort of a front and a back so let's drop down another couple of groups I'm going to call this one front again it should be points and I'm going to use a bounding region here again I'll just grab this and move this by hand make sure it's wide enough to get everything and I'm gonna leave this in a sort of problematic place to begin with and then we'll talk about this in a moment but I put it something like there we're just gonna grab a good chunk of the front and we'll do something very similar for the back back and for the back we just want a bit do the back and that's looking fine there so now we have a front group in the back we go back inside adopts what we want to do now is specify when should the front grab and when should the background and there's a few ways we can do this with the main way to think about this is when we're contracting we want to grab with the front and when we're relaxing we want to grab the back and so the way to think about contracting and relaxing is basically based on this this poll study which is going scroll up here there we go this pulse attribute that we specify here is going from 0 to 1 and then back to 0 and then back to 1 and then back to 0 so this is giving us a sense of what's happening and in particular when it's contracting that's when our pulse is increasing that's when we're going from 0 up to 1 so that's where we are increasing the top and decreasing the bottom so if our current pulse is higher than our previous pulse that means were contracting if it's lower that means we're going in this direction we're going back down that means that our bottom is relaxing and our sort of sorry bottom is relaxing at our top it's relaxing so basically when pulse is increasing that means we're contracting and 1 is decreasing that means we're relaxing so all we need to figure that out is to actually just store our previous pulse so let's do that up here let's say 3 12 equals false so before we calculate our new one will distort our old one and on the first frame this will just be 0 and that's fine let's trumpet it attribute wrangle and we'll call this grab logic and so what we want to do here is basically just test for the front of that group um whether or not they're in those different periods will say if yeah in front root then if both greater that we have graphic touch and I'm just gonna go ahead and set our target strength value which is our multiplier on sort of how how strongly is to try to reach its target position we haven't set a lot of that up yet but the basic idea is that we'll set target strength to one here and we'll do the opposite for the back so we're in fact group then we want to check if we have the ground I'll just set your target strength the one so now we always have our target strength being sort of set to one we're never setting it to zero and we're though so let's go to re initialization here and let's just make sure we that back target strength should be zero I'm even gonna go out here and make sure that our target strength is set to zero at the beginning so we want to make sure that only the points that are currently grabbing get any target strength everything else should not be paying any attention to its target positions and speaking of target positions what we're going to do for that at the outset you can just go ahead and set our target position it our resting position because it's strengthened zero this doesn't really matter we're just giving it a value that kind of makes sense what we're gonna do inside the solver is at every step we're gonna reset our target position to our current position this means that as soon as we grab we're basically locking ourselves to the position that these points are already at so we don't want it to grab - it's sort of resting position here we want it to grab wherever it currently is and so at every step we just update the target position and if it's already locked that it won't really move much it'll stay wherever it grabbed and if it's free to move that this will continue to move we'll keep updating our target position now with this in place if we go ahead and run it we still won't see anything and the reason is we've set up sort of our targets strength on the points but that's actually a multiplier on the over all tarted starting with money object and so even though we're not specifying an external target deformation we still set our overall strength here and so we want to update this value and I'm gonna make this quite large I know from experience that about whatever this Savin ends up being what is that 2 billion I guess about this value we got sort of a nice behavior here and you can see this target and damping value updates on its own this is actually gonna be a problem I'll just sort of show you here so you know it's behaving very strangely here and we're seeing some weird things but one of the main things that you're seeing is it's actually starting to float off of the ground here and it seems like it's not really even sort of updating in the way it was before we're getting this really kind of strange behavior going on and what target damping is doing is it's basically trying to kind of resist overly quick accelerations and snapping to targets and it practice what it seems to do I'm not 100% sure because you can't open this solver there's nothing to see you can't really unpack this so I don't have a real sense of how it's using this value but in practice what it seems to be doing is basically smoothing these target forces and so even though target strength on the points is set to zero for like almost everything in here it's still be using those target values to try to sort of update things and it creates this really weird dynamic across the whole structure and the way to solve this is to just set our damping all the way down to zero you basically don't want any at all we want these handful of points that we are actually grabbing with to have the full strength right away and we want nothing else to have any strength alone if we do this let's just step out to here I only want to see that one object and I actually want to visualize our target strength out on there and now if we step forward you can see that right away at the first frame our front group is grabbing and now you can see the back group is sort of pulling towards it and then as soon as it releases not sure why it stopped grabbing their crowd and then it let go a little early why is that happening let's just see what we're doing here target stank there we go I said target stink which is how thing we want to target strength there we go okay look we head back out here now we should see this alternate grabs at the front grabs at the back however it's still not quite working right and there's a few reasons for this one of the biggest ones right now is that when we grab at the front here we're not really letting it contract very well and part of the reason is that we're grabbing along this bottom surface here and in fact we're grabbing all of these individual points and they're grabbing wherever they are in space and that means these are locking a lot of this orientation and they're really constraining the ability of any of this to move and there's two things I want to do first of all there's no reason the top should be grabbing if we think of this that's actually a physical system that's grabbing the ground at the front it should only be able to grab where it's in contact here so we want to add something a little bit extra into our code in particular when I commented grab potential what I mean here is that while this condition of active while pulse it is greater than previous pulse that means we should be able to grab with the front but we still only want to grab with those points that are near to the ground and so we can test that so we actually want an extra condition here we just want to say is our PHY less than some gravitational ground fresh and in that case we'll set our target strength to one we'll do the same thing here and then just update and then we want to grab threshold and we want it sort of reasonably small let's say something like point one let's so you can see only those points that are near the ground are actually gonna grab so that will get us part of the way there let's just take a look at this now now it's working a little bit better you can see it's sort of pulling up at the back it's struggling to move forward at the front there and part of the problem that's still going on here when we grab the front let's just get to some point where we've grabbed we're still grabbing along this whole bottom service here and what this is doing is in the same way that when the whole thing was active here it was sort of restricting the ability that nearby stuff to move by grabbing along this whole bottom surface here with a lot of these sort of oriented along the ground parts what we're doing is constraining the ability of this stuff to bend and so for our front group we really want to make sure it's restricted to like the very front end we want it to be able to grab on like this surface here well we don't we're on there really grabbing on the bottom because when it does that the rest of the structure can't bend around it and we restrict our ability to move so let's go back to our front group here and you can see we're selecting a lot of these sort of bottom surface I want to pull this really far forward here I want to basically move it so that we're only really getting back tip there and this means it'll actually contract in a little bit before it grabs but that's totally ok the back group this is a lot less important because of how it's gonna move and how it's gonna push we don't really mind it grabbing as much but I might even pull this back a little as well I don't want lots of points grabbing I just want these little focal areas so now if we try this you can see right away it's pulling itself a lot farther forward and that's because it's only grabbing on this part here and that's allowing it to hinge a lot better than it did before so you can see it's actually sort of rotating around to that point when we have that much larger surface it wasn't really able to do that and so now fingers crossed we're getting a little bit of this movement coming sir stop moving very quickly and part of that is it's not really getting much push from the back that's not relaxing quite fast enough although it's doing all right but it's sort of just falling down like it's restricting how much it moves a little bit but we're not getting much forward push for that back stroke and we're actually sort of falling back so let's see what we can do to fix this but you can't see that it's moving it's not moving quickly but it is moving forward it's sort of steadily making that forward progress and that kind of in Shoreham way but let's see if we can make this a little bit better and one thing we might look at is our stiffness so if we look at our object here we've got a shape stiffness affording the volume stiffness level of 100 I think what I want to do is let it shape stiffness get a little bit higher that should make it a bit more rigid that should again resist deformation of these triangles and that means when it's sort of pushing when it's sort of up at this point you can see what it's doing right now is it sort of letting a lot of these triangles kind of compress and stretch if we up the stiffness a little bit then it might actually be able to generate a bit more force through these links so that when it's kind of relaxing it might actually push this out a little bit farther so let's bring up our shape stiffness to maybe 100 or so and if we take a look now it's off up by far actually and then there we go it really pushes it actually kind of launches itself a little bit and so that's looking much better great it's got a little like symmetry it's kind of going off to the side of it here but this is good enough for sort of showing you what we're looking for on this setup if you wanted to restrict a little bit of that sideways motion you would basically just have to control the bottle a little bit better you might even babies typically give it some steering and you could totally do that by adding left and right contractions and doing a similar logic there you can actually steer this little blob here but basically I just wanted to show this simple inch warming set up because it's a nice example of basically getting a regular motion and getting some self locomotion using basically just a periodic function and a tiny bit of logic so we don't need any keyframes or anything like that and we get this nice sort of each warming option okay now for our last setup I want to do something a little bit more complicated we're gonna sort of build out this inchworm idea we're gonna make something that's more reactive so instead of driving ourselves with like a noise or with a periodic function we're gonna drive with math and sort of responsiveness to another target geometry so let's just drop down our angle or geometry here I'm gonna call this one reactive we're gonna make something like a little sort of deep sea anemone so I'm gonna head in here and let's start with some geometry I'm gonna start with speared as before I'll make this polygon the size doesn't matter too much we're gonna be adjusting a few parts of this but let's just say let's get our frequency up a little bit maybe contender so I was looking pretty good no I actually only want this upper hemisphere and so who will just do a poly fill we're probably fill and a single polygon spot we're gonna be rematching all this and everything so this is gonna be kind of the base now onto this thing I'd like to add scatter and add a bunch of little tentacles so let's go ahead and clips some normals on here I'm just gonna have point normals I just want to make sure they get sort of attached to any points I scatter and then I'm going to do scatter and before I do this I basically don't want any right in the ground here I'm gonna want to be able to sort of adjust this so let's go ahead and drop down another attribute Wrangell I'm just gonna use if that's the expression x AMC is one but if you got Y is less then let's say point two equal to zero and we can go here and use a density attribute and you'll see a Bolton scatter any Longbottom there now 1000 is still gonna be way too many we want something like maybe eight or so no Kevin so onto these points we want to attach some tentacles so I'm gonna start with the line and I'm going to orient less zag so when you copy something to a point that it has been normal that's basically gonna be facing long sense you know orient was long dead like the tube is fine so if we were to just copy these two points hitting our normal here why is that oh I turned it off I meant to put that on points everything so now we've got these pointed outwards from that sphere here so these are gonna be kind of the scaffold for our tentacles I'd like to do a few extra things I'd like them to vary a little bit in their length and we can do that pretty easily I'll just throw down attribute randomize this the one I want this is what yeah and we're gonna call this scale should be three-dimensional and basically I just want to randomize the z-axis so I'm gonna make sure x and y aren't changing at all but then we're not gonna modify very much it works range from point 8 to 1.2 we do that so I'm never gonna be a little bit longer some will be a little bit shorter just get a little bit of variation there okay now we don't actually just want a line here we want this to be sort of a geometry so let's just look at a single line here I'm going to be you first resample this get a lot more sort of integrals on here I might even do more than that matter let's just go crazy with it we're gonna be very matching all of this anyway and I'm going to add a curve you want here I'm gonna take this and I'm gonna use it to drive P scale so we're gonna say P scale it's gonna be and call this scale ramp and we're gonna pass it curfew so when you specify curve you it basically just gives you an attribute the ranges from zero at one end to one of the other it's a nice feature of resampled so we're using that and we're basically gonna scale we're gonna set a ramp for this value so we'll be able to basically it's kind of visually adjust what size this will be from end to end and we'll fit this from sort of a maximum size which will maybe just all will adjust all deuce let's say my phonic 2.0 service down we'll get a ramp full adjust that in a second and the last thing I want to do is just drop a poly wire and on here I'm going to use a scale for the witness and so now we get this shape and it's kind of tapering down based on its ramp that we have here so if we throw this into our geometry to copy under our points and then just for the sake of seeing it all together visualize here we're starting to get this kind of an appearance obviously this is too grainy but it's it's getting us in the right direction here so obviously we're gonna want to change our sort of maximum and minimum weights here our maximum is probably a little bit too high let's drop that to maybe point three that's looking a little bit better we're gonna want a lot more divisions on here get a little bit rounder it's not bad but we could go up to say twelve that's looking okay and now I would like to I'd like to adjust kind of the shape so it's not just this perfect tapering here I'm gonna grab these I'm gonna make them a little bit smoother I like monotone cubic and let's just sort of taper it a bit got this like in verdict from how I want it that's right we could we could invert but this this is fine okay so we won't arrange from our maximum at one end to our minimum at the other and no I didn't want to invert this this is just gonna bother me a little bit and so I'm into a problem I'm just gonna flip these values so we go from our minimum to our maximum just feel a little bit more intuitive to me there we go and now we can adjust this a little bit more directly how we want so I think I'd like it to sort of taper a bit maybe something like something like this and maybe let's let's switch these to us wine might look a little bit better there we go okay now now we're starting getting somewhere I think that's the sort of shape I want a little bit of this this curve don't happen there and I need to want the text to be a little bit narrower 104 even 2002 do narrow there we go dr. Tam all right so that's looking pretty good the next thing I want to deal with is this fact that we're basically sitting on top of the sphere here and we could deal with that pretty easily what I want to do after this scatter is basically just take these points that we're going to be copying to I'm just gonna shift them kind of inside that sphere a little bit so we'll just say IP minus equals are normal and so now you can see that these things are sort of recessed on the interior here and we can even potentially bring this up a little bit we don't want to go too far we want to go sort of just as far as we need to and that is looking pretty good if we look at one of these we can see it's not kind of popping out anywhere on those edges that's sitting entirely the interior here oh that's perfect these tentacles overall are seeming actually a little bit short so maybe what I'll do is bump up the length of this line to something like - and that's looking a lot better to me and we can even just scatter a few more on here let's go I'm still gonna get lunch of these around the bottom that are pointed sort of straight to the side I think I'd rather them all be angled up a little bit more so let's go to this threshold here and maybe move that a bit 2.3 a little bit better let's even try one two three five and that's looking pretty good to me they're all basically angled upwards but we're still getting a nice a nice mix of them so this is roughly what our base shape that's going to look like okay now what we need to do at this point is instead of merging I want to make this into a single geometry I'm going to do believe that's gonna give me these and then at this point I'd like to I'd like to go ahead and remash and then I want to submit with some of this because if we were to look at this with at regular shading we have these really obvious joints here so I think I want to smooth it out a little bit of this and what I want to do is basically make sure we only smooth nearby to the sort of is interior I don't really want to move out towards the ends of these and we can do that by setting up a kind of waiting function so let's go onto our boolean here and let's actually output our scenes and I want to output basically all of our seams so I want to make sure I get it seams between individual tentacles I'm not sure if we have any in this particular geometry but we might if we sort of randomized other grinders this one looks like it might be so I'm gonna output basically all of our seams but I'm just gonna call them all scenes if I may promote this I'm gonna take oh that's a group if I do they promote I'm going to take teams and bring them up to points and we can see here are all the points noted there so these are all of our scene points and what I want to do is basically set up a waiting that is high near the scene and low pretty much everywhere else and we can do this with distance from geometry and so I'm just gonna take the geometry with the attributes beyond we're going to apply this to everything we don't need to specify anything here and that geometry I basically want to see how far away are we from this C group so I'm just gonna type the same geometry in here I'm gonna use the group scenes and in that group is a point group and so now we should be able to get this distance attribute we just visualize this sure enough we get the distance from those scenes and so it's very low here and very high up here I'm gonna take that distance value and I'm gonna remount and smooth I'm gonna say pass so W is going to be let's just fit its distance from zero to three and we'll have a weight from what we initialize this that's maybe a little too localized let's go up to the state point five and that's giving sort of a nice range that's fairly restricted to these arrogance so now we can go and do a blower and we can specify that smooth smooth wait we're blurring the-- I'm gonna help you stop sign is fully and I'm going to really just get a bunch of those in there and that's entirely too many a little bit farther trouble which get all the way up to 2 this is blurring too much maybe 3 I'm part of the issue here actually is what we don't have a fairly consistent geometry so let's just go to these for a second and even on the poly wire that's maybe remesh thank you so that's obviously too coarse we'll bring that down really nice and high detail this is just gonna again we're gonna rematch before we go into the simulation so I'm not too worried about having too many polygons here I really want a lot to work with when I'm setting up the initial so in fact let's go ahead and talk about this original sphere okay so that's looking a little bit nicer and now if we go to our blur everything else should propagate and yeah that's a lot that's a lot more friendly that's not gonna sort of pull in the same way it was before and maybe we can let those sort of taper off but it's never quite fully zero well okay that's probably looking all right down to five or so there we go that's looking a little bit better we just have these nice much smoother sort of boundaries here it doesn't look like they've been grafted on quite as much this is all a little bit besides the point for this for this tutorial what I did want to just kind of smooth okay now basically what I want to do here is I want to have each of these tentacles be able to react to some other geometry so I'm basically gonna have like maybe a little point drifting around through here and I want to each of these tentacles independently to kind of reach towards it and so basically when there's a point like here for example I want this tentacle teammates would contract on the near side and expand on the far side and if we apply this to all the tentacles they'll all this and sort of reach and follow and try to sort of grab towards any living object we have here so for this to work we need a few things we need to make sure we have sort of groups that are telling us when we're a tentacle and when were sort of the middle part and we want to understand basically for every point where we're facing relative to that original tentacle so to do this I actually want to go back to this type of bowl and I want to keep this original line because this is gonna be really useful this geometry is kind of what its gonna look like but I want to keep this original line because it tells us sort of all the information we need this gives us like the axis so gonna call this three axis I'm just gonna merge this in for us to the geometry here and so now the output of this copper dick points actually has those lines in it if I split them out if I just say give me the axis now I have each of my tentacle axes I'm also going to go in here maybe on this one and let's just say I have I'll say T ccl4 tentacle is our point none and so now we should have a different value for each of our tentacles here I'm going to promote that value of two primitives and so now we have a line for each tentacle and we have it's sort of number so we can individually identify each of our tentacles and we sort of have their specific access down the whole day with reference answer pay attention to really easily now let's go back to our overall sheet here and we want to turn this into our tetrahedral - so I'm just gonna go ahead and say solid in bed I'm going to stop this because it's going to do a lot of work with this we have really small triangles it's go to manual for a second here on the solid in bed I'm going to switch this local scaling to constant and this is gonna let me basically specify roughly what size triangles do I want so we do that with one we're not really getting you know we're getting an OK representation actually but it's not it's not quite good enough this is only 3000 tents I want to keep myself in a round a 10 to 15,000 tech budget that should simulate reasonably quickly so we still have some space for that I'm just gonna keep an eye on our sort of base mesh underneath and look there 10 - on top so I'm just gonna scale this down a little bit let's try point 5 didn't make much difference let's go all the way down to one a little bit smaller but we're still only looking about 3,000 tents let's keep dropping this down until we start to see something you like well that's looking a little bit better now we're getting these nice regular tetrahedrons we have reasonably full encapsulation there's a few spots like here where this stuff is sticking it but that's still okay even for our thing and we have about 12,000 touch regions so that's not bad at all and if we click this what I really want to see keep them low the plane what I want to see is that we at least have some points on the interior things its tentacles and right now we still don't have a long but it's probably okay we aren't getting a few in here I think this will be fine these are relatively thin tentacles but as long as we have our surface points we should still be able to drive our dynamics okay okay so this is our basic tech mesh and we want to assign some groups on here because we want to control these different points in different ways depending on where they are so the first thing I want to do is just set up base and I want a core region as well and so for that I'm going to take this original shape I'm gonna convert those two polygons I'm gonna do the V DP polygons or sorry I've been converting football you rather point one's pretty good all you color just why not so that's looking alright and what I want is a relatively large version of this am I going to do a video game reshape I'm gonna dilate that's basically just going to expand it outwards that's back there we go and I might even go by about two I pretty one I just want to exclude the basis of these tentacles as well I don't want them try to sort of stretch right at the base so I want to keep all of this is like my base part so that's looking pretty good for that I also want to contract it a little bit and set up a core region so for this time go to the road and I'm going to use it bring that down I want to Road quite a lot but I actually I want it to go right down to the ground here so what I might do is take this original sphere instead of the clipped one and we'll just put that in here there we go okay that's gonna be good I'm just gonna keep pulling this down six eight I think that's looking pretty good and what I basically want to do is I want to have this core region have a target so this is gonna be locked to the ground so everything inside here is gonna have a target it's gonna be sort of restricted to that spot this outer region that's still in here this is just gonna be the base and this is just Mississippi leaf really it's not going to be sort of updated it won't have any fibers it won't have any targets this will basically be locked to the middle by that core region and it will be sort of moved around a little bit by the tentacles doing their own thing but otherwise this will just be like the base region okay so using those let's stop screws here drop naturally Frankel and let's just flip these around so this is our core and this is our ogre so let's just drop those in there and these aren't sort of surface distance representations as volumes so basically we can sample each point and say are you inside or are you outside of that volume and if it's inside then the sample will be negative so we can just ask if only example sampling the volume column surface if we look at this geometry here this primitive is surfaced so that's what the song is called by default for these pdbs so if we sample that composition at this point and it is less than zero then we're inside that region so we could say oh here's one and we'll do the same thing for our second input there that's left for zero the sacred base and so you know we can we can just take a look at these so we can say let's color our base here yellow you can see that that's highlighting all of these regions and if we go ahead and color our core no blue you can see that we're getting our core identified and we're getting our base identified here and we're clip through you can see that that core is throughout the middle here and then sort of it turns into the base and then the base turns into these tentacles so that's perfect basically it's everything outside of the base is a botanical and in fact maybe what we'll do we'll leave this one but we'll actually even put that explicitly we'll say otherwise so for this second sample so this one is just with the core the second sample we're out of the group or were the tentacles there we go an outdoor joke here and instead of talking about stuff let's just make sure that this group looks okay the tentacles selecting anything if we color the tentacles yeah we just get those regions okay so that's perfect now with these groups established call this basic groups the next thing I want to do is pull over some information from these vaccines specifically for the technical group so let's go over it here and I'm just gonna call this let's only work on the tentacles now that we've specified that group and we're gonna need all this access information so what I'd like to do here is get a few things I want to get a central index so we know uniquely each tentacle I want to get the main Direction access this is gonna be our material W so we want to know the direction of each tentacle and I also want a radial direction and we'll see how we'll use this later but this is going to be really important so we can get most of this information pretty easily I'm gonna specify a primitive and a vector uvw I just want those values exam I'm gonna use X Y is that dist which is basically gonna find the closest point on this geometry so even though these lines only have two points each if you look here on X Y Zed disk won't look for the nearest point like if we didn't hear points it'll just find the nearest spot anywhere on this geometry so for each point we're gonna find the nearest spot on that geometry extreme one to our position and these values PRM at UVW I'm passing in here these are actually being treated as addresses and what that means is that I'm not taking a return value up front I could distance I actually don't care about the distance itself what I care about is where it hit this primitive and so what these values do is they'll actually be returned with new values so I didn't relax anything here but XY is this that disc will put information on these values and it will tell me what primitive it hit and it'll tell me the primitive unique where it hit so those are the pieces of information I want so I'm gonna just actually oops I'm going to look this up and flew tentacle index this is just going to be is a high hat TCL people print from stream 1 that value T TCL after the primitives that we intercepted so if we go here now and if we just add for example a visualizer to these tentacles we should see there we go we should see that we get sort of the unique value for each of these and you'll see that this one here is the same value as a base and that's because the base is getting a value of 0 because it's not specified so let's just go ahead and set that whole initialize it's negative so now each of our tentacles is getting a unique ID and that's perfect and it's separate from the base which is just saying it's not any tension at all so that's great we're getting each of those independent tentacles next what we want is the main direction of that tentacle and that's reasonably easy so we're just gonna go position 0 it's gonna be a point we're gonna grab it from that stream we're gonna grab the position attribute and we're going to use as a point print point from the print PRM the first one because we know that each of these primitives only has two points these are just the lines that we made up here as we know they only have two points we don't gonna have to worry about anything else there so I'm just gonna get the first one of those specify that that's an integer because we're using it inside a function here so we're just gonna get the position in that first point and then we'll get the position of the second point and now we can say our material W so the direction that our fibers should contract which would be along the axis of each tentacle whoops there but that material W should just be normalized position one minus position and the direction doesn't actually matter but these will be pointed outwards and we can see that if I get rid of everything except for the points here for a second and then add a visual eyes are on and material W you'll see we get these lines pointed outwards everywhere so each tentacle is getting its own axis and we can see that all the points inside that tentacle know what direction they should be facing now we're almost done with these attributes the last thing I want is to figure out for each point relative to the axis where is it facing so if I were to sort of cut into one of these things I want to see radially pointing outwards for each point what direction is it away from the axis and this is going to be really important but later for figuring out which direction it should contractor' expand so to get this value what I want to find out is where was the position that was nearest so this XYZ dist it found the nearest position that's specified by the primitive and this uvw I want to find that position so I'm gonna call that axis pose and we can get that using a function called trim UV and this will basically let me ask for the value P so the position value at on this primitive at this primitive UV so this isn't a texture UV that's the primitive UV and it basically specifies coordinates in the context of this primitive so this is going to tell me what's the position where I found that nearest distance so that's my access position now if I want my radial direction all that's super easy I already know that time that this position minus or sort of my my current my individual points position minus this position is already going to be orthogonal to the axis it has to be that's what it means by this being the nearest point because we're taking the nearest point to a line we know that it's already going to be orthogonal which is what we want so if we just take the subtraction it's going to give us that radial different distance or that radial direction another so I'm just going to say V at radial is going to be carnal eyes this it's gonna be our current position minus the axis position axis and that's normalized so now if we visualize these you can see and I'm just gonna turn off the material w1 you can see now for each point it's basically pointing radially outwards it's telling us what direction is this and this is kind of like the normal so we could potentially do this with normals but the problem is we have points on the interior as well and those don't have sort of defined normals so doing it this way we basically get a point for every sorry a direction for every point that tells it radially where is it going relative to this to this Tentacles axis so now we've got all the values that we need to be able to sort of start making something interesting happen here and the basic idea is going to be we want when there's a point somewhere in space we want that side of the tentacle that's facing towards that point to contract and the side that's on the far side should expand so we're going to use that same inch where logic but we're gonna have it reactive do something else so I'm just gonna show you how this is gonna work let's just add a point here I'm 22 make a little spear here to see this point a little bit more easily sphere I do want to keep this Hertz there we go ah so that's here somewhere in there let's just move this point of it I'll bring it up and over somewhere around here and this is just for a sort of demonstration sake so if we've got this point here we want to figure out which surfaces are facing and what it means for a surface to be facing is basically that it's outwards direction from its axis should be aligned towards its vector towards this point and so we can actually test this pretty easily and we're going to be doing this inside inside docks but I just wanted to sort of show you out here what we're what we're about to be doing so basically all i want to do is say for each point i want to get that position from this point they only have one so i'm just going to 0 if we had multiple we would just use near point but i'm just gonna grab that initial point so that's my I'll call this target position and then we can define the vector toward to be normalised target position - our current position so this will give us a vector pointed towards that circle now what I want to do is say let's get the dot product and the dot product I just show you once we've calculated it but let's take the dot product of our radio onto that torque vector and if I visualize this those radials go for visualising dot product so when I visualize this what you can see is that all of the surfaces facing this circle are one color and all the surfaces facing away are another color and what dot product does is it basically says it ranges from negative one to one and it's one if the two vectors are in the same direction and this negative one if they're opposite directions and it's zero if they're sort of orthogonal to each other and so what we're doing is we're taking the vector from a given point to the target and we're taking its radial vector relative to its axis and if they're pointing in the same direction then this is the side that's facing towards this point and if they're pointing the opposite it's the opposite side and so on our solver all we have to do is take this dog product and use it to drive our contraction so if we're on the interface that's facing towards we want to tract and on the outer face we want to expand and that's pretty much all that can you to do here so if we take this point and you drag it around you'll see that this updates really easily it's getting a very very simple computation the dot product is not a difficult thing to do but you can see that it's nicely the reflecting at any given moment for each sort of tentacle which part is facing and that's what we want so let's leave this point here and let's just call this our target we'll make this a little bit fancier in a minute but let's just leave that for now and then we will go to our tentacle properties here the last thing I want in here is a basic 5 properties so let's go ahead and say our fibers stiffness is going to be 10 times normal and we'll keep our fiber scale and actually let's let's set this up in a separate thing because we want to make sure that everything isn't defaulting with fiber scales at 0 so let's just go fiber properties and we're gonna say 5 scale stiffness will also be one just so by default nothing is gonna be moving you're gonna say yeah we're the kind of group over that our fibers stiffness in fact let's just let this initialize a few other properties here let's set our target position to be our current position but by default will say that our target strength 0 and only if we're in that group for generics are expected be higher so that should give us all the properties we need and at this point I think we are ready to go into the doc Network and in fact we're just about done really all of the difficulty was in getting all this stuff set up at this point we're pretty much ready and everything should just work so we'll drop her that's the AMA tree here and that work I'm gonna add a ground plane even though we don't really need to collide against it I'll just keep it in here we can want some gravity I'm gonna drop it down though because I like the idea that we're sort of underwater here I'll just merge these together I don't want to see the ground plane and then I'll drop as before a multi solver solid object solver and femme solder are those in artists here and let's start setting things up so I want to grab this one but are reactive one I wanna grab our dumb geometry here there it is I'm going to go ahead and say our target strength should be pretty high let's just say 110 like before I'm going to get rid of this damping I just want that inner core region to be attracted to its target so nothing else should be updated there and we'll see if we want to change it to the model parameters for right now I think this should be okay so if we were to run this we'll see that all our tentacles are kind of falling down they're basically getting sort of drawn by gravity a little bit too much so maybe we'll bring up this stiffness a little bit more and maybe we'll need a drop gravity down a little bit more again I want this to seem sort of under water so now at resting it's still sort of drooping but I think this is pretty much okay you can see already the ones that sort of first bounced are kind of rebounding to where they were before so that's nice we get a little bit of reactivity to gravity but mostly it's just sort of City roughly at rest so now let's pull in our target we'll do that that's OP solver we'll start by reinitializing so I'm just gonna go to our oh I have two groups here tentacle and tentacles alright let's just fix that's let's figure out where I did that here we go so that group never existed so let's just make sure all this was tentacles plural yeah so that was the group that I'm a here was tentacles plural because I sort of asked about two tentacle without it it just created that group but you want to make sure that's not there okay there we go so just for the tentacles group we're gonna start and we're just gonna say factor scale okay so we'll just reinitialize that and then we want to bring in our target that's this null here and we're just gonna grab this function told you attribute angle and we'll just drop this right in here again we only want this operating over the tentacles and so we're gonna get that target position from this street we're going to get the vector towards it and we're gonna take our dot product we don't need to store this as an attribute though so let's just keep it locally and now all we want to do is say our fiber scale it's gonna be fit 1 1 because we're fitting in the range from negative 1 to 1 that's what dot product will give us we're gonna fit that value and a negative 1 we're facing away so we want to expand so let's call this 1.5 and at 1 we're facing towards so we want to contract 0.5 and that is basically all that we need to do so now if we run this what we should see it's all of these tentacles reaching and grabbing towards that once possible in fact they're going a little bit crazy about it but that's kind of fun they're really sort of moving in over each other we can see a few problems here we can see that they're all colliding with each other so that's no good that means that they're probably moving a little bit too quickly we can double check that we have our collisions here's a problem so right now it's not colliding with connected components although we are colliding within the object so this should be able to collide with itself let's just make sure all types these connected components yeah so by default it wasn't letting itself collide with its with anything that was part of the same object and so now we're making sure that it can collide with itself if you're still getting collisions the easiest way to deal with that is just up your subsets subsets I'm not just a familiar from just about any solver I think they're starting to interpenetrated probably this means they're trying to update too far in one step and they're missing the normal collision tests so if you just up two sub steps it'll go a little bit more slowly and I'll move resolve a bit more easily so right now this thing is little intense with it's grabbing here it's kind of fun we're getting some like interesting effects in here but I think that's maybe a little bit too extreme so let's go ahead and kind of change these numbers a bit maybe this was too much let's go to say 1 3 and and now they're still reaching quite a lot but it's not quite so crazy it's beautiful okay so that's pretty cool in fact if we came back out here and grab just our solid object here you can see the turnouts they're all grabbing towards the position of this object here so now what we can do is animate this position and I'm going to do this in a really trivial way just for the sake of demonstration here I'm going to take this point so let's just put it back at zero and let's get a reasonable height egg it's probably fine so we'll start at the middle here and then we're just going to use a few sort of periodic functions here so let's say sign dollar F F out here in translate this expects the sine function here expects degrees index expects radians I don't really know why it's set up that way but that's fine I guess because our rotate context here also expects degrees so when you're in the transform node when you're using sine and these expressions it expects degrees not radians so if we just do frames we're not even gonna get a full resolution or a revolution in this period so let's just get this a little bit faster let's go seven maybe and that's gonna go from negative one to one that should be okay for a range do something similar here I'm just gonna give it a slightly different value I want this to basically be sort of oscillating irregularly then on Y let's give it its own sort of oscillation but let's make sure that we multiply this by much smaller value I don't want to range it plus minus one so if we just take a look at this thing here see what it's doing you can see it's sort of wobbling around and this is kind of all that I want just to be able to show how these tentacles to it I think that's looking fun so now if we go back and run our simulation again I'm actually gonna merge these together so we can see it all at once I'll give our target a little bit of color so it pops out and now what we're getting some weird scene update let's just fix that here there we go so now you can see that these tentacles are all reaching towards it and as it moves past they start to shift and they start to reach towards its new location here and so as those target moves around each of these tentacles is continuously trying to figure out where is this ball relative to the direction that radial position is facing and the tentacle will try to contract towards it and expand on the far side so we get this nice sort of reactive behavior here that's fully driven by math so we don't have any certain kind of functions we're not using noise we're not using in key frames or bones or rigs or anything like that we're just using some very basic math and a really trivial idea that if you can tracked one side and expand the other then you get a bend and so that gives us this kind of fun effect here now right now we're not getting an egg collision with this ball that would be easy enough to fix but I might not necessarily go through that in this in this tutorial because I think we've covered a lot already but what you would do is just turn this into a FEM object and as long as this thing had a target that it was following you could have it colliding with these things and oh what the hell let's let's actually just do that it's actually quite quick don't you take that sphere it's already a let's turn it into polygons let's give it a little bit of resolution actually that's probably just fine - I wanna make a bit smaller that's looking fine let's do a solid form like that through here we don't need this anymore and that was just for visualization so now we're bringing these tetrahedra through and what we can do here is just do a time shift and we lock ourselves in frame 1 this will be our base geometry all this all base and this will be now we can go in here and just bring in another solid object merge those together and they should both sort of respond separately this one we're going to point to our base and then we're gonna go down here and we're going to allow target deformation and we're gonna point to that target and I'm gonna bring up this strength pretty high I'll allow the target damping at this point because we actually want this entire ball to be sort of getting updated by this movement with that in place that should be all that we eat because in here we're already restricted to the tentacles group so none of this will ever apply to the ball so we don't have to worry about our Somme solver the only other thing I want here is our target now we could follow that point and in fact actually it is easiest to follow that point um what you could do is basically take this entire set of geometry and just look for the nearest point and be drawn towards that but it's all centered around this point anyway so it probably makes a little sense to just leave it that way so now we should have this ball and it's still going to be moving around because it's got a really strong target constraint here because this value is really strong it's gonna be following that constraint really tightly if we dropped this way down to something like 100 this ball will probably start to fall it's basically not really be able to follow its target target constraints well enough because they're not strong enough so it's being pushed around by other forces a lot more but as long as we have this nice and high this ball should follow its its course relatively well but if it ends up sort of running into any of these tentacles now instead of just passing through them make sure we didn't catch any fats I just want to see a collision here somewhere escape there instead of passing through them though it should now just be able to collide with them let's just wait to see example yeah sure enough in this part here I think previously it might have sort of collided our overlapped but you can see that now this central is not passing through it it's actually bumping into it we get this little bend here and so all we really need to do to get collision is to allow them to get to the same simulation the way we have here and now the tentacles won't pass through each other and the tentacles won't sort of pass through at all and we get this nice sort of D so that's all I want to cover in this tutorial I hope you guys have learned a couple of things I think the fun solver is really quite powerful and it's actually not quite so difficult as it may be seems at first glance it behaves quite differently from a lot of the other solvers so it can be a little bit weird to get your head around it at first but it's actually quite fast quite robust and it does some really really interesting things once you get a hang of it so I hope that this gave you at least the tiny window into some of the things that you can do with it as always the hip phylum for this will be available on my website and I would love to hear it if you use this or anything if you make something cool leave a comment below if you have any questions or suggestions or things you'd like to see next or if you just want to say hi or sort of say that you've enjoyed this I always love reading those otherwise thank you very much and I will see you next time you
Info
Channel: Diffuse FX
Views: 7,866
Rating: undefined out of 5
Keywords: houdini, vfx, tutorial, DOPs, FEM, softbody, procedural
Id: K50aBkVNZjU
Channel Id: undefined
Length: 119min 11sec (7151 seconds)
Published: Mon May 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.