Simulation in Blender 3.6 (Geometry nodes tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys in this video we are going to have a simple introduction to Geometry node simulations in blender and it has lots of capabilities and it has a very vast word but first we need to learn Basics basic concepts to be able to make more complicated simulations so in this video we are going to focus on the concepts and also we are going to make a collision functionality and yeah let's dive into it okay we are going to first let everything and make a huge plane 10 meters and also going to Geometry notes distribute some points on it first uh first let me set it to 500. and of course we can change the radius set point radius um set it to 0.03 for the beginning okay now here we can bring simulation Zone this simulation runs everything in here in the zone which we specify for it at each frame okay it means that it will do all this stuff and gets back to the beginning at the next frame and we'll do all this stuff again and again at each frames so let me show you a simple example for example let me use that position F here is my point at frame one I want to move it along x-axis by for example the 0.5 meter okay like this I should give it a vector to move it to the next position so it will move to the new position and at the frame two the simulation will get back and do all this stuff again which in here is only set position so it will move it by 0.1 along x-axis to the new position and also at the third frame it will do this again and goes on to the end let me bring timeline okay let me check okay now let me make it more complex a little bit using noise texture the noise texture values are between 0 and 1 and I want this range of numbers to be symmetric so I want this to be between minus 0.5 to 0.5 instead of zero to one so I use Vector subtract this is a Vector math node and set it to subtract here and subtract it by 0.5 and At Last I want to use a scale to have control over the magnitude of this vector now let me run it okay the noise is small let me introduce the scale level roughness okay and also lower scale open everything to happen slower to see exactly what is happening okay by the way if you said that the things aren't working for you just hit this button and jump to the beginning and start it again it's happening in here let me just focus on a point with this set position and this noise texture we are giving it a vector and for example if it is at frame 1 it will move to the new position and at the frame 2 it will get a new vector but this Vector is following the noise pattern and this noise texture is giving a color a 3D color by the position of the point it's like just uh giving it the position no difference so when the position of this point changed to the new position so it will get a new color means we'll get a new Vector so at the frame 2 it will have a new Vector to move to another place something like that and also it was at the third frame okay it will move to the position following the pattern of this noise texture so we will have such thing like this okay that was the principle now in here I don't want this noise texture I just want to make an effect like a tornado or a black hole I want these points to spin around a Handler um first let me just make the Handler or you could sphere with the radius of um Point 15 is okay okay this is my Handler and I want all these points to spin around it okay so now how should we do this as we saw in here this simulation is more about the vectors usually specify Vector at each frame and the points will move along that vector okay this Vector of course could be velocity could be acceleration or displacement which we are using in here if we are focusing on displacement okay let's say this is my Handler and this is my point in here I'm just focusing on one point have a straight line between these two points the point and the Handler for the point to spin around my Handler there should be a vector at each frame like this which is perpendicular to this line and if this is my Vector this is the vector which we have because we have the position of the Handler and also the position of the points and this is what we want in some situations that we need a vector that is perpendicular to the vector that we have is good to always consider the cross product well the cross product is like this that the cross product of two vectors A and B will give us a vector C which is perpendicular to the both of these vectors and the magnitude of C IS F the angle between them is Theta the magnitude of this C Vector is the magnitude of a dot magnitude of B dot sine of theta Okay so in here we have one of the vectors for example we have the vector a but we don't have the vector B to use the cross product to achieve that redundant vector but uh we have actually the vector B we can use simply the Z vector which is like 0 0 1. okay the cross product of Z and this Vector I also want this Vector to point toward my Handler because later I'm going to show you I want to add an extra Force like a gravity to point toward my Handler so let me make this first for having this Vector I need to subtract if if this point is B and the point is a the vector should be B minus a to point toward the B which is my Handler here so I'm just dragging my Handler and dropping here set this to relative and get the location a u subject and for the position of the points I have the position node okay now I have my first vector and the second Vector was pretty simple Z actually a normal Vector along Z axis so I'm using cross product and in here I can just simply write 0 0 1. and in cross product the order matters if you just Swap this vectors we would have this C Vector in the negative direction or in the reverse Direction okay now that I have my Vector I can use the scale to have control over the vector's magnitude and just plug it into the offset and of course it should be very big let me play it oh it vanished so fast let me just set this to 0.07 okay you can see that all of the points are spinning around my Handler let me move the Handler okay you can see that it's following this Handler trying to spin around the Handler now we have some problems in here let me just bring the Handler back to its position okay as you're saying here when we play this all of the points are moving simultaneously and why that's because the points farther than the Handler have higher velocity than the closer points something like this if this is the point it has a smaller vector and the farther Point has a bigger velocity vector and why they have bigger vectors because we use the cross product to make this vector and the cross product was between the Z Vector which the magnitude is one but this Vector which is the subtraction between the location of the Handler and the position of the point as you can see the magnitude of these are different so it has direct influence on my final Vector in here okay and I don't like this effect I want the closer points to move faster and the farther move is slower so in here I can normalize all the vectors it means that all of them should have a magnitude of one let me check it go back okay you see the closure points are moving faster and as you can see we are having a hole in here and that's because of the inaccuracy of this process well let me show you why if this is my Handler and this is the point if I use a big Vector to move this point along the vector as you can see it's pushing this point outward to the outer place of this circle which the point should move on it okay so for having more accuracy it's better to break these steps I mean instead of having one big Vector I can break it to two vectors and two steps well I'm gonna show you later but let me just give a simple explanation if I break this step to something like this and a smaller vector at the first step and move to point to here and then I will do that again okay as you see it's better as the steps are getting smaller we are getting more accuracy it's definitely better than have a big Vector like this to move the points outward okay let me just add another force in here as I already mentioned I want to have my gravity let me delete them which I wanted this Vector to point toward my Handler so this is the vector and I'm going to normalize it again because I want to have same magnitude for each points and scale that and finally add them together okay well the skull should be so much smaller like point zero zero four now let me run it okay let me change the Handler position it doesn't work let me just reset it reset everything again okay and please let me increase this end to 1500 as you can see that there are the points are trying to move throughout my IQ sphere and that's because of the second Vector which we added okay now I'm going to show you how you can add accuracy let me just group these with set position Ctrl G okay and as I already mentioned for giving more accuracy we should just reduce the scale of these steps like to have break them to have 0.035 and 0.002 but we are going to do this again have two steps so reduce the step lengths to half but we doubled the steps count so we should have the same result but with more accuracy now let me check it go again okay now let me turn it off again I also forgot to tell you that you can just scale it at the end instead of changing these scales this can be a ratio between these two forces but this is the ultimate scale I can scale them down to 0.5 just first let me show you the difference in the accuracy we can check the whole size okay that was one step and now we are going for the two steps okay as you can see the whole got the smaller not as big as before it means we have more accuracy and you can increase the steps and of course you can change the ratio between those two forces like decrease the spinning speed and increase the gravity like this okay let me check it again okay and this was the basic well you can play with these ratios you can make the gravity even stronger at the beginning or at the closer points and make it weaker for the farther points and for that you can just use the length of this vector which is the distance between the Handler and the points you can use the length and you can multiply it to whatever Vector you want to play with okay now I'm just going to bring it back to the lower accuracy because I want more speed in here because in the next step we are going to work on the Collision function okay what Collision means let me say if this is my point if this is my current point which I'm focusing on it has a radius actually all of the points have the same radius and also this one has radius first we are going to focus on one point and we can see that this point is inside its nearest Point okay Collision means two points shouldn't be any closer then this distance which is radius multiply to okay this is the minimum distance that two points should have so for making the Collision functionality we should check for each points that if they have closer distance than 2R and we pull them out of each other okay so like in here when we have the distance and we see that the distance is lower than 2R so we should pull out the current point which we are focusing on and this point actually should move along this vector outward if this is my focusing Point like this it should move out along this vector and as you can see that it's all about this vector and how can we get this it's like actually this one okay well I have the position of the current point and this is the nearest point and I can get the position of the nearest point also so by subtracting the position of the current Point by the position of the nearest point I can get the vector but how much should I move this point the focusing point out of the nearest Point I can just pull it out by the vector with a big magnitude because if I move it too much outward it might get just into the other points which is in the other direction of it back in here if I put it too much it would get inside this point and I would have my problem again so as you can see that we can't do it just in one step accuracy is exactly what we need in here so we need multiple steps with very smaller steps as small as possible can of course considering the time of calculation and there is a fact we need to consider that this calculation is simultaneously happening on all the points in here I was just talking about one point which I was focusing on but it's actually happening on all the points it means it's also happening in on this point and on this point so all of this calculation are happening on them so it's better to have smaller steps to pull them out a little bit and then check it again on all the points and then pull them out little bit again and also we should check that again and check that again again and again okay this is how you can achieve more accuracy now let me show you in the geometry nodes we're going to have set position to make the first step as I said in here we need to get this vector first if this is my B point and this is let me change the pen color if this is my B and this is a b is the position of the current point so I can get the position and I should subtract it by what this is my nearest Point okay and there is a node called index of nearest by this I can find the nearest point and get the index of it and based on the position so I'm using this position in here it's like just getting another position doesn't have any difference and I want to and since I got the index of the nearest point I want to calculate the position of the nearest point which is my point a so there is another note called evaluate on at index okay we connect the index and I want this to be Vector because I want to calculate the position so I can again connect the position and this is actually the position of the nearest point which I have the index of it by this node okay so this is my point a and I'm going to use it in the subtract now I have my Vector now I need to check if the vector which is the distance between the A and B is less than or greater than 2R so I use the length which is actually the vector math and set on length length in here and I'm going to check if this distance is less than and this node is the compare node and we are going to compare this one with the radius I'm going to have my point radius by this node and multiply it by two multiplied by two okay so if the length is less than 2 hours then we need to have the Collision functionality so here is where I need this vector okay so in this situation if the result is true the output is 1 and there and if the result is false it means if the distance is not less than 2 r the output would be zero Okay so as I said I need this Vector this is my main Vector I need to scale it by the output of it but the output 1 of this compare node is too big for my Vector to be scaled by because as I said I want a very small step for the magnitude of this Vector so I'm going to multiply this by .03 and plug it into the scale and scale to the offset let me check it okay as you can see it seems that we already have Collision functionality but with very lower accuracy and let me show you something and as you can see that they are getting thicker in here let me show you I don't like this actually it's completely normal because of the Collision functionality since my hand there was higher than points at the beginning situation and we had some forces toward my head there so my points I started to get Z component okay at first they were sitting on the X Y plane and they didn't have difference in Z Direction but after the simulation is started and they moved toward the Handler they started to get different Z positions so the Collision is also working between them along the z-axis so it made them to move upward like this to maintain their distance okay and it's okay for the Collision function and that's right but I don't like the lock in here so I'm going to multiply this by one one zero it means that I'm maintaining the X and Y component and I'm just getting rid of the Z component okay now let me check it again okay as you can see I got rid of that not pleasant effect and also having my equation functionality along my X Y plane of course it has lower accuracy so I'm going to increase it by increasing the step numbers so let me go back first group them oops also we should include the set position Ctrl G okay here's my step magnitude I'm going to reduce it to .02 or 0.03 that's okay it's the ratio of the distance and here to 0.03 is small enough if you already took a look at the blender simulation demo file you could see that this Collision function is based on that file it's called collagen function and it's 0.025 there magnitude for each step and also used 10 steps for the collisions I name it condition I also grouped them okay it was 10 Collision steps there and I'm going to just copy that of course it totally depends on you and your desire for accuracy because it's time consuming so one two three four five six seven good for now let me go back sorry I forgot to say that we can give the variation to the points movement and that's an important part well we can add a noise texture I'm going to use vernoy noise texture and you can well play with them I just like to use minkowski and set the scale to 0.8 exponent to one and I can use this scale at last step or even before this scale doesn't matter and connect the distance to the scale now let me check okay you can see the difference let me turn it off okay that was before using that now turn this on okay that looks better and at least you can increase the points and reduce the radius and at last you can also set a material to this say particles and call it here okay now I'm going to show you my cache file if you want to Cache your simulation you can go in here an internal dependencies you can choose your folder for cash and after choosing the folder you can go into the physics and you should click on this plane which where a simulation happening and this one will show up so you can hit on the bake to bake from the start to the end of the frames which you specified in here okay and you can also by clicking this delete that and I'm going to show you the file okay this is the file with the render and this is without motion blur and this is with motion blur and this is with the color mixer you can make such effects with this you can go at the beginning as you can see I made two thousand points with 0.01 radius and also for that coloring effect I stored color with noise texture just delete this map range simple noise x-ray with this setting and name the color and of course I should go to the Shader and bring the attribute node call my attribute by writing its name in here and of course using the color Ram because in there I use the factor of the noise not the color to have control over my color in the Shader okay and also you can connect this to the principle bsdf and at first this is like this but when it starts to simulate it starts to get mixed well you can turn on the motion blur in here and you can change the setting but I didn't change the defaults values and I think that's it and sorry if the video just took too long and as always I wish you best my friends goodbye
Info
Channel: Blender Path
Views: 33,209
Rating: undefined out of 5
Keywords: blender, blender 3.6, geometry nodes, simulation, particles, tutorial
Id: RuRNSpHj-5c
Channel Id: undefined
Length: 35min 55sec (2155 seconds)
Published: Tue Aug 15 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.