Intro to Simulation Nodes - Geometry Nodes Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we're going to be having a look at the new simulation nodes in the experimental builds of 3.5 we're going to be building this pretty funky little mushroom growing thing I want this to be able to sort of interact with geometry so it'll grow it'll try and grow upwards but if it finds some geometry it's going to grow around it as you can see that it's going to cover the surface we also have branching happening we also have an animation control so it starts slow grows out for the duration of the animation and then it's going to come to a stop so we can see that so there's a few things that we need to cover quite a few things we're going to be trying to build this whole node Tree in this session there's a lot of things to get into here so let's jump in the version of blender that I will be using I will link it down in the description but it is one of these experimental builds I am using December 10th uh 3.5 geometry nodes simulation build and what this means because this is experimental is by the time that you watch this video there may be parts of it which are obsolete but the general thought process the general movement that we are taking towards simulation in Geometry nodes this is probably I hope going to be consistent so there may be additional functions but the fundamental thinking should be the same and if you're watching this soon then it's just a fun project for you to use with simulation notes so a bunch of things for us to get into some new things we've not met before let's jump in before getting into the tutorial I just want to quickly mention a competition being hosted by our friends over at truevfx it's a render competition to create a beautiful winter wonderland scene entries open in the New Year through January and you just need to use these beautiful assets from trivia facts and PBR Max in your work first prize is valued at up to 620 and includes blender market products from trueview facts and a subscription to PBR Max for more details and links to the assets check the description below alright first things first we're going to need some geometry this is just the standard startup right so I'm going to add a plane and a new geometry nodes tree which I'm going to call mushroom simulation I'm going to save this and we're going to be working with multiple objects today so I will just be pinning this node group just to make sure that it doesn't disappear as we move around let's also rename our object to be simulation and that's fine for now make sure you're saving as you go this is really important when you're using experimental builds using new features they will crash if you do too many control Z if you there's just going to be some instability this is a development build so make sure you're saving Save Right to start so you've got some Auto saves going and let's begin I'm not going to be using the group input we're going to be creating our own object so let's start with that this is just kind of our our build up to doing the actual geometry nodes with the simulation we need to start with a curved Circle and onto here let's just do a set radius and in front of that let's use a curve to mesh node I'm going to use another curb circle on here essentially we have just made ourselves a Taurus set this like this there we go so we have a little donut going I'm going to make this a little bit smaller just so we're not taking up too much space and then maybe 0.7 I'm going to reduce my minor radius here as well I just do something sensible and I will just use a noise texture 3D is fine 2D would be fine as well let's use the the factor just plug that straight in there turn down my detail turn down my scale until it's just general movements there we go something like this now this is just because we might want to use this mesh later as the thing that the mushrooms are growing off or however you end up meshing it at the end there's so many options in Geometry nodes we're just going to be using general spline skinning to give us the mushroom effect obviously you can do stuff with sdfs and volume cubes and just all sorts of mesh generation so this is fine we are going to distribute some points on the surface and this has given us our point so let's reduce our density a little bit just so we don't have too much computation happening right at the beginning and collapse this side first things first how do we even access the simulation shift a we have a new section for simulation and we can see a simulation input and simulation output which also says add this first I'm sure at some point it will be easier to link two things together for now you have to add the output first like so and then when you add the input you can see I have this sort of convex Hull frame being added here and this is uh great basically this just demonstrates where we have nodes which are inside the loop versus nodes which are coming in from outside we all get onto that in just a moment that's just as a first experiment and kind of the core mechanic of how we're going to grow these mushrooms in our simulation Loop this is a Serial Loop what this means is the data comes in from outside comes through whatever functions you have happening and then instead of just plugging directly out it's gonna basically keep looping back through and it's going to do this however many frames you have stepped forwards not from the start of the timeline but just how many frames you step forwards as soon as you ever go back with simulation nodes even if it's one frame it's not going to undo a frame because it hasn't cached anything in the current build it's not cached anything so anytime you go back it will reset so you only have kind of Ford's computation right now but this is how we can think of it right so every time every time we step forwards we do another iteration of anything which is inside this Loop and then we're just going to view the output what we want to put inside this Loop is an extrude so mesh extrude mesh let's put that on here now if I just change my bottom window here from an asset browser to a timeline let's get rid of these two sides and I'm also going to set my end frame something High maybe a thousand and I'll press home to just view the timeline properly as I move forwards we can see that nothing's really changed but we do have an error on our extrude mesh so it says input geometry has unsupported type Point Cloud let's just make sure that we've fixed this then so the extrude mesh needs vertices not points so let's add a point to vertices node in here and now if I step back to reset and I step forwards now it's going to start working let's just erase all of these annotations instead of extruding faces we need to extrude vertices so now if I step back and forwards we can see every time I go back a frame it resets and every time you step forwards it Loops so if I just press shift space then we can we can do that Extrusion all right here's where it gets crazy let's go right back to the star here just so we can count how many frames we've got if I go and keep an eye on the spreadsheet so I've got 40 vertices right now if I go four to one we have 80 okay it falls another one we have 160 320 640 and so on right this is doubling every single time we move forwards that's not really what we want we want to add one step every time but let's think about why this is actually happening the mesh data that is coming back around this loop we're basically telling it every single one of your vertices extrude the vertices and that is clearly a problem because we don't want to extrude every vertex we just want to extrude the top of the Extrusion I'm just going to make a bit of space around this I want to plug this top into this selection which means really I want to plug it into this simulation output and then have it come back through the simulation input but we don't have any option to do this exactly but we do have is named attributes so if I add a named attribute in here you can see it's been added to our frame our context hole frame just because it's showing that it is a sort of an integral part of the loop we're going to be storing a Boolean on the point domain for the top and let's just rename this attribute to the top and now what I can do with this is I can use the named attribute top which is going to be a Boolean as my selection so now rather than doubling each time what happens if we press play is nothing happens Okay so we've gone from too many to too few but we can kind of see that this is actually working in our spreadsheet we can also see that we have an attribute top now so it's being written right it's coming through the simulation Loop it's uh it's going through the extrude mesh and it's having an attribute stored on it and then it is going back through however the extrude mesh has this attribute on it and in the first instance none of the geometry has this so we need kind of a separate Clause so right now when we only have points and no edges then we also want to extrude them so if there's only a point also extrude that shift a we need a Boolean math node set to or because I need to join two different Boolean statements together so either the top Extrusion or we want to use mesh vertex Neighbors um so to explain this if you have a point here and it's connected to two edges like this this has one two vertices as its neighbors that's how this is you could replace vertex with Edge but essentially that's what it is so if it's not an extruded point then this vertex count will equal zero if you want to use the new mesh topology nodes come in here you also have edges of vertex and you can do the total is equal to zero as well there vertex count is just the same so let's plug this one in so now it works the first time because we have points and this is valid and then after that point you have an extruded Edge so this is no longer valid but we always have that first Extrusion which is marked as top and now every time we go forwards we just add 20 vertices so this is going to play a lot easier for us now these are all going in a random direction or not random actually specifically away from zero this is also not what we want we want to give this a little bit more control so let's move this through a noise field let's first of all rename these nodes this one is going to be our Point selection make sure you're keeping stuff organized here and these are going to be our input points all right let's deal with our offset because that's going to give this a little bit more interest as we go through here if we just add a texture noise texture I'm going to set this to 40 because I'm lazy and I want the W for my seed I'm going to take my color which right now is between zero zero zero and one one one and I'm going to set a mid level with a subtract Vector math node if I set this all to 0.5 then rather than 0 to 1 we now have minus 0.5 to positive 0.5 this can go into our offset let's go back one and now when I play you can see that we are walking through a noise field if I reduce detail to zero and scale to 1 Let's reset this now you can see that we've got some sort of curl my stuff going on this is always super satisfying I love this fun thing about using mid levels in this way is fundamentally it's not that complicated right it's a node group essentially it's just exposed and information goes through it and then it gets looped every frame so you just have to kind of think ahead a little bit do some of these extra bits of Boolean math to give yourself some information as well as storing named attributes and whistling through this because as we go through there's some more interesting stuff that I want to get into that is going to make your simulations a bit more uh responsive so let's get through this first part nice and quickly so we've got a noise texture and rather than going at 0.5.5 if I reduce the amount that I subtract in the z-axis let's go back to the start and we can see this so if I reduce this down you can see that we can end up going straight up because my Z is now between zero and one so if I set this to maybe 0.2 then we just get this kind of walk going straight up it's very fast so let's change our offset scale to maybe 0.2 as well here we go now it's a little bit slower just means that that Extrusion is basically a smaller step each step of the way now the next part of this is going to be how we get different noise per Strand and it's actually very straightforwards each one of these I'm going to call this spline it is actually just a string of mesh we can deal with as a mesh Island so mesh mesh Island we can use the mesh Island index as our seed value essentially our seed so let's multiply this to make it bigger just because otherwise there's if I just plug this directly in so when I reset my animation do you know actually it has done a fairly good job of splitting this out the lower your noise scale the more similar this will be so I generally just multiply this by 10 or some larger number just give me a little bit more sort of guaranteed variation between the strands the next thing that we want to do here is to Branch branching is a bit of an interesting conundrum and honestly not one that I fully understand so I would appreciate some feedback on the process that I'm going to teach you here so how do we Branch off what are the rules so after a certain number of steps we want to have some probability of creating a new spline that goes off in some new Direction the way that we can do this is we can duplicate a point and if we then rejoin it so let's go ahead and do that so shift a geometry duplicate elements I'm going to drop this underneath here we are interested in duplicating a point from our extruded mesh let's go with once you'll see why the viewer is better as we multiply because we have more points you'll end up getting more faster actually what I want to do is do this after the store named attribute and we need to make a selection this selection is going to choose which of our points are going to get duplicated to become a new Branch let's just have a think about this first of all I want to have a like a certain distance traveled before or a certain number of Loops traveled before we split off and do a second or a third or fourth split the way that we can do this um is not with a loop count value there's no count for the number of Loops we're in but we can set the probability based on the index of our points but if we look at our indices in the spreadsheet down this left hand side we can see that they just go up forever for all of it we want to work it out per string per mesh Island shift a utilities accumulate field the accumulate field is a sum Loop so the first point plus the second point plus the third point and they will count up if I use the mesh Island index as my group index then it's going to start from zero every time we count so this trailing value if I set this to integer we are going to add 1 for every point we reach so the trailing value is going to start at zero and it's going to add one for each point essentially the same as an index so we can use this we can say when our accumulate field trailing value is greater than some value here we can use this as our selection for duplicating points but if I just plug this into the output straight away and go for the step now we can see that all of these points have been created if I change this let's say maybe to 10 nothing's been updated and if I go forward to another step everything is deleted have a thing about why this might be think about how loops work think about where the data is coming from and think about what we've told it to do why has this happened so the issue is that essentially we're telling this to create an extrusion so it should be fine to take these points back through extrude them but then what we've done is we've said well only duplicate points which have a greater than 10 index and that first point is not going to have that so essentially we're not duplicating any elements and therefore we're not passing anything through so what we need to do actually is to join the store named attribute to this duplicate element so now what we have is the original branches coming through let's just go back to reset come forwards now you can see okay we have this awful system and it's working as intended very dense but what's going on essentially every point with an index greater than 10 if I come back here there we go we've split so every point it comes up to 10 and then when the index is greater it will duplicate that point the next Loop it comes through it will extrude at that point as a new branch and because the branches all have a unique noise they're going to go off in a different direction however the next frame is going to duplicate another Edge on this point and then the following point is also going to get Edge so now the first one has two next one has one do that again you have three two and then one four three two one and you can see how this very quickly becomes a nightmarish mess so we need to do something intelligent here every time it duplicates a mesh or it uses a point we on the next Loop need to block it from using that point again so we need to store a Boolean for when we duplicate and then on the next run we need to read it and say no don't use that so let's come in here and do that so in parallel to our duplicate elements we're going to use another store named attribute which I'm going to call block this is going to be our blocker it's actually going to use the same attribute or the same field I should say this Boolean so when it tells this one to duplicate it tells this one to add that vertex to a block list and then what we need to do is we need to subtract using a Boolean math node on here so we want to subtract some Boolean block from this list shift a input named attribute now we want our block list which is going to be a Boolean and then we can plug that into our subtract here let's reset our session and there we go all right so now this is said extrude and don't use this point again and something that is interesting about the extrude node is actually as it extrudes it will propagate whatever values that are on it so if you extrude a point it will essentially copy the values from that point which means that every sort of string as we go forwards it's only going to actually split once so you might want to do some additional logic to change this in our case this is actually fine because each one is going to split after it gets 10 further so we already have something that's quite beautiful there's a bunch more stuff we might want to do so for example we might want to add a random Boolean to this value so we say instead of every time you reach 10 we might change that or maybe we want to add a random value into here so let's let's do that maybe so we're going to use the island index as the ID so this is basically going to set well the random value is per Strand and then we can say a random value between say 3 and 15. so now some of these are going to split earlier and some of them will split later some of them are going to split wildly this is one of the things which I don't quite understand so if you are more okay with what is actually going on here why this just explodes like this please do let me know because it is it's like it reaches a Tipping Point now I'm quite happy to leave this as it is because I don't really want the full animation anyway so we're going to keep it somewhat reduced and in fact instead of doing this random value let's change this to the random Boolean so that we can set a probability and I will also set this to an and in here so another Boolean math node set and on this greater than with our random value here so now let's do a random probability per point so using this trailing value and we're going to set the seed so it's different for each string per index Island index so now I can set my probability something fairly low because we end up with more and more and more points I want to have as low probability as possible just to make sure we don't get an explosion going on let's reset this there we go that's a little bit more uh predictable all right we want to keep combing this it's all well and good having stuff just controlled by noise but we're artists we want control we want to know what we're doing so let's make sure that we do let's frame all of this up so that we know what it is Ctrl J this is our branching probability like this let's come back here we're interested in working on our noise textures so let's find where it first branches here is a good example at this point here I want this to actually branch in the same direction and then come off I want it to feel like it's split rather than just abruptly grown off an angle we can do this because we're dealing with information that is going through a loop and being fed back to itself we can actually have some really interesting controls going on I want to know at each point what the direction is for the point so what I'm going to do is I'm going to capture that direction attribute capture attribute I'm going to put that here and the reason I'm doing this capturing here on this mesh is because we're dealing with a noise texture which is randomized per mesh string and if I just find out what the noise texture is on the point well we can see that that's clearly different it's going off in this direction rather than this direction so I need to make sure that I'm capturing this value that goes up our main string and then I can transfer it to the point that's here and then I can use that to just give ourselves a little bit of interpolation so that we start there and then we go back to our own noise a couple of steps to do this so we want to capture a vector on the point domain this Vector is going to be our subtract value here this is our Direction so let's go ahead and rename this node to Direction we then have our Extrusion we are storing a named attribute and then subsequently what I want to do is I want to store another named attribute on my duplicated points this is going to be a vector which I'm going to call dir for direction this direction value is going to come from this captured Direction value so this capture Direction becomes stored on our duplicated elements and then when they go around again and they get extruded they're basically going to hold on to this Direction that's very useful because it means that we can do an interpolation here between the direction that's coming through and the new direction of the noise that it's going to get so let's just join those two together shift a we want a utility mix node set to vector and we are going to be interpolating from the value dir so that attribute we just stored input named attribute vector dir there we go and we only actually want to do this when it exists because it's not always going to exist it only exists on these duplicated points so if we just run this like this and let's say we put it completely into that dir value or we get no Extrusion right because we're doing a hundred percent of a value which does not exist in 3.5 we actually have this exists attribute here this Boolean so we can just use that shift a let's use a switch so utility switch I'm going to set this to vector and I'm going to be switching between this attribute if it exists and if it does not exist then we're going to be using just the noise so just just as if it was not plugged in once we've got all of this plumbed through we can actually start working on our Factor this is our interpolation so when we have two things like this and we want them to split like so rather than just cutting off like that what we do is we say while your index is below some value interpolate from this one to this one and this is nice and easy we're going to use that accumulate field again so just the same as we did down here I'm in fact it's going to just copy these mesh Island and accumulate field that's alt P to bring that out of that frame we're going to be counting up in ones this gives us our index let's take our trailing value through a map range and we're going to say index from 0 to let's go with 10 is going to be an interpolation factor from zero to one so by the time we hit one at frame 10 we're going to be using a hundred percent of this noise up to that point we're going to be using the direction so let's go back to the start let's see how this works okay so now you can see this split here is going out yeah rather than it just stepping out directly now we follow that initial tangent and then end up going in the correct direction we can reduce this even further let's maybe go down to five let's see how this looks that's a little bit more abrupt that might be good maybe we can even go down to something like two that's a little bit staggered so I'm going to go back up to five I think that was fine and that just makes these Forks these splits look a little bit more natural the cool thing as we leave this running is this is going to keep thinking right so each new one can split again you can see they're gonna split they're going to split they're going to split and we end up with this denser and denser kind of network going on what about the next thing there's always another thing we can do so in terms of control we've got all of our general it's noise and it waves around and it splits nicely now the next thing we want to touch on here is how do we make it follow a surface this is a process so just bear with me here go ahead and add a Suzanne mesh or whatever mesh you want I'm going to give this some subdivisions I want it to be smoother so I'm going to come in here just add subdivisions let's go for maybe two that'll be fine I'm going to apply that and I'm going to shade smooth so now I have my model I'm going to drag it into my node tree and I'm going to hit relative in here how do we make things follow a surface this is actually an interesting process it's easy Once you know how if you aren't that familiar with Vector math this is going to be a bit of a process for you just stick with me here what we have is our object and I'm going to set relative just to make sure that as we move this object around it stays relative to where I put it the next thing I want to do is we're going to be taking this noise texture as it is here and we're going to be feeding it into a couple of places we want this to just walk around the surface to walk around the surface I need to do a cross product operation a vector vector math cross product and we're interested in taking the cross product of our noise which is just an XYZ Vector at this point and the normal of the surface what the cross product does is it will take an axis so this can be our normal this is our face so we have our normal coming up here directly perpendicular from the face we then also have our noise texture and this can be in any direction for the sake of this let's say it's going over here and we have some angle in between them this noise texture could actually be in any direction but what the cross product does is it will return a vector which is perpendicular to the triangle made from the two vectors that you put in so we have essentially this Vector which is always because it has to be perpendicular to the normal it is always going to be walking horizontally across the surface so that's where this gets interesting right because we can start accumulating data as we Loop through here we make an extrusion we detect how close we are to the surface and if we're close we walk along the surface if we're further away we can just keep going up and as we get closer we can walk more and more along the surface so there's a little bit of interpolation and a little bit of vector map we've got our noise going on here let's actually just frame this so that we have it this is our noise we have our Suzanne monkey here and I actually need to sample the normals off here so let's do a mesh sample nearest surface using the geometry and this is going to be a vector with the normal coming through the value this comes into our cross product like this I think this is probably good practice let's just normalize the noise as it comes in here so let's use a vector map normalize this is just going to make the noise size equal one it might have the effect of speeding it up we will see we might need to scale this down afterwards this basically just makes this a little bit more predictable when we do the cross product and then we can use the cross product up here so again I'm going to make some more space here move these all back and that's because this noise as it comes through here this is now going to come from our cross product so let's come to the end of our simulation let's view the outputs let's make sure that we've got this selected so we can see it and then as we play it's going to race around but it's essentially is they're not on the surface which is why they're getting further and further away but you can see that they're walking around the shape of Suzanne it's a little bit crazy at the moment but this is just because we haven't really added any additional controls one of these controls is going to be a a proximity control so we want to once again use another mix node and we're going to be mixing from the normal noise just the regular noise to this surface version with some factor and this factor is going to be controlled by the geometry proximity distance here from the faces so let's just put this through a map range like so and I'm basically going to say when the distance from the surface is zero I want to use an interpolation Factor of um let's flip these two around actually let's put our cross product into the top and our normal noise into the bottom doing it this way means that our cross product is going to have an interpolation factor of zero so when the distance is zero the factor is zero and it will 100 use the cross product when the distance is one it's going to be using a hundred percent of just the noise so it will just go straight up is one enough let's have a look let's move this object up just a little bit so that we grow up to it and then okay it's a little bit crazy it goes too fast in my opinion let's maybe increase our minimum and decrease our maximum a little bit so it's a bit fast I let's mute our normalize let's see how this does that seems a little bit more predictable actually so we are clearly getting kind of stuck on the surface but I think that's okay maybe we just bring down this amount a little bit further let's just Ctrl X on how to normalize let's restart this okay now the really cool thing about this hopefully you can see this okay is as I move this around the animation is going to react to it in new locations so there we go the idea is that these don't want to go through her they don't want to just go through they want to realize they're about to hit her and then divert this is how mushrooms grow this is how plants grow this is just how a lot of stuff happens so here we go this is our section for responding to a mesh Ctrl J F2 respond to mesh and then we have our mix this is going to control the difference there and then we have this section up here which is smooth splitting there we go now at this point we probably want to try tackling skinning these meshes we have an object we have the meshes extruding all the lines I should say extruding but we're not actually creating a mesh that we can work with visually we can't render this let's do a very simple just mesh the Curve and then curve to mesh we're going to be using a curve primitive curve Circle as our profile curve there we go that's nice and easy might as well fill caps let's reduce our resolution to something sensible like Steam and we'll reduce our radius or will we we want to have some control for our radius because we want these to feel like they're growing right right now looks fine looks perfectly valid let's turn off my wireframe drawing for now it looks okay but not perfect I want these to taper nicely so let's add a set curve radius in here and just for the sake of experimentation let's also add a spline parameter node with the factor now I want to invert this so I'm also going to add a utility math node set to subtract and I'm going to subtract it from one there we go so now it's zero at the tips pointy tips and one at the base do you notice any issues as we climb up here this splits off and it says oh I'm the start of a new spline therefore I'm going to be wide we want to do some maths just to make sure that we're starting at the right width the correct width every time it always wants to know exactly the width of where it's been duplicated right but this value changes over time because if I come forward let's find one as it comes in there we go here's a new one the underlying mesh this one that's going off to the side here is becoming thicker and its factor is changing as it grows so we can't just transfer the data what we need to do is something a little bit more intelligent and I'm sure somebody will tell me there's a faster way but for now we're going to go to the hard math way it's interesting um but it's a process and it's all part of this kind of looping story named attributes reworking them later the way that we're going to work out what this value should be is instead of using the spline Factor we're going to use the index so if I have two splines coming up like this and this one is going to go zero one two three let's go up to four and this one is going to go zero one two three I want the ends to end up equaling zero right and I want the bottom of the bottom to end up being a value of one so there's wider at the bottom skinny at the top for me to make this work without having this issue where the zeros are always the widest point which will give me an issue here I need this point here to know that it actually came off at two we're going to do a little bit maths there's a little bit of kind of data back and forth here this is one of the interesting things about using these Loops it's kind of exciting when you start getting into it I've got my store named attribute and I'm going to add another one in front on this duplicated element I'm going to call this one BR for branch underscore idx for index so Branch index it's going to be an integer and what it is going to be is the value basically of which Index this point has along its own line so we're going to do the index accumulate thing again so Island index accumulate field it's going to come over here and I need to know what this value would have been over this side now I could capture it but this time let's try a sample because these are some new nodes and we should get used to them let's use our geometry sample nearest because I want to know what the nearest Value is to this duplicate elements point because it's going to be on the same position so let's grab our still named attribute down into here this is our sample nearest we also need a sample Index this just passes out an index value so let's do a sample index as well we're going to be transferring or sampling an integer value in the point domain and it's going to be this trailing value which doubles up as our index when we are just adding one for each point so trailing remember it starts at zero leading will start at your first value so we want to start at zero we can then transfer this into our store named attribute node and now later on we should be storing the value per spline that we have in our BR Index this is something that we can now use so let's come forward I've got my meshed curve set curve radius and curved mesh what we need to do is set our curve radius a little bit more intelligently so we have a few bits of information that we can use here we have got a curve spline parameter we have the spline index and this is a .012345 whatever up the length this is essentially the same as our accumulate field is doing over here we just have it because we have curves now we have this implicitly so we can use this index and we need to manipulate it a little bit so I need the spline index I need the named attribute BR index that we have not yet made so to just trigger that to make it I just went forward the frame by pressing right and we also need a curve spline length Point count so explain parameter and spline length these are a little bit different even though they both have the length on them this length is the total length per spline from start to finish and this length uh like this this one sort of increases as you come up the spline right so it's counting up what the length is each point that's what this is the spline parameter comes out from zero and the spline length just gives you the values of the spline if we think about our tree again we have two branches we have zero one two three four we have zero one two our spline length is going to give us a four four four four four four basically the length of the whole thing without a point count and in this one it's going to give us two two it's always good to have a real think about the values you're using we also have our BR index so in this case it's going to be zero because this one starts at zero and it doesn't have the value transferred to it so it will just read zeros and this one is going to start at 2. so we're going to start here in fact just for the sake of demonstration let me make this one go up to three just to make sure this is really clear what we're doing so we've got threes for our total length and we've got two for the position that we started out for our BR index to make sure that as we change this around what we want to do is if we add BR index to each of these then we're going to end up with five five five five and we're also going to end up with five four three two where we meet this end here this one we're going to end up with four four four four four and four three two one zero so this is still the same right we've just added zeros to it this one has now been changed if we add in each of these we're basically going to make this meet in the correct place so shift a you want a utility math node set to add we're going to take our Point count add BR index we are also going to do the same thing with our spline parameter index so both of these are now added to the connection point which is either going to be zero or some value once we've done that we can just subtract one from the other basically just how we did the one minus the spline Factor we essentially have the same thing here so starting at some value for example four if we go our solid value which comes from this top add from the point count and we subtract from that the counting up version from our supply parameter now we have a count that starts at zero at the end of our line and runs all the way down it so this is pretty cool it runs all the way down and it always meets in the correct place we just now need to divide this by something if I just plug this directly into our set radius everything goes crazy because it's if I divide this by some large value then you can see let's look for a split here's one you can't really see it because this here has the same radius it's all been fixed up all right let's just carry on so rather than just doing this divide manually I want to set this intelligently and to do this we're basically going to find out what the maximum value is in our set to do this we need an attribute statistic node we're interested in counting a statistic on some points and this statistic is just going to be from this subtract so let's plug this in like so and then let's just use a map range it's always easier utility map range onto this subtract I'm going to take the minimum and the maximum value I can just Ctrl H to hide all of that extra stuff and now I have radius controls so right now it's going to be zero to one but I can do something more interesting with this if I want to for example I could add some noise into our maximum size shift a texture noise texture and let's set this to 1D I want this to be just running up the length of our spline let's use a spline parameter node set to length um this is going to be important right if I use the factor let's put this through a map range as well just so that we have some control so the factor into the map range this map range goes into our two max value up here you can see that this is sort of moving around if I make this more obvious there we go as these grow you can see that noise sucks along the row I don't want that there so let's use the length instead because the length is going to keep adding to itself it's not going to slide right as a piece is made it's going to hold on to that size let's reduce our detail let's reduce our scale until we've got something lumpy but in proportion something around here and I'm going to make this much less abrupt as well 0.2 maybe to 0.8 and we're going to go from a minimum value of let's get 0.7 to maybe 1.5 there we go just so it changes a little bit let's also increase our minimum value here as well just we don't need to come to a point let's go maybe to point two okay this is all coming together the final main thing to turn these into mushrooms is going to be caps we don't have any caps on here so I'm just going to copy this object from my previous file and it is literally just half a sphere with the bottom color stretched vertically and a couple of extrusions inside it's very simple I haven't done anything special here so it's just that I'm going to put this into a collection on its own just hide it away and then in my node tree before the curve to mash because obviously don't want to instance it on here I want the instance on points on our set curve radius let's pull this cap in we could do this as a collection if you have multiples so just this it's going to go into our instance and we can view the output so right now we have way too many of these caps we want to make a selection of just the end points so endpoint selection node get rid of the start point and now we can see that these grow in the correct positions there we go that's pretty nifty there's clearly a lot of them going on here and they're not following important stuff like curve tangent so let's set our rotation up here this is just very standard stuff now a line Euler to vector we want to do the z-axis is going to be aligned to the tangent curved tangent node and then to stop these from spinning we also want to align while locking the z-axis because we've already worked this out I'm going to align either the x or y it doesn't matter in this case to the curve normal there we go and that's just going to stop it from spinning we also want to set the scale and that's a little bit more interesting if I just drop these down it's fine they grow extremely quickly but what we really want is every time they start every time the spline they are on is short we want these to have a small scale value and the way that we can do this is with our Point count node let's use the point count through a map range and basically say if you are in your first 100 frames for example then we're going to grow from 0.1 to 1 and I'm just going to plug this directly into the scale and there we go maybe one is too high let's pull these down something a bit more sensible 0.4 seems about right for this one we can always put a random value in there as well if you want some randomness so between 0.3 and 0.5 Maybe it's looking pretty neat I think this grows way too fast so let's have a look at adding a bit of Animation control I'm just going to frame this up Ctrl J these are our caps let's just join up our mesh curved mesh with this instance on points this is looking amazing I love it I might want to go a little bit thicker stalks um to do this we can just use our map prints down here and we can increase this or even we could do a bit easier oh we can increase our curved Circle plenty that was very low on mine just do this however you think fits best we could also set this up with some function of the again the point class because right now these are starting super wide looks a bit weird so let's just add a multiply on here so another math node set to multiply like this we are going to use a spline length node the point count here goes through a map range once again map range is your go-to node honestly for everything if you're not comfortable with a map range node get used to it it will be such a superpower for you so let's say when our Point count goes from maybe 0 to 50 we're going to go from some small value here up to one just so it grows nicely there let's maybe use a smoother step so we get some interpolation smoother step is like an S curve rather than it being just a linear a linear thing I think these caps are too big as well so we're going to just reduce those a little bit 0.25 to point four that should be fine so weird looking but I love it there's a lot you can do with geometry nodes if you want to make these look different the fundamentals of how we make the splines is pretty much consistent now it's just storing attributes and doing extrusions so the next thing I want to do perhaps the last thing I want to do actually is just set up the animation control it's very simple the speed of the animation is controlled by this Extrusion if I set my Extrusion to be slower we have half the speed if I increase the speed you can see they race away what I want to do is I want to have this controlled by some function of the frame count so let's add in an input scene time node I'm going to put this through a map range node once again you need the map range node our first frame is going to be frame one our final frame let's go with 300 frames um and therefore my animation is going to probably go to like 280. so it doesn't completely stop but the growth will stop I'm going to set this to be linear we're remapping 1 to 280 to be zero to one so I can put this through a float curve so now I have animation curves right now it's just going to go zero to one as we go um and actually I'm going to use this through a multiply into this offset scale so the fastest I want this to grow is probably 0.2 right you can see if I just play this it's going to start really slow and it's going to speed up a little bit up until everything is just going at 0.2 but we've multiplied far too many times by then so this is how fast 0.2 is I would say that's pretty quick let's bring it down to zero at the start we're going to go up to one in the middle and then we're going to bring our end down to stopped again just with a little bit of fall off so they're going to grow briskly and then we go around here we're starting to slow down a little bit until we come to a stop so that's fun we're getting some weird glitching with our tangents though so I might want to bring out that long section just a little bit there so if things want to grow up a little bit quicker and then they can slow down let's have a look down at our other sections do we want to change some of our probability um or what I was connected from what was that even coming off what is this what is this freaking experimental builds this greater than though I've got this set to 10 let's maybe go 15. so more frames before we start splitting and the other thing we want to do is reduce our distribute points on faces just let's have a look at the output of this just until we have only a few points here you could always do this you know more analytically you can do loops back to back and actually I want to show you a little bit of how you can do loops back to back so fewer mushrooms they're growing over the surface they're still splitting and they're going to grow up nice and tall we can again reduce the speed so if you want to go down to 0.1 I really love how they follow the surface it's so cool there we go you've got your a little mushroom Colony that will follow Suzanne if I want to move her a little bit maybe if I just go into edit mode here and duplicate a couple times foreign simulation nodes really really fun to play with so something just worth being aware of with your simulations if you want to do back-to-back simulations let's say you've added your simulation output node and then you've added a simulation input node these now paired let's come off our points to vertices and let's just join this through something worth being aware of if I push my timeline backwards so essentially uncaching your geometry nodes decaching them you can see that all of the previous nodes have a Time above them this is important because only the nodes that are being computed show the timing if you don't have timing it's on this drop down this is a problem because as soon as we start playing an animation so going forwards all of the prior values disappear and this is because as soon as the animation starts or as soon as the simulation starts this is a closed loop you can read it out at the far end but it's not going to read in any more data you would have to sort of join in again if you needed it why this is a problem is if you have another set of simulation nodes so if you're doing these in series right if you have something like this happening the problem is because as soon as this one starts doing its loop it's going to ignore everything that is happening in the previous Loop so you can do nested Loops that's fine but doing them in series like this essentially turns off the one before whatever its input values were they become fixed so how do you keep these evaluating I know this is a bit abstract but if you run into it this is the solution uh in in terms of like an example something for example when I was planning this one with the branching I just thought oh well this is fine I've got my extrusions set up in the first one I will just take the result of this and I will randomly select some points to become the branches and I will just do a second Extrusion pass this did not work because this second Loop closed off the computation of the first one the way to get around this is to remember that you don't have to have anything coming in you can do something like like this right where you just have a joined geometry so in this case we still have the computation coming through and then it gets frozen right as soon as this Loop starts that input gets severed it just becomes like a cached thing at this point and then we start looping and then this one is going to join up and then it's going to go through the process it's going to eventually basically start in the middle but because we're always joining to the closed loop this one is going to keep Computing so if you need to do them in series this is the way it's a bit weird because obviously this one doesn't have a connection but it has like a silent connection from the output and that's how you have to think about it so these Loops prevent prior computation it's fine if you can work out a way of putting it into a single Loop and really the trick is using named attributes branching and rejoining within that Loop and having some kind of Escape Clauses for for example using your accumulate fields or without Point selection we're using the top attribute but we also used to use points if they exist as their own selves so that's about it this has been really fun to get to learn the new simulation nodes if you do get a chance to play with simulation nodes share with me what you come up with I find it really interesting to see what people are making there's a lot of very new ideas coming out at the moment which are really exciting so there we have it hopefully you've learned something hopefully you've had fun and I'll see you in the next one [Music]
Info
Channel: Erindale
Views: 28,277
Rating: undefined out of 5
Keywords: simulation nodes, geometry nodes, geo nodes, b3d, sim nodes, l system, l-system, growth, tree, plant, responsive, reactive, open source, beginner, advanced, tutorial, lecture, workshop, procedural
Id: gMOgB7Ds3ZI
Channel Id: undefined
Length: 60min 35sec (3635 seconds)
Published: Sun Dec 25 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.