The Ultimate Intro To Geometry Nodes - Blender 2.93 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello my name is chris bailey and i'm a blender youtuber over at c bailey film today i'm bringing you this tutorial with cg cookie we're going to be taking a look at geometry nodes in blender 2.93 let's get started okay so blender 2.93 is here very exciting news and with it comes a fully fleshed out version of geometry notes now if you tried geometry nodes in the last version of blender and got frustrated because you couldn't quite do what you wanted to do now is a great time to jump back into it because there are a lot more features now that are in the stable build what we're going to do today is take a look at the fundamental building blocks of geometry nodes and try and unpack the basic concepts so that you really can understand what's going on and how you can use it now if you haven't already check out cgcookie.com we've got a ton of amazing resources there for you to check out welcome to blender 2.93 special shout out to erindel woodford for getting his image selected as the splash screen image you can find his stuff on youtube at arondell go check him out some really cool geometry nodes tutorials if you haven't found him already all right so i'm just going to drag up my timeline so that we got lots of space to work here and i'm going to switch from the timeline view over to the geometry node editor now there's one other screen i want to pull up at the same time so i'm going to come over here so i get the little plus symbol and i'll drag to create a new window and i'm going to grab the new window that we have added the spreadsheet very exciting now if you're excited about spreadsheets you're going to love this version of blender because we have a spreadsheet now i want to sort of build a foundation for you i want to talk through the concepts of geometry nodes as they work in 2.93 you can really begin to get a hold of it and start playing with it there's a couple of fundamental things you kind of have to understand first so you know what's actually going on now to get started i'm going to go right here where it says new in the geometry nodes editor and i'm going to click new to create a new geometry node setup now this is actually placed on this cube so if i come over here to the wrench icon with the cube selected you can see that there's a new modifier that's automatically been added and that's my geometry nodes modifier um and i can change the name here it'll update here now when you initiate a geometry nodes system you're going to have these two nodes group input and group output and they're just automatically created for you now when you're working in geometry nodes the first thing you need to understand is that geometry nodes is always looking at points uh points in space now commonly at the moment right now we can see in our spreadsheet we've got these these zero to seven uh points that are listed and each one has three numbers associated with it now these are all the vertices of our cube so because our cube because we have a group input node all the information of our cube is coming into geometry nodes and here we can do stuff with the information about this cube mesh and then we output the final result right so that's why we're seeing in our spreadsheet this list of the vertices because geometry nodes always looks for points it tries to find some points and then you do stuff to those points and then it gives you a result okay so if i go into edit mode you can see we've got these vertices we have eight vertices and the first one you can see is labeled as zero and the final one is labeled as seven so this is the list of all the different vertices you can see that the position is what we have here and each one of these has a position so uh we've got one of them that's it one one and one so that would be right here right because it's in the positive y the positive x and the positive z all at equally distant one if i move this if i hit g to grab you can see these numbers are changing okay i can do that with each of these we can find out which one is which by moving them around and then you can see the values changing right here okay so those are the points that we're able to manipulate with our system here there are other ways to get points okay you don't have to just work with the vertices of an object okay the second way to do it is actually to distribute new points across the surface of the object that you have coming in from your group input so let me show you that so i'll leave edit mode and i'm going to come over here to java nodes and i'll hit shift a and we're going to add a under the point menu a point distribute node if i increase the density of my point distribute you can see that i start getting these points all across the surface of my cube now the vertices of my cube are gone right they're no longer being evaluated by my system because i've basically replaced them with this point cloud okay so now these are the objects now you can see we also don't have anything in our spreadsheet but that's because right now we're just looking for what's the mesh what's the evaluated mesh that we have if we come here we've got a couple other different options you can see point cloud is the second one so if i switch to point cloud i'm suddenly going to get all the data and information that's being generated about this point cloud so you can see we have we have tons of these we have hundreds of points now now if i come over you can see we get a lot of information now it's not just position we've got position radius grease material like there are a ton of different data points each one of these uh columns is considered an attribute so that's a new terminology that's being introduced with geometry well it's not new it's been around but it's being used really actively now with geometry notes but there's one other thing that we can look at in terms of creating points to manipulate okay and that's when you use geometry nodes to actually generate your own mesh right from the start so if we didn't want to use a point cloud and distribute points across a surface and we also didn't want to use whatever mesh it is that we start with we kind of wanted to start from scratch and do everything from inside geometry nodes we can actually get rid of the group input now if i delete the group input you'll notice that everything's gone if i go into edit mode though you can see my cube is still here it's still here but it's just no longer being it's no longer visible and it's not hidden or anything it's just literally gone when i leave edit mode because this modifier doesn't have a group input so it's no longer receiving the vertices of this object the object doesn't exist so what i can do now is i can go shift a and i can go to this new tab here called mesh primitives and i can grab anything i want so we could grab a uv sphere let's say and now i can plug this into geometry and now suddenly i've got a uv sphere and you can see you've got the controls you would have normally when you create a uv sphere but what's neat about this is that this is non-destructive i can do all kinds of stuff to the sphere and come back and still have these controls right at the start now what's really creepy about this is if i enter edit mode uh with my cube go to transparent mode so you can see through there's my cube it's still there in fact i could still move these vertices around and stuff but they have no effect okay because as soon as i leave edit mode everything's gone it's basically deleted more or less and replaced with this new mesh that i have here because of the geometry nodes modifier so those are the different ways you can generate points now of course when i create a uv sphere the points now you can see the point cloud's gone because we don't have any point cloud objects now we've got of course is mesh again and you can see that the mesh now is showing me all the vertices the position of every vertices um for this uv sphere i hope that makes sense you've got vertice vertexes which are going to be the points that you manipulate or you can generate this point cloud with a bunch of point cloud instances which are basically like particles and then we can move those around so both of those things combined allow you to begin to have some data to work with now what do you do with this data once you get it well once we've got something so let's go back to our original cube so i'll delete that and i'll grab a group input node and i'll bring that over here and let's uh let's clean up this chaos a little bit okay so the next thing to understand is how do we manipulate these data points how do we actually move things around or change stuff or do anything with it first thing i want to show you if we go to geometry we can load up the transform node here and i can insert it into my my system now you can see i can translate rotate and scale right but if i do that i'm moving the entire object okay i'm affecting everything all the ones all these vertices i'm treating it as an entire object right but if i wanted to move individual points i need to start working with attributes now if i get rid of this go back to our standard setup and i grab the attribute menu here you can see we have a lot of different types of nodes here i'm going to grab the attribute randomize and i'll throw it down now when you have an attribute node you have this input here called attribute and it gives you this blank area you need to type something into if you click this you're going to get a drop down menu of all the different types of attributes that you could include here so you can hear we've got uv map crease position material index normal we've got a lot of different things now what's really important to remember is with the attribute nodes what's going to happen is it's going to run through and do whatever command the attribute node is set up to do and it's going to do it for each call each row in your spreadsheet right so if i select position so right now what's happening is geometry is bringing in my cube and taking each of the vertexes and it's cycling through each of these and it's not doing anything why well it's because we're setting it to float and that's another really important thing that you're going to run into a lot you need to understand the difference between floating point numbers integers vectors and booleans because they come up all the time now if you've got a background in coding or you've studied math a lot now all this stuff's going to be really natural for you but if this is sort of strange territory for you you can have a few things you need to learn to really begin to get a hold of it but it's not too much and you'll be fine don't worry so a floating point number is these basically each one of these is of individual floating point number it's a number that has a decimal value to it so one point something something six point something something something a integer is a single number so no decimal point so it's just like one two three four five right so it's a single number uh i mean you could have ten a hundred i i just mean there's no decimal point a vector is a set of numbers right so it's usually a set of three numbers and you can see that each of these rows right has three numbers associated with it because each vertex has three numbers that represent where it is in 3d space so these three numbers together are considered a vector so rho 0 has the vector of 1.234 1.199 1.411 in the x y and z that's how it always is represented x y and z so those three numbers make up a vector a boolean is a very very simple uh value it's basically on or off so is something on yes no that's it so it's just one or zero or it's a tick box checked on if we create a boolean value you'll see it actually be a checkbox it's either clicked or not clicked so those are the different types of numbers you need to think about so if you've got the wrong type of number so right now it's actually running through and it's taking the position which is a vector and it's it's trying to randomize a float number for each one and it doesn't really have a place to store it and so it kind of just doesn't do anything so you're not going to see a result but if we switch this from float to vector because the position is a vector of three numbers we're suddenly going to see a change and what's happening here is that you can see we've got these two new boxes here this one has a set of three numbers and this one is a set of three numbers these are both vectors because we've switched to randomizing on a vector so i can now i can change what's the minimum vector i want so let's say i want to go all right from negative x so 1 negative negative 1 x let's say negative 2 on the y and negative 3 on the z value right and then the maximum i want it to be let's just go 3 3 and 3 is the maximum now it's going to generate random numbers between these for each of these slots and it's going to combine them together as a vector and it's going to save it over on the position you can see that our position values have all changed with this and if i move these around you're going to see these numbers changing you can also roll the seed to randomizing different results so you can use geometry nodes attribute nodes to cycle through all the vertices in your object or cycle through all the points in the point cloud if you created the point distribute node and change them all right so i'm just reconnecting up my input to my output now the next thing that we need to talk about is how to create your own attributes because that's really important it's something you do a lot of in geometry notes so i'm going to grab something called the vector math attribute vector math note now this is important there's two different types of vector math so if i was to grab the vector math node this is what it looks like and if i was to grab the attribute vector math this is what it looks like they're quite different now the difference the main difference between these two is that the vector math is going to just do one operation on a single vector value or two vector values right whereas the attribute vector math is going to do math on every attribute so remember if it's got attribute in the title of the node it's going to run through all the different items in your spreadsheet so if i switch back to mesh it'll run through all of these whereas this math node one that is just a plain vector math node it's not going to run through each of these if you're a programmer think about it in terms of a loop this one does a loop this one doesn't okay so we're going to use this and i'm going to drop it here i'm going to create an attribute okay so i'm going to take the attribute position and i'm going to switch the second input so b instead of an attribute i'm going to switch it to vectors and i can input a number here and then the result i'm going to just create a variable i'm going to call it x and you can see when i type an x there is no attribute called x and so it creates this little plus symbol next to the name x if i click that it's going to create a new column here in my spreadsheet called x and now this is my new attribute my custom attribute that i've just created and what i'm doing with this one here is i'm adding the attribute a right here which is the position i'm told to take the position value for each row it's going to run through each row and i want to add this vector to it so at the moment we're adding 0. so you can see everything stays the same let's say i want to add 1 to the x you can see now each of these in the x column goes up by 1 whereas the y and the z don't they stay the same so what would i want to do that for well there's a lot of really cool things that you can achieve with something like this so let's say i want to move all of the vertexes on the x by one so i've done this operation but i want to kind of have a bit more control over the final look and how how it works so let me create a new node here the attribute mix node and i'll just drop that in the chain and i'm going to turn the factory down to zero to start with and what i want to do is i'm going to take the factor x right or the attribute x that i've created which is this variable and i'll take the position and i'm going to store the result in position now whenever you store the result on top of something it's going to overwrite it right so i'm saying look i want to overwrite the position of these guys with this new thing now i've set the factor to 0 so it's not actually doing anything but if i move it around you can see now that oh sorry it was doing something zero is fully on one was fully off if i flip those it's going to be the other way around but you can see now i'm moving all of them on the x by this value and i've got a little bit of control now over how much i do that now i could increase this number you know i could push this way up and now i'm able to like you know control how much i move these guys now that we've talked about attribute nodes and creating attributes as well as points and vertices and how geometry nodes thinks about them let's put them all together and create something that's useful so what i'm going to do is i'm going to recreate what jonathan lampell talks about in his recent review of blender 2.93 which you can find on cd cookie or if you get the cg cookie newsletter email newsletter you will have gotten an email directly from him with all the updates and in that he's got a couple of cool node setups in geometry nodes and i'm going to talk you through one of them so i'm going to delete my default queue and we'll see we'll lose our geometry node system because of course it lives on the object itself and i'm going to create a mesh plane and i'm going to scale it up a little bit now this mesh plane i'm going to click new to create a new geometry node session and i'm going to i'm going to subdivide this plane i'm going to make make more geometry instead of adding a subdivision surface node i can actually do that in here so i can actually go subdivide and i can stick that here and i can increase the number of subdivisions you can see instantly we start getting all these different points if i switch to wireframe view you can actually see the subdivision in action so we can actually visualize what's going on so i'm going to turn this up to six get a nice dense mesh here now i'm going to also create another object i'm going to create a mesh and we'll create a suzanne monkey there she is go back to shaded view and i'll just uh rotate her a little bit on the x and bring it down like so and i'm going to add in a new node which is called an object info node this allows us to bring another object into our system so i can grab the suzanne now i want to figure out how far away are the vertices that make up suzanne from the vertices that make up my plane and i can use the proximity node attribute proximity node to do that remember attributes so it's an attribute node which means it's going to run through every single row in my uh my objects all the different vertices is going to calculate something so i'm going to take the geometry output of my object info note and i'll stick it into target because this is the target object i want to be measuring so it's asking for the attribute here that i'm going to save it into and i'm going to create a new variable here called distance now you can see boom i get this new variable here called distance and this if you remember from before is a floating point number not a vector it's just a floating point number okay so now that we've done that let's add the next node let's go back to the attribute mixed node that we were using before and i'm going to drop this in here now what i want to do is i'm going to change the the factor which is the amount that we're going to be mixing i'm going to change this to an attribute and i'm going to put my distance my distance variable in that field so this will be sort of the amount that it mixes whatever it is i'm about to do so i'm going to take uh for my first set for a i'm going to make it an attribute i'll put my position so this will take the position of every point on the surface and for this next one i will take the the next for b i'm going to switch b from an attribute to a vector and i'm going to store the distance i'm going to start the result in the position so i'm going to move all these vertexes so get ready for this bam all right so what's happened our plane's kind of taken the shape of suzanne which is kind of weird and cool now i'm going to change here so i'm going to say let's move them up on the z value right and now you can see it's starting to warp the mesh based on the location of suzanne now one thing you'll notice is if i move this around and move susan around it's not the mesh isn't updating nothing's changing and that's because we've got object the object input node the info node is set to original not relative so when it's original it's just looking at sort of what's the original uh it bases everything on the zero zero point basically so if i switch this from original to relative now it's suddenly gonna be moving around as i move suzanne now this is a really weird looking thing right like i don't know what's going on here now it's pretty crazy let's get rid of the attribute mix node that was just to demonstrate what's going on now let's let's take this and let's say let's raise up the ground just a little bit wherever suzanne is or any object that we use for this system so uh let's um let's do that so we've got our distance right that's being calculated but you could see that things went really high the further they went away i don't know if you noticed that but basically it was showing us that the higher the further away it is the greater the distance which makes sense because the further away something is from something the greater the distance that's a bigger number so the bigger the number the more it was mixing in that value that we changed it was going really really high but we want the opposite we want it to be high where suzanne is and really low everywhere else we also want to kind of clamp it because we don't want everything moving around we kind of want it just a little hill just around where suzanne is located so there are a lot of ways to do something like this and that's one of the fun things about geometry nodes is there's a lot of ways to approach the problem so let's approach the problem with what we've learned so far so we've got our distance value that we've calculated in order to move something up i could use the attribute vector math node in order to add some value to each of them for the z position or i can use the point translate node which is one of the point nodes which allows me to move and manipulate the points so both will achieve the same thing in this case i'm going to use the point translate node so i'm going to drop this here now what does this do on a base level you can see i could just use it to move all the points up or down or left or right but what i want to do is switch the type from vector to attribute and this will allow me to use an individual attribute to move all these points so if we put distance in this you can see we do get a different effect for each point on our entire piece of mesh right it's not quite the right one but you can see that it is being affected by the position of suzanne we don't want it shearing off though we kind of want to just affect it on the z level so let's cancel out the x and the y we don't want to move those at all now we can do that with some math so i'm going to grab a attribute vector math node and i will stick it before my point translate node what i want to do is i'm going to take my distance attribute and i want to switch the second one to a vector and i'm going to multiply this vector by distance and i'll store it in distance now if i keep these as all zero you can see the distance becomes a zero zero vector but i want to keep the z value so i'm gonna hit one there and you can see now i've managed to get rid of that shearing effect because i've gotten rid of all the values for x and y it's no longer moving them in those directions it's only moving it up and down and again it's still based on the distance to suzanne another cool effect is that we've also turned distance which was a floating point number into a vector by doing some vector math with it you can see that's a cool way of doing that you can also use a convert node to convert a number into a vector uh if you need to we've got a cool effect uh it kind of is like a sheet now that's catching suzanne and this might be like you know an effect that you want to want to have right it's kind of like this trampoline thing which is kind of cool that's not quite what we're after for this for this uh for this tutorial so the next thing i'm going to do is i want to begin to change these numbers i need to invert them right so that wherever suzanne is everything's really high and wherever it's far away from her everything's really low so we need to just invert what's going on now a really cool way of doing inversion is to use the map range note now if you're using procedural materials a lot you've used the map range note before there it's pretty much the same thing here i'm gonna go attribute and i'm gonna go for the map range note and i'll drop that here in between this is a really versatile node the basic concept behind it you can see has a from minimum two mega from maximum and a two minimum and a two maximum basically it takes two ranges and it changes it translates the numbers so that they fit the new range so what i can do here is i can say all right i'm going to take my distance attribute because that's the one that we're using to do everything with here and i'm going to store the result in the distance attribute as well and now what i want to do is i want to change this from float to vector because i'm going to be working with the vectors remember i need three numbers for each point because i'm trying to define positions in 3d space for each point of my plane and i'm going to go from minimum to maximum now how would we invert well the first way you could do that is you can if you flop the two minimum and two maximum that will invert the the system so if i go uh one one and one and then make the maximum zero zero and zero i've inverted it right you can see it's also moved everything off to the side so i don't want that so again we're not going to deal with the x and the y i'm just going to set x and y to zero so now we're only going to minimum one and two maximum is zero and you can see that it's inverted the shape now what i can do as well is i can click clamp and that will clamp everything that goes below zero we'll clamp it at zero so we don't get any negative values and you can see what happened there it flattened at the corners now if i move suzanne around you can see we've got this flat object and as we go above one it starts to balance back out as well so it never goes into the negatives and it also never goes above the number one we need to kind of shrink this mountain down these values are way too high the easiest way to do that is just to do it all within the map range node so first off i can take this to minimum number and i can shrink it down i can pull it down and i can say look i actually don't want to go up that much i just want to go up a little bit right so there we go just gone up a little bit but now our heel is way too big i want to constrain it so it's tighter around the object i can do that with the from minimum to maximum part of this node so if i take my from max and i begin to drag that down you can see that there's a circle here that begins to get tighter around the object and it's going to change how much uh how much of a range we're working with and there we go so now whenever suzanne gets close we can move around and it creates kind of like a snow effect and then we can right click on our plane and shade smooth and now we've got this really cool system that will actually affect the shape of our plane based on the location of another object now what's so neat about this is i can use any object so i can create a cube and i can stick the cube here and i can swap it out so i can say actually i want to do this with the cube okay so now that i've got my uh my snow system working and i can switch it how would i have multiple objects at once there's a lot of different ways of doing it but one i could say call this a system snow what i want to do is i could i could do it all within this one node group so i could actually take this whole system and i could bring it over here and attach it just before my point translate have a new object and create a new variable so call it distance two or something and then have a new vector attribute math node and add distance two to distance one and bama have the result but that's kind of pretty cumbersome if i'm doing this a lot of different times so what i could do as well is i could say all right i'm to have two geometry node systems on this one thing so i can come over here to the modifier stack on my plane and i can use this little drop down menu and i click duplicate that will duplicate this geometry node system so i've got two now for this other one i can just click on this little node group here this will make snow a new group so this is now snow.001 right so we've got two geometry nodes right so with snow.001 selected and the second geometry node selected if you select these it's going to switch between them so that's important to remember so if i select this geometry nodes now i can grab this one and i don't need to be subdividing again so it's actually subdividing twice so i can get rid of that i can take this one and i can switch it to suzanne and now you can see that both of these node groups are behaving on top of each other so they're both working appropriately and i can have multiple node groups affecting one object instead of having two versions of snow that are slightly different uh what i could do is i could actually remove this subdivide from the first one and then i could just add in a subdivision surface [Music] set it to simple and increase the value there to six and now the next thing i'm going to do is delete this second geometry node group so we just have one right you can see we go back to just having the cube instead of using an object info node what i can do is i can come up here to my scene collection click on new collection and i can call this my uh objects let's just say and i'm going to take suzanne and my cube and put them both into my objects collection it doesn't matter what it's called you can call it anything you like i'm going to come down here and instead of the object info node i'm going to grab the collection info node and i will grab my objects collection and input the geometry there i'm going to switch it to relative and instantly you can see we now have a collection that's driving this geometry node system so that means any object i add in here it's going to be displacing my mesh appropriately which is super exciting again it's really important to remember that you know you can do the same thing without the mesh of your your plane you know we could use a point distribute node right at the start and turn the density right up and if you look closely you can see that these points are elevated near our objects you can see that the points are moving around and this could help you generate a totally different effect if for example you wanted to instance some geometry these points are so if we created another mesh let's say like a uv sphere let's just stick it off to the side grab my plane and go to the very end here and go for a point instance node we can grab that sphere and now if i go it's a bit too big so i'll go into edit mode and scale it down so it's really tiny you can see i've got a bunch of spheres now that are being moved around based on the location and the last thing that's important to note is of course that this can work with something other than a plane so let's say i wanted to create a uv sphere i could scale this up and i could click new to add a new geometry nodes modifier to it and then just select my snow and now you can see that the points are moving if i hide my plane you can see that as i bring this close to suzanne the points on the outside are being deformed appropriately so if i was to subdivide this so i put a subdivision surface modifier on this sphere and put it before geometry nodes so that it's affecting it you can see as i increase my subdivisions we get this really interesting kind of look as uh it intersects with the objects now again remember if you select an object that has some modifiers on it you have to select the geometry node's modifier itself in order to get the view to show up so that can get you if you're not looking out for it thanks so much for watching this tutorial i hope you really enjoyed it and learned some cool things hit that like button if you did and leave us a comment and don't forget to subscribe to the channel here on youtube so you can find out when we release new videos and don't forget to check out cgcookie.com thanks so much for watching i'll catch you in the next one see ya
Info
Channel: CG Cookie
Views: 92,659
Rating: 4.961834 out of 5
Keywords: Blender tutorial, learn blender, CG Cookie, blender beginner, Intro To Geometry Nodes, geometry nodes, blender 2.93, blender 2.93 features, blender 2.93 tutorial
Id: JKDJ5QvhLIw
Channel Id: undefined
Length: 31min 15sec (1875 seconds)
Published: Thu Jun 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.