Simulation geometry node tricks - Blender

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome to another second Channel video and this one I'm just going to be talking about simulation notes and things that I've learned how to do with them so um it's not going to be about any one thing I'm just gonna be rattling off things that I know um so let's start off by adding in a plane it can be anything because we're not really going to be using the original geometry so let's go over to Geometry nodes I'll hide this on the side for now we'll pull it open if we need it and we can add a new node tree and just to explain what simulation nodes do the simulation Zone we'll leave the original geometry for now but we're going to delete it really soon so let's bring in a simulation Zone it'll have these two nodes right here and you can hook everything up like this basically everything that happens in this zone right here is going to happen every single frame so if we use a set position node right here and we place it on the outside it'll work just like uh like you would expect it to even if you press play it'll just stay right here but if we put it in here set it to something small like .01 and then we press play this will move up this distance every single frame and turns out you can kind of do a lot with that functionality and just so this doesn't restart after uh you know not very long let's go back and just turn this to a really high number I'm going to turn it to uh 30 000. it'll basically just not start over on its own okay so now let's delete the original geometry and I'm going to use some points for this to make it look kind of like a particle simulation let's add in a points node right here you can drop this in and a shortcut you'll see me use pretty often is a shift and left arrow and that's basically just going to bring it back to the first frame to make the simulation restart like this so I'm going to be using that a lot now we can uh add a lot of them maybe like 500 and I want the position to start off a little more random so we can drag this out at a random value right here and just so it's not only going in the positive direction let's set the minimum to be negative one like that and if you want this to change in size you can you know just move these around but usually what I'll do is add scale node this is a vector math node set to scale and then you can you know move it so I'm doing this all of this outside of the simulation zone so that you know we don't get points every single frame I'll show more about that later because you can get some interesting effects adding things in every frame Okay so press play this happens first thing that I thought of doing was just instead of you know adding the offset like this is you use some noise and it ends up doing interesting stuff because it's noise so let's add in a noise texture if you want you can just plug this in directly and it'll just fly away because everything is going in the positive direction so to make that not happen bring in a subtract Vector math subtract node drop this in set this to uh 0.5 everything to 0.5 so now this should push in every direction long story short this is three different values like we have here and each one is between zero and one so if you're adding it's always going to go in the positive direction but if you subtract it by five the mid 0.5 then the midpoint becomes zero and it will not just fly away basically so let's duplicate this with shift d turn this to scale so we can change the strength of it so now if we press play this will just spread out and go crazy you don't want to do that and turn the detail down and maybe set the scale to be something quite a bit smaller now these will fly away but in a more like clean manner like they'll be going into these like Trails like that and they will naturally kind of settle in certain spots that I guess must be um like low values like closer to zero so let's make this a little weaker so we can actually see it move like that if you don't want it to be in Trails like this as much then there are a few things you can do you can turn the detail up and things will kind of spread apart a little more or you can set this to 4D and you can change the W over time and it'll make it so it doesn't settle as often if you want to do that you can use a scene time node you can animate this too but I like to use the scene time you can just plug in the seconds and now um you know the texture will just change uh randomly in a smooth way like that another thing you can do to make them kind of not go into these Trails where they're all following each other is make it so that each point kind of at each point should have a different W value the way you can do that is with an index node right here so this is just going to like count the points and give them a number so you know the first point will be zero the second point will be one two three four it just goes on like that and then when you plug this into here all of them will have a different W value and it becomes a lot more random like this they'll move in the same kind of speed and manner it's just that they don't really move together anymore and you can make this more or less apparent with a math node set to multiply you can divide it to if you want and just make this like really small so they will still go in Trails but they kind of diverge from each other um a little more this is a lot more apparent when all of your particles start in the center because if you're not using this at all if you're not using the index to change the W then all of the points will move together like this but as soon as you plug it in they will start to diverge from each other a little more like this and you can see they naturally just kind of Branch away and create Trails like this and like I said The more you turn this up if you turn it up to like one it's almost just like a cloud expanding it's quite it's it's pretty random so I'm just going to set this back to zero for now but I'll leave it there for you know when if any of you get the file from patreon so let's uh let's tidy this up I'm just going to select all of these Ctrl J to put a frame around them just know that everything in here is is just noise being added okay so let's see another thing that we can do if you want to like create um if you want multiple particles to be spawned in over time an interesting way to do that let's just set this to one make it simple you can add in a join geometry node right here and then every frame you can make it so that one point is added right here and it's going to create this Trail one thing about doing this is you can see the points are just adding up over time and they're never really going to get deleted so if you want them to get deleted you have to delete you have to basically create a way to um to find the particle age which is not very hard but before we get down to that if you have like multiple points right here you can see they all kind of Trail like this and if you want them to always come in in a random position that's what the seed would be for you can just uh use the frame from the scene time and it'll make it so that every point that comes in will have a random you know value a random position between these values right here and it looks quite a bit more random which is kind of neat make this smaller so it's just kind of pouring out now and it's also still everything's being affected by this noise still so yeah but just so it doesn't add up over time let's let's add a particle age so this is pretty easy we use a um a store named attribute node right here we can just name this age and let's add a named attribute and if you click on this and you don't see age you don't see the thing that you just added just go back to the first frame with shift and left arrow and it should appear hopefully let's add this into itself and in here we want to add by one so I'll search for ADD make sure this is set to one okay so basically what this is doing is is creating an attribute called age and every time every frame that goes by it's being added by one so um it's kind of giving us the the age of each particle as it comes in in frames and then if we want we can delete them so we can bring in a delete delete geometry node right here let's get this named attribute and we can say for every particle that is older than like 30 frames delete it so to do that we would get greater than every particle with an age greater than 30 frames should be deleted that's what we're doing okay now let's take a look at this we should see that after a while they just start deleting you can see they're deleting about right here that's the point where they reach 30 frames if we want we can turn this up quite a bit higher Maybe three times as long so 90 and this is what's happening so you can do some interesting stuff with this first of all you're not going to have like a ton of points that just keep adding up which is nice because if you let it go for long enough blender is just going to crash let's tidy this up to call it age so some other interesting things that you could do with this is make it scale over time or rotate more over time you could use this named attribute in the Shader side of things to change the color over time things like that let's um let's just scale it up or change the scale we can do that with its Point radius I believe set point radius right here let's grab the age so shift d and if it's in a box you don't want it to be there you can press alt P it's the same shortcut as unparenting things okay so if we plug this in uh they're gonna get huge because the radius is gonna go up to like 90. so we need to change this you can like divide it I like to use a map range node because you can also kind of change whether they're scaling up or down so let's use a map range okay so we want it if we want it to scale up let's see we can make it so that it starts at a scale right here we can make it start at something like 0.1 and then scale down to zero but it's not going to look right until these kind of match so we need to turn the from minimum to the maximum age start over oh you know what um because we already flipped it around down here this should be zero and this one should be 90. okay so now as time goes by they will scale down like this if you want them to scale up basically you just want to make sure these are inverted so you could change this to zero and this to 0.1 they'll start small and then they'll they'll get Scaled up like that yeah we can do interesting things like this I guess if you wanted it to start small scale up in the middle and then end small you could put something like a color ramp or a float curve in here so let's let's do that just to see how it works I'm kind of just experimenting at this point basically you want to start at zero and end at zero and then in the middle you can make it scale up like that and let's change the scale a little bit is that right it doesn't seem to be right maybe it's because it's one let's divide this after math divide so yeah now it seems like it is working let's make this a little more random though maybe not and uh let's make this go up like this so it should start small as we can see start small and small like that so it's a little more seamless I guess if you do it this way and we can tidy this up just make sure everything's together okay um what else can we do I like doing things like um like adding velocity and creating attractors and things like that so let's just save this I'll just call it um sim1 and we'll duplicate it and I'll call this velocity between save that too okay but we're not going to use some of this stuff like I'm just going to delete this and we'll delete the age and make sure points aren't being added in all the time connect this back up or um actually let's let's remove this and to get started with the velocity let's just add in a store named attribute make sure this is a vector because it's going to be determining like the points in 3D space so we need three Vector three three Fields three numbers whatever I'm going to change this to V for Vector bring in a named attribute and similar to Age we're going to feed it into itself like this and we're going to um use the the velocity to set the position let's just plug this into the offset right now so right now nothing will happen because um we're not really at any point defining how this is changing yet basically instead of uh setting the position somewhere outside here we're going to change this value right here so we can do that with an add node a vector math node set to add right here and you can just add forces and things like that to it I'll show you what this does basically right um let's just set this to one point right now and make it a little bigger and turn turn The Z up just like a tiny little bit so basically what this is going to do is it's going to start off slow and then it's going to get faster like that if we set it to like negative 0.01 or something like that it'll be kind of like if you have a ball in your hands and you just let go so it starts off slow and then it keeps getting faster like that okay and the reason for that is basically it's going to start off like the first frame is going to be going to be moving this much and then the second frame it's going to add to itself so instead of you know Point uh 0 1 is going to be .02 and every frame that goes by is going to add this number to itself and that's why it's getting faster similar to the age like I said now if you want it to eventually stop getting faster you need to add some sort of dampening and that is also pretty easy you just do that with a scale node a vector math node set to scale so by default if you have this set to one it's like there's no dampening or no friction or whatever like no air resistance and it'll just keep getting faster forever but if you set this to something like 0.9 it will eventually slow down so let's make this quite a bit bigger just so we can see it better so you can see it kind of starts moving at this like consistent Pace but if we have this set to one it will just keep going faster and faster all right so now we can start adding things to it other than just a force like this but before we do that let's just again add some some downwards Force so negative point zero one let's make this smaller and if you want it to start off with any like initial Force like if you wanted it to be like if you were throwing it the way you would do that is outside of the simulation Zone you can bring another store named attribute set to V for velocity you can name this whatever you want by the way as long as you're keeping it consistent and this is going to be the initial force that it starts off with so without anything it's just going to fall down but if we want we can add a little upwards Force like this see that over time so it flies up and then it goes down and this isn't added every frame it's just the first frame it moves this much and so it's like you know kind of determining what this what value this starts at instead of just starting at zero so let's uh let's also push this to the side a little bit and it's like it's being thrown kind of creating this Arc so this is kind of like um it's kind of like adding gravity all right so if you want to use this you can use it but I'm going to set it to zero for now and we can plug uh some scale sorry plug some noise into it like this just plug it into the ad and so now basically points that are moving fast will move faster over time and they'll kind of just fly away so for uh so when you're using velocity you typically want the forces to be quite a bit smaller or else they um they just start kind of going wild once I had 50 points you start to fly away like that let's see it's because I still have that upwards force from before let's do like .01 it's going to give us a similar effect as we had um in the other one except like I said things that are the particles that are moving faster are going to kind of like move at an exponential speed exponential might not be the right word for that I don't I don't know if it's actually exponential but it adds to itself over time let's create like a some like uh some orbiting so to do that we need um we need this to be attracted to a point um a point in space so let's start doing that by adding in a new object we can add in an icosphere right here like this and just so that our you know geometry nodes don't disappear we can select our particles and then click this little pin icon and that will make it so that when we select other things this all stays here so let's drag in the icosphere now and we want to make sure this is such a relative so that it pays attention to where it is instead of where um you know it's original position was or whatever so to get these points to want to be attracted to this or to another point in space or whatever what we need to do is bring in the position right here and a subtract node Vector math subtract and you want the position to be in the second one basically what this is going to do if we plug this in by itself is um actually first let's scale this down because if we do this it's gonna go crazy like this let's use a scale node first and set this to something like .01 and let's also scale this down a little bit okay so now this is going to be attracted to the zero zero point right here and we're going to gonna get this weird pulsing motion like that if we want it to be attracted to like one meter higher then we can set this to one like that and it's going to start orbiting you know that point in space and it should keep making the same path forever because we don't have any friction or dampening or whatever but that's what this location thing is for when we plug this in here it will be attracted to the the origin Point basically so now we can actually get these points to start orbiting our icosphere let's move this to the center to the side and restart the simulation and you can just kind of move this around in real time and just kind of get an interesting path like this so now this should kind of just orbit it forever if you want it to actually be attracted to it and settle in on the spot onto the origin point then you should add some dampening so uh so we can just turn this down a little to like 0.9 or something and it will eventually always try to settle On the Origin point right there if you want it to settle onto the actual like points of the mesh then instead of using the location right here you can grab a proximity node like this make sure to plug the geometry and two into that let's make some space and you can use the position right here so it's going to get the position of you know the closest face basically so restart this and um it will try to settle on the face that is closest and you can make this a little more interesting by adding some noise or you know making them a lot bigger to start like that um and this is cool because when you like rotate it or or scale it up like when you scale it up it'll actually be attracted to the faces instead of just the center of the object so you can get some like interesting motion I don't want to settle too much so let's do like 0.99 and now it'll take a lot longer to rest and it's nice using um using the proximity node right here because then you can get different results depending on how your object is shaped but yeah let's add some noise so that um you know these kind of spread out a little over time basically instead of adding you know another set position if we want you know like I said before if you want these to have velocity also you want to add it to you know the existing velocity so let's just put another add node and plug the velocity plug the noise into the add node sorry so now these will be constantly moving basically but they'll always be attracted to the same point they'll wanna settle on the surface let's bring this back to the center and go into edit mode and maybe create like Suzanne or something you know different shapes with Suzanne rotating it should actually make a difference just because it's not you know symmetrical in every direction see is there anything else I should talk about I think that might be it I guess a thing that I would like to try I think I've done it in the past is to make these all want to spin uh just like all the time so let's try to do that I think if I take um actually let's let's add this to the velocity also so let's make some room add another add node let's take the position and I want to rotate it so let's look for Vector rotate hopefully this works we'll leave this set to axis angle so it'll always rotate on the z-axis right there let's yeah let's just oh maybe we don't want to do that let's scale this down quite a bit first .01 that's a little too much still point zero zero one so they are rotating you know I might not have to actually use this add node and I can probably just plug this in interesting let's uh let's pull everything towards the center like this oh we 0.001 okay so everything is being pulled towards the center and if we if I plug the position in is that gonna do anything okay now it's starting to spin but we're gonna have to balance it so it doesn't spin too much otherwise it'll just fall apart like that so let's just make sure that the the gravity the the Gravity Force right here is large enough like point zero one and we should just get this rotation if we add some noise to it how's that look let's add some dampening 0.99 started over all right this is interesting a little more noise this is pretty cool so now if we add this let's see is it just gonna naturally start orbiting Suzanne it seems like it is so I guess that's how you would always get it to rotate that's pretty interesting all right so let's just go through and label these now just for uh you know if you if you end up getting the file from patreon so this is going to be um the initial velocity initial so yeah if these get really fast basically I think the faster they get the further out they will become if we turn this up to like one we'll just start spinning like crazy and they'll spread out it's definitely too much I think like 0.1 is good maybe uh is that what it was set at or is that too much 0.05 and let's add like way more points 500. okay so if we move this around we could probably get it give it a jump start it's very chaotic I think the attraction Force might be maybe a little too strong let's make this where is it a little smaller 0.03 went up two there it goes foreign okay let's visualize the velocity or um let's visualize the speed so so to get the speed I believe that's just a distance what is it distance over time you know like miles per hour you write like M divided by our oh yeah so I'll call this uh speed restart that and um so we should get the position where we need we need the velocity and the position so let's let's do uh this is the distance from the distance between the uh the original position and the point where they're at now so it's I think it's like trying to figure out like how far how like how much the points are moving over time like how much the points are moving every frame so now we can take this speed and if we wanted we could visualize this by just changing the um what's it called the the radius or something like that but instead let's um let's get some instances uh instance on points right here and let's use an icosphere because we're not adding rotation so it'll maybe look weird if they're not rotating and uh yeah let's use the speed also to change the scale so basically the faster the speed the bigger they'll get we can set this to to speed and oh yeah this doesn't have to be a vector this can be a float or maybe um is this right do we need I believe this is figuring out the distance but there is also a distance right here so if we want we can use that keep everything floats and uh make sure this is also set to a float plug this into scale let's move this around so this is going to get way too big let's just divide this by something math node divide divide it by like uh 20 maybe 50. so it should start out pretty small and basically the faster they go the bigger they'll get like that we can just eyeball this if we want to let's do 30. all right and if we want we can set a material so let's uh set material we don't have any materials so let's make one new material okay let's go back to or go to shading and let's actually look at this let's turn the background off so we can see a little better under film like that add in an attribute right here and this is going to be called speed we can always check that if we want by selecting our plane and checking uh internal dependencies it'll tell us the name right there oh the icosphere this yeah this is okay it has the right material and now this won't work until we change this to instancer but we should be able to visualize the speed everything is going to look white basically because as soon as it hits one it's going to look white and the speed is going to be moving it's going to be moving much faster than that so the thing that I like to do is turn on Bloom and then we can get this to become more bright over time so even if it goes above one you'll get more Bloom so let's turn this maybe like blue or something like that and plug the factor you can use any of these pretty much except for Alpha but we know that this value is a float so we can use the factor plug that into the emission strength and so now it should work that like the faster it gets the brighter it will get also and we can test that just by spinning it around a little bit now is this not working why is this okay there it goes so you can see that is very bright now out there but it starts off not very bright you can also make this like change color over time I guess if you want to um use something like a color ramp you might want to uh divide this first so let's divide it by 30 just like we were in the other one and uh let's make like a rainbow so let's make this HSV we can set this to clockwise let's make the first color um red so it starts off red and then it will become blue as it gets faster like that we can plug that into the emission color there you go so as soon as it hits a a speed of 30 it will become blue and it'll stay blue but it starts off as red like that so this is pretty interesting if you want it to you know be able to get faster or whatever make the gradient a little more obvious you can just divide this by a higher number and that should work you might want to divide this if you don't want it to get too bright maybe like 20 something like that I think it's pretty cool so yeah that's all for this one if you want this file you can get that on patreon as always and um yeah have a good one
Info
Channel: Joey C-quel
Views: 15,622
Rating: undefined out of 5
Keywords:
Id: 3XDyq1izoIw
Channel Id: undefined
Length: 33min 29sec (2009 seconds)
Published: Sun Sep 17 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.