Blender 3.0 Beginner Geometry Nodes Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Applause] [Music] today we're gonna make plants as you saw from the intro for this little dancing concerto whatever this is the plant that you're gonna make as you see it's currently quite small if we increase the slider here it's gonna grow like just like a normal plant i mean i could have this as a pot plant this wouldn't be like too horrible in a corner of your room so let's make this plant right for the first thing what we need is a new scene and then we have a lot of steps that we have to follow the first thing that we need is the plant stem so to create that what we need is just two i mean a geometry notes and then we can either use a mesh line and this looks perfectly like the starting point of a plant but the problem is it doesn't have this node called curve parameter and this node gives us in case of a curve a gradient from the starting point to the end point so zero to one right and we can use this to make the plant grow to make this the leaves be smaller down there to make this shrink and get fat and whatever so this is very useful and in case of mesh lines we don't have this in case of course in case of curves we do have this so let's add a curve called quadratic bezier which is just a fancy word for a curve doesn't look too much like a plant so let's make the thing look like we had before like going upright so for that let's zero out all those uh points here and let's make sure the start is in the zero zero zero in the beginning here and the end is gonna be just one meter up so something like that the middle thing here is like that 0.5 on the z axis we have made the stem now the next thing is to make it thick actually i don't like this layout this is something yeah i like this one more so let's use the geometry node editor on this side and let's put it here now we need to make it thick and for that what we need is a curve to mesh node which is kind of the only way to make something thick make a curve thick because curves as you know are very thin things they don't have actually any like geometry that can be rendered out so we need to make this a mesh right now this is a mesh of just uh 16 as you see here 16 vertices going up with the distance of 1 divided by 16 right because this is the end point but we are going to use a circle to wrap around this curve and we cannot use the mesh circle because this is a curve so let's use a curved circle let's put it here and let's connect this to the profile curve now this looks like a barrel of actually nothing because it doesn't have a bottom so um let's make this a bit less thick let's say two centimeters and the resolution can be something smaller for example 12. the next thing is to make it wiggly because it is thick and it is a stem now we need a wiggly and thick stem and for that we need a noise texture because the noise texture allows us to create like random values but in a specific region for example if we just use a random value this would just result in a stem that is completely random in every direction because all the points are getting a completely random location but the noise texture is something that is more smooth depending on the scale so that we can get a plant stem so now we have here this noise texture and i also tidied up this thing a little bit because this looked a bit ugly and to use this noise texture as a new position for our stem we need to use a node called set position now set position sets the position of a point based on an input or offsets them based on an input for example if you offset them one meter on the x-axis this should move right here like that let's see if this is the case case it is the case so we have understood everything correctly let's put this back here let's delete this wiggly line let's use the noise texture as the offset now something like that happens why does this happen the reason is that you know here we have quite a lot of points fell by 16 so 16 in this direction and fell like that because it is a circle with a resolution of 12 mapped on 16 vertices so we have this amount of points and every point is going to get displaced by a random amount which means for example to make the scale smaller right it does look like a plant stem and all but it's not like a circle it's more like a vacuum cleaners like pipe that you have stepped onto drinking straw that you have chewed a little bit too much and to fix that what we need is to displace at the curve before it reaches this circle curvy mesh thing here so let's put this before and let's add the color to the offset now it's looking nice but the problem is it has shifted up and the reason behind that is the fact that noise texture as you know looks like that so you have dark values and you have white values dark is zero white is one so you have everything between 0 and 1 and on average this is 0.5 so this is gonna be displaced by 0.5 on all the axises so let's do so that use a vector math note and subtract something from its position subtracting something in this case is basically just moving these on axises so the first thing here is x then is white and it's z so when we move this uh like that so we subtract this amount it's going to move back here so if you subtract 0.5 it's going to be on the y-axis here correctly and now if we subtract from here as l0.5 it's gonna move pretty much to center now we also have to move this down on the z-axis like that now it's in the center problem being that the bottom part of the stem isn't at all fixed so if you change this to four dimensional noise which sounds crazy right so just have to use the wii dimension here and it wiggles like crazy now the problem is that the bottom part here isn't attached here so what we need to do is to make sure that whatever we are doing with the displacement it's always going to be multiplied with 0 down here and now this is the case where we can use our lovely curved parameter parameter now the curve parameter as i already told you gives us range from 0 to 1 on a curve starting from the start ending in the end so we can basically do so that we are gonna multiply using vector math our displacement with this thing here everything works as it should just a quick look onto the notes in case you missed something you want to recap on something this looks like that now we need to make it thin at the top which is the fourth thing in our list we can make this thinner or thicker by using the curved circle here like that it's very thick well you might think okay let's use just the curve parameter right and let's plot this curve parameter into the radius it should work it doesn't work because it's red and why is it red well the reason is this input here has a circle here right a circle means a single value just i mean you cannot input any attributes here anything that is different for this whole stem right for example in this case here the position the offset here which is different for the stem in each location it has a little rhomboid a little cube that has been rotated maybe the default one but this is actually indicating that this is a an input where you can input some attributes something that is different for each point i mean this one isn't of course because this is just a normal curved circle i mean this is just one object how can you make this different in each point so to do that what we need is a node called set curve radius curve radius like that no nothing is changing but we can here very easily make this thinner or thicker and here as you see we have a little uh square which means we can input attributes here so let's use the curve parameter i'm gonna put it here now we have zero down here which is correct because the curve parameter outputs zero down here and one up here we just have to invert this somehow so do we have an invert node uh we don't have this but we are very smart so we can figure out how to make our own inverse nodes so for that we can use a map range actually this doesn't mean the range of a map this means let's map the range right i initially thought like when i started using blender that this was like the range of a map or something like that so this is used in a way that you take the original range which is in parameter case zero to one which is already correct here from minimum zero to maximum one and now we're gonna map this so that down here we have the new minimum of one and up there we have a new minimum maximum of zero now we have completed four steps and we have not too much too many to go let's deal with the growing animation pretty exciting right now for that we need a node which can make curves shorter so for that we can use a trim curve this video is sponsored by mansk okay let's put it here for example and let's see what happens when we drag so for example we can trim from start or we can trim from the end but as you see this doesn't look too great right so let's try for example after this thing here and now you see because we have already set the curve radius it is working but it is cutting the plant into a it's a hole here right to get rid of that what we need is to move the trim curve before that so now the um curve parameter is calculated taking into account the trim curve appropriate for our plant and this works very nicely just a little recap on nodes now i have to model the leaf but i'm too like lazy to model this so i already modeled this beforehand and i'm just going to append this into the scene from the intro file which is going to be on patreon by the way and the leaf is going to be for free in the description because this is so easy to do why should you ever bother doing this right this has a texture already this looks like that i downloaded the texture from ambient cg so you can make this leaf on your own but just make sure it is having the same position as here and apply the rotation so usually if you want to add something in geometries we need points we can just use an instance instance on points put it here and then add a leaf the leafy sierra is called stilette which means leaf in estonia let's learn a stone left left is a leaf okay so i have this leaf here and i'm going to plug the geometry into the instance and now you see we have a massive amount of nature too many right we don't want as many of as many leaves let's do so that we actually plucked this before before we make this mesh right so we do this like that now we cannot see these leaves of course because the note 3 has separated here so we need to use a join geometry now to put this back together the families together again now the problem is that they have all a distance between them like a fixed distance so this doesn't look very natural okay they are also rotated in a very wrong way but this i mean let's deal with distance first so i want to control the amount of leaves i have so for that i'm going to use a resample curve note which is going to resample into a number of uh of pieces i wanted to resample two so if you put one here i'm only gonna have one leaf if i put two three four five i'm gonna put here 24 and of course i don't want to have as much of leaves here i just want to have like a choice between those leaves and then i'm going to randomly choose some of those leaves how do i do this let's leave this question unanswered right now and let's first turn them into the nice rotation very hard to see what we're doing if they are so random like that the rotation of the object let's plug this into the rotation doesn't work right because we have to align this to something so let's use an align euler to vector put it like that and now this has done something let's try out these things here okay why seems to work yeah it works but not very well because you know they're all exactly like that like a stack of like the money for example this doesn't look very good because for example in this case uh they should be pointing a bit more downwards to be like is the word perpendicular to the do the stem for that we have to use a function of the curve called uh tangent now tangent doesn't probably mean anything in english except for this thing but in estonian the curve tangent is called which means to touch her so when you have a curve then you have also the tangent or the toucher in estonia because it touches the curve in only one location so this is i think a bit more logical way of thinking about tangent now we can use the tangent as the vector to align those things too i know this looks a bit better this follows the rotation of the curve and it looks a lot better i think the problem is that there are too many leaves so let's select just do a random amount of those as you see here we have a selection what does this mean this means a boolean that is either true or false either we have leaves or we don't have them right if i use just the boolean here and i'm going to plug the boolean into the selection we have leaves we don't have them we have we don't have them so what i need is a random value a random boolean value for each of those 24 leaves and for that we just need a random value of course i mean this is an easy tutorial why should we overcomplicate this we have a float here we have integer vector boolean which means either true or false so let's plug this into the selection we have a selection we also have here the probability and the seed probability means zero like don't give me anything and one gives give me all what you got right i don't want to have all what he got he got he has so um i'm gonna do something like that this seems for about okay and i can also change the seat so that we have different sets of leaves and now just a little recap showing you all the notes that we have here you can pause you can watch them let's go on we have the leaves but we have to rotate them because they are looking very very bad right now this is a serious issue all the leaves are in one direction i mean this can be true for example there is a heavy wind coming from this direction i probably don't have this wind coming from here so let's rotate them uh but by how much and how to do that we need to of course use uh rotate instances node we rotate instances put it here boom and this allows us to rotate in the local space what does this mean so for example if you're rotating in the world space this means like that you see this is not very good because this is intersecting and doing all this weird stuff here we don't want that we're going to rotate in the local space this means each of these leaves is going to have its own z direction like that and then we are going to rotate and everything is oh okay z doesn't work at all so y is working here right so now they're rotating like it should but we have to have a different value for each of those leaves now how do we do this we can use the index node index is just a number for each point it's like name of each point so you're asking okay but we have leaves here we don't have like we should have like many points in these leaves but we cannot rotate all of those with the index i mean this is going to result in some very crappy noisy random stuff but actually this is not the case because these are instances which means they're actually points so here is even a node instance instances to point right this looks like that there are actually points there not real geometry this is just a relief instance on those locations and now we have currently indices of 0 1 2 3 4 5 right so let's use the index as the rotation but this is obviously very random and this is because we're using for example the number 1 for the rotation on all the axises but we don't want to rotate on all the axises only the z axis so let's use a combine x y z because this allows us to have different controls different inputs for one vector and we want to rotate on the y this leaf thinks that y is like the z or something like yeah you you understand how this works right maybe you have to use something different here but if you did everything like i did uh like the placement of things this should work for you very well this is not the correct way how leaves grow in nature actually they grow using the golden angle so here this is the math part but this is actually very easy so right now by how much are we rotating so this is here is zero index zero this here is one so by one unit what but which kind of unit this is a radian because blender uses radians as internal rotation units so when you have like one radian this is 57 something degrees doesn't have to be too exact so this one is rotated by 57 degrees and seems to be that this is uh the case here right actually they have to be rotated by the angle of 137 point degrees which is the golden angle how do we get from 57 137.5 um we just multiply this by x and this equals this thing here so how do we get the x well this is 2 this is 3 and this is 6. so 3 equals so x equals x is like a 3 3 equals this thing here divided by this thing here so um 3 equals 137.5 and divided by 57 degrees and this is the this is the x so we have to multiply the indexes with this expression here to get the right rotation values so let's use the math node here put it here and and multiply because this is multiplication right here let's multiply by 137.5 divided by 57 degrees and now the plant leaves are looking i think a lot more like in nature except the one thing that's missing here all the leaves have exactly the same size so how do we make them smaller we can already we can or we can again use the curve parameter so for that let's go to the scale here and let's use this as the scale input right this is working okay okay let's add the probability up here and does this look like an acceptable plan for you um not to me this looks like you know this this is linear they are scaling up linearly but in nature things usually aren't linear uh the leaves should be more like instead of being like that this should be more like that and so how do we do this well we just have to use the power function uh because this is meaning that if i use something like here this creates like this curve here right and if you want to be like very um pretend to know how things work let's like type in e here which means like the euler number or something and this is uh yeah giving us maybe something more natural i don't know maybe this doesn't work even like that but this looks okay right yeah this looks fine now we have to animate the growth animation needs our work right now we don't have any animation here but we have one slider here that's making it smaller so let's add a control for this thing here and we have this one here right now we can now animate this but what we need is the scale of the leaves to also get smaller when we do this and we can do that by altering the scale somehow so how should we do this when this is zero the leaves should have the scale of zero and when this is one they should have the scale of one so the common sense tells me that you need to use multiplication right so math and multiply and let's multiply by our number here now when we go here and we scale this the leaves are getting smaller until they disappear and they're getting bigger up again now this looks pretty okay right pretty nice pretty acceptable but we are making something great here so what we need to do is to make sure that when the plant is small the leaves should be pointing upwards and when this goes big they should be like opening up like a flower so to do that we need to rotate them somehow so where is our rotation so with the x here we can do something like that so when the plant is small the leaves should be like that and when the plant is getting bigger the leaves should open up like that again for that we can use the same value that we use for the trim curve and for the um multiplication here let's go here and let's track the value for to the uh to the x here okay this seems not to work very well let's see what happens so when this is uh at zero the leaves are not pointing upwards and when this is at one they are pointing downwards so this has to be inverted let's use the map range let's map the range so from the original range of zero to one which is correct we did have this range like you see here we have uh right zero two one zero two one so we have the original range and when this is at zero we want the leaves to be what let's test out we want them to be the new minimum of like that actually can be even like less i think and when this is at one the leaves should be pointing how like that i think i think it looks pretty great except we don't have a material on this part of the stem here so do you add a material like that we have to go to the material tab and press here add a new material material 001 and let's then go to the geometry nodes here and let's add a material before we add the leaves because the leaves already have a material so let's use a set material put it here and let's select the material that we need which is material zero zero one uh now let's go to shading and as you see we are here and now we can do so that we are gonna select something green from the for this stem like that now if you want to make this look a bit better than it is right now what you need to do is to use a noise texture a noise texture and let's use normal coordinates for the nice texture which means looks something like that and once this is here we are just going to use the color of the noise texture as the normal of the principle bstf so now this looks something very strong and not not essentially very good but what we can do is to use a mix rgb mix rgb and let's mix between the original normal coordinates and the noise texture so that we can either have a like perfectly smooth thing here or something more like that so if you use something like point six i think this gives like a better stem for this stem and let's use also some subsurface scattering because this is a little faint little faint stem here so right this is how this looks i think it looks pretty okay and now you're asking how can you do so that you know it actually deforms and they have this little like uh branches appearing here and and all that stuff well this is something a bit more advanced so i'm gonna leave this to patreon because they support me they're really nice so see you on patreon and also next time you
Info
Channel: Bad Normals
Views: 68,922
Rating: undefined out of 5
Keywords:
Id: uslTaqiv_7k
Channel Id: undefined
Length: 24min 32sec (1472 seconds)
Published: Sat Nov 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.