Transcript for:
Blender Grass Creation with Geometry Nodes

hello everyone and welcome to the chapter number 34 of blender Master course geometry nodes creating grass in the previous two chapters we understood about creating this fence along with the wood texture and also a simple base for the landscape and we created all this with the help of geometry nodes and in this chapter we'll be exploring about creating the grass for the landscape and with this we'll also be covering all these Topics in complete detail and yes if you are new to this course then do check out the previous 34 chapters from the link of the playlist in the pin comment so previously we made this fence and this base for the landscape and now let's begin with the creation of grass Now to create the grass first add a cube in the scene by pressing shift plus a and in the mesh select the cube let's move it in the y direction by pressing G and Y and place it over here and we'll be creating the grass with the help of geometry noes in blender for this go to the geometry noes editor and click on this new button the first Noe that I'm going to add is the mesh line node to add it here press shift plus a go to mesh and in Primitives select the mesh line let's place it over here and now this mesh line node is connected to the group output now as the name of this node suggest it basically creates a mesh in the form of a line and since it is a mesh therefore it has vertices and edges connecting with each other and if you want to view those vertices we need to add another node which is the mesh to points node so press shift plus a go to mesh and in operations select mesh to points we'll place it after the mesh line and here you can see that these points are the vertices of this mesh line now here you have some options in the mesh line curve and let's explore them in detail this offset option basically allows you to to change the distance between each point on a particular axis for example if I increase the x value you will notice that the distance between the points will increase in the x-axis similarly if I increase the value in the y- axis the distance between the points will increase in the y- AIS similarly with the Z axis also if I increase it the distance between two points or the offset will increase then the next thing that you have here is the start location and by using this option I can basically change the position of the first point or the first vertex of this mesh line so if I change it in x-axis you can see here that its Position will change in the x-axis similarly in the Y AIS and also in the Zed axis so this one is basically used to change the position of the vortex and the offset is basically used to control the distance between two points or two vertices and the next option that you have here is the count and it basically determines the number of these points or the vertices in the mesh line so if I increase it the number of these points will increase and also the length of the mesh line will increase now you also have this option of selecting the mode which is set to offset by default but if I change it to end points it will allow us to control the things in the mesh line differently than before with the end points mode selected you can control the length of this mesh line or basically the position of the starting point and the ending point from these values here for example the start location will determine the value of the first vertex which is placed at the bottom and the end location will determine the position of the last Vortex which is placed at the top so if I increase the value of end location in The Zed axis you will see that the position of the last Vector will move upwards and as a result the length of this mesh line will also change previously in the offset mode you are able to control the length of this mesh line with the help of this count option but in this case no matter what the value of count is the length of the mesh line will remain the same and only the number of these points of vertices will change and now specifically in this end points mode here you have the option of selecting the count mode if I change it to resolution then here you have the resolution value which is basically the minimum distance between any two points in the mesh line so if I reduce the resolution like this then the distance between the two points will decrease and as a result in the same length of the mesh line we'll be having a higher number of vertices or these points and since we'll be using this mesh line for making the grass I'll be changing the mode from end points to offset let's also change the value of offset in the Z axis to 1 M and let's round off the count value from 19 to 20 now if you remember we added this mesh to points in order to see these vertices but now it's no longer required so I will press X to delete it and let's take this mesh socket and connect it to the geometry and this is how a mesh line is looking right now since we'll be making a grass out of it we need to apply some rotation to it and for this we'll be using the vector rotate node and to add it here press shift plus a go to utilities and in Vector select the vector rotate let's place it over here and since we are changing the rotation of this mesh line we also have to use the set position node so press shift plus a go to geometry and in the right category select the set position we'll place it just before the group output and now here we have a mesh line node which created this mesh line a vector rotate node which will be used to control the rotation of this line and a set position node which is being used because we are changing the rotation of this line now to connect this Vector rotate node to the rest of the node system take this Vector socket and connect it to the position and we notice that the mesh line disappears that's because we have to use these values to control the rotation and the visibility of the mesh line now since we'll be changing the rotation of different vertices so we have to tell this Vector rotate node about the position of those different vertices for this we'll be adding the position node about which we learned in the previous chapter so press shift plus a go to geometry and in read select the position node let's place it here and connect it to the vector socket and now this mesh line is is again visible now here you have this angle option in the vector rotate node and if I try to change it you will see that nothing happens and this is because we need to give some input to it about the index value of different vertices to change the angle to do this press shift plus a go to geometry and in read select the index let's place it here and connect it to the angle and now suppose you want that each of the vortex should rotate around a particular axis for this you can change the type of rotation to any particular axis so if I select the x-axis here we have all the vertices or the points of this line rotated in the x-axis and if you want to control this rotation we have to use the math node so press shift plus a go to utilities and in math select the math node we'll place it between the index socket and the angle and now if I change the function to multiply then I can use this value to control the rotation of the different points of the mesh line in the x-axis and if you feel that while changing the value by left clicking and dragging like this it's changing very fast so you can simply hold the shift button and then you can see the changes slowly now let's again understand what all we did here in order to revise each and everything first we added the mesh line node because we wanted to create the grass with the help of this mesh line then to change the rotation we use the set position node and to control the rotation we use the vector rotate node then we use this position node to act as an input about the position value of different vertices and to change the angle of rotation we used this index node and connected it to the math node with the multiply operation so that we can control the rotation of this line and it was rotating like this because we have set the type as the x-axis now moving ahead let me tell you about some other useful notes which I use to change the object type from mesh to curve or from curve to mesh for this the first node is the mesh to curve node to add it here press shift plus a go to mesh and in operations select the mesh to curve and let's place it here now you may not notice any changes here but it actually changes the object type of any object from mesh to curve and to confirm this you can go to this spreadsheet and now in the mesh you can see that you have zero vertices zero edges zero faces and zero face corners but here in the curve section you have this option of spline and the number here is set to one and from this you can confirm that the object type for this mesh line is changed from mesh to curve and there's another node whose function is just the opposite of this mesh to curve node and it is known as the curve to mesh node to add it here press shift plus a go to curve and in operations select the curve to mesh let's place it here and now the object type for this mesh line will change from curve back to mesh and to confirm this you can go to the spreadsheet and here in the mesh category you have 20 vertices and 19 edges previously both of these values is zero and the number of spline in the curve was set to one which is now again zero so by using this node you can simply convert the object type of any object from curve to mesh and now moving ahead in order to give some thickness to this mesh line we'll be using another node which is the curve line node to add it here press shift plus a go to curve and in Primitives select the curve line let's place it here and now this curve line is very similar to the mesh line that we added here to view it in our scene hold on control and shift and if I left click on the curve line node then now we can see this curve line added in my scene now the difference between the curve line node and the mesh line is simply that the object type of the curve line is a curve and that of mesh line is a mesh in order to view the vertices or the points of this curve line we'll be adding the curve two points node so press shift plus a go to curve and in operations select the curve two points let's place it over here and now you can see that these are the points on this curve line now just like the mesh line you can control the position of the first vertex with the help of the starting positions and for the last Vortex you have the end position which you can control from here so you can simply change the position of the starting point and the ending point in any of the three axises from the parameters here now we'll be using this curve line node to give the mesh line that we created some width or a dimension by connecting it to the profile curve here to view the results I will delete these two by pressing X and let's zoom out and we see some changes in the mesh line that we created to increase the width in the x-axis we'll change the position of the start parameter in the x-axis and now you will notice that the width of this mesh line in the x-axis will increase and another thing to notice here is that once side of this mesh line is slightly pushed upwards in The Zed axis and that is because the position of the ending vertex in the curve line is set to 1 m in The Zed axis to level it perfectly I'll change its value to 0 m and now it looks fine and now let's revise the curve line node as I already told you it's very similar to the mesh line except for the fact that its object type is curve instead of mesh and we connected it to the profile curve because we needed to give some thickness to this mesh line in order to create the grass now in order to make it look like a real glass blade we need to change it shape it should be bigger in size at the bottom and then it should scale down as it moves upwards for this we'll be using the set curve radius node to add it here press shift plus a go to curve and in the right category select the set curve radius now we have to understand one basic thing this set curve radius node can be applied only to a curve and so the input that it will receive should also be a curve and in this node system we added this mesh to curve node which converted the object type of this mesh line into a curve meaning that the output that it will give will also be a curve so we'll be in it after the mesh to curve node and here it gets connected now you can use this radius value to control the curve radius but in order to achieve the result where the area is bigger at the bottom and smaller at the top we have to use another node to control the radius and it is the spline parameter node to add it here press shift plus a go to curve and in the re category select the spline parameter we'll place it over here and we have to connect it to this radius value because the spline parameter node is being used to control the radius or basically the size at the different points and for this if I take this Factor socket and connected to the radius you will notice that at the starting point it now has the lowest size and then the size keeps on increasing and reaches the maximum at the ending point and this is how the factor socket works in the spline parameter and now let me explain you about this Factor socket of the spline parameter in complete detail actually the output that this Factor socket gives is in the form of 0 to 1 meaning that it will pass the value of zero for the beginning and then it increases from zero till it reaches one so you can say that at the lowermost point which is the starting vertex the radius or the size is zero and at the topmost point or basically the end the radius or the size is equal to a value of one now if you remember I told you that we needed the starting point to be bigger in size and the ending point to be smaller but here we have the opposite result meaning that we need to remap the range value of this Factor socket which is currently set as 0 to 1 and we'll change it to 1 to 0 by doing this the area at the starting or basically the lower part will be greater and then it will reduce and at the top or basically at the end the area will be the minimum and to achieve this result we have to use the map range node now to add the map range node press shift plus a go to utilities and in the math category select the map range we'll place it after the spline parameter and now this map range is connected to the spline parameter and the set curve radius now to invert the range from 0 to 1 into 1 to 0 simply go to this two minimum value and change it to one and this two maximum value to zero and here we get the result but let me also explain to you exactly how it worked see we added this Pline parameter in order to make this look like a blade of grass and when we connected this Factor socket to the radius it gave the radius a value of 0 to 1 from bottom to top but we needed it to be opposite as a result we added this map range node changed the minimum value to one and the maximum to zero meaning that the range of this Factor socket was now changed into 1 to Z and as a result the radius at the lowermost point is the maximum and at the uppermost point which is the end point it is minimum now another thing to notice here is that at the top you can see that the radius is exactly zero making it look very sharp and pointing and if you don't want this you can simply increase the two max value to a slightly higher number like 0.05 or maybe 0.03 and now it looks perfect and yes you can also control the size at the bottom either from the two minimum value or from the curve line node by changing the starting position in the x-axis so you can control this size at the bottom with the help of this parameter now moving ahead we'll be creating a bunch of this grass placed over a circular base and for this I'll be adding a new node which is the mesh Circle node to add and understand it press shift plus a go to mesh and in Primitives select the mesh Circle let's place it over here now to view the mesh circle in my scene I'll take this mesh socket and connect it over here let's go to the top view by pressing seven on the numpad and here we have the mesh Circle added in our scene this mesh circle is exactly the same as the circle which you can add by pressing shift plus a in the 3D view port and in the mesh here you have the object of circle so both of them are the same circles it's just just that you have added it from the geometry nodes editor now in the mesh Circle node you have this option of fil type and by default it is said to none meaning that the circle won't be filled with any faces but if I change it to Eng gone then now here we have one face and our circle is now filled but in the fill type you have the third option which is the triangles and if I select it you won't notice any difference that's because the main difference can only be seen in the edit mode but if I tab into the edit mode you won't actually be in the edit mode of the circle and that's because originally the object that was added here was a cube and you can even see this in the scene collection we did all the changes in the geometry notes Editor to convert the simple Cube into various other objects like grass and then we added this mesh Circle node to view the circle but since originally it was a cube object as a result in the edit mode it still appears as a cube but to understand the working of the FI type with the triangles mode We'll add another mesh Circle by using the add menu for this first I'll take my cursor over here by holding shift and right clicking now if I press shift plus a go to mesh and select the circle here we have the circle added now if I go to the add Circle properties and change the field type from Nothing To None and if I tab into the edit mode you can see that we have these vertices around the circle and a face in between but let's come out of the edit mode and to check the next field type I'll first delete this add another Circle by pressing shift plus a and in the mesh I'll select the circle from the FI type I'll change it to Triangle and if I tab into the edit mode now you can see that all these vertices are getting connected to the center and forming these triangle faces and this is the use of the triangle fi type in fact the same concept is applied when I was was working on this mesh Circle and change the field type to triangles then you have this option of vertices and by using this you can control the number of vertices of your circle object and similarly this radius option will determine the size of your circle now we'll be using this mesh Circle to place grass on its different faces in order to create a bunch of grass for this first elate the second Circle by pressing X and let's also take this 3D cursor back to the world center by pressing shift plus C and now if you want to look closely at the Circle one way is to zoom in like this but an easier way is to select it and press the dot or the period button in your numpad and now we get a close view of the circle now to place the grass at different faces on this circle we'll be using the instance on points so press shift plus a go to instances and select instance on points let's place it over here after the mesh Circle and to place the grass over here we have to connect the grass to the instant socket for this I'll take this mesh socket of the curve to mesh and take it to the instant socket and now here we have the grass placed at different faces of the circle and now one thing to notice here is that all of them are rotated in the same direction and to give them different rotations we'll be adding a random value node and connected to the rotation so press shift plus a go to utilities and select the random value let's place it over here and connect this value socket to the rotation now it appears like this because the data type in the random value is set to float however we know that for rotation we need to input a vector value for this I'll change the data type from float to vector and now with the help of these parameters I can control the rotation of this grass in different axis for this I'll take this value socket and connected to the rotation and this is how our grass is looking right now now what this random value node is doing is that it is giving some random rotation values to all the blades of grass in all the three axis meaning the x axis the Y AIS and the Z axis but suppose we want the rotation to be only in The Zed axis and for this we'll be using the combine XYZ node to add it here press shift plus a go to utilities and in Vector select the combine XYZ let's place it over here and connect it to the maximum socket in the random value now with this combined XZ node I can easily control the rotation of of this grass in any one of the three axis but since we want to rotate it only in The Zed axis so I'll go to the Z axis and try to change the value here and if I increase it each plate of the grass will get a different rotation in The Zed AIS now similar to controlling the rotation you can also control the scaling of this grass for this I'll again add the random value node so I'll select this press shift plus C and place it over here now take this value socket and connect it to the scale and now with these parameters I can control the scaling of different blades of grass in my scene so I can change these parameters like the minimum in the xaxis the minimum in the Y AIS and similarly The Zed axis with these values I can directly control their scaling in different axis for example if I select the minimum value in all the three axis and change it to something like 0.4 then the grass looks like this to view it properly you can deselect the grass and now you can view it from different angles and confirm if the scaling and the rotation are proper in the geometry notes editor or not now if you want to control the size of this bunch of grass or the number of these grass plates you can go to the m Circle option here and if I increase the radius the size size will increase like this similarly the number of vertices will control the number of these glass blades and here you can also see that we are not having any grass on the face of the circle we are only having the blades of grass at the position of the vertices of the circle and to get these blades on different points of the faces we'll be using another node which is the distribute points on faces to add it here press shift plus a go to point and select the distribute points on faces let's place it over here and now we have the blades of grass placed over different points on the entire face of the circle now you can control the density of this grass from the density option here so if I reduce it the number of grass per square area will reduce and now it looks like this so we'll finalize the density to this value and let's also reduce the size of the bunch of grass or the circle with the radius option here and you can also use this seed value to generate a different output with the same settings each and every time now moving ahead let's also give it some basic material for this we'll add the set material node so press shift plus a go to material and select the set material let's place it over here and now we'll be connecting it after the instance on points node for this first I'll bring this group output node up in the geometry nodes editor over here then I'll take the set material node and we'll drop it in between the instance on points and the output to create and view the material let's go to the render View and we have to keep the render engine to ev4 now now to create the material we'll change this spreadsheet into the Shader editor so click on this icon and select the Shader editor click on the new button and let's rename this material to Grass to assign This Grass material to this bunch of grass go to the set material node and click on this material option and select the the grass now we'll be giving this grass a simple green color by going to the base color and let's change it to light green color like this and if you want you can add a simple color ramp and make a combination of light green light yellow color or some dark green color but right now I think that it looks perfect so we'll finalize the simple base color now moving ahead we'll be creating different bunch of grass with different settings like in one of them we'll reduce the density or maybe the size of this grass or the rotation or the bending and for this we'll be using another node which is the collection info node but before that we'll be using the group input node to directly get all those settings in the modify properties editor Let Me Explain you practically by doing it I'll select this group input node press n to open the toolbar and we won't need this geometry socket so I'll delete it by selecting this geometry socket and clicking this minus icon now if you want to create a new socket of your own you simply have to select that particular socket for example if I want the density socket to be here so I'll select it and connect it to the socket of the group input and now here we have the density connected and because of this I can directly control the density from the modify properties here similarly you can also connect the new socket to other parameters like the radius and here you have the radius in the modify properties and with this I can control the size of the patch of the grass so I'll rename it from this tool bar by double clicking on the radius socket and it change it to Grass patch size Now to create a socket to control the rotation I'll take a new socket and connect it to this combined XYZ node in The Zed axis this combined XYZ node was connected to the random value which was connected to the rotation and to rename it I'll go to the toolbar double click on the Zed and we'll change it to rotate Zed press enter to confirm and now we have three parameters in the modify properties first one is the density with which you can control the number of these grass plates in a particular area then with the grass patch size you can control the radius or basically the size of the patch of grass then you can use this rotate set parameter to rotate the blades of grass in the Z axis like this and the benefit of using this group input node is that you can now control these values directly from here instead of going to the geometry node editor each time and understanding each and every node to create any change in the structure now we can also control the height of this grass by connecting this new socket to the random value node here which is connected to the scaling to increase its height we basically have to increase the maximum value in The Zed axis because if I increase it the height of the grass will increase but if I take this socket I have to connect it to the maximum socket which is controlling all these three axes and to control Only The Zed axis we'll be using the combine X node so I'll select this combine xed node press shift plus d to create a duplicate and place it over here let's change the value of all the three axes to one because we'll be connecting it to the maximum socket which is having a value of one in all the three axis now I'll take this Vector socket and connect it over here and now I can directly connect this new socket to The Zed axis which will allow us to control the scaling or basically the height of this grass in the Zed axis to rename it go to the toolbar double click on its name and we'll change it to height now from the modifi properties you can directly control the height of the grass from here then moving ahead we also added this multiply node here which was controlling the bending of the grass so if you want you can even connect this one to the group input node and to do this let's bring the group input node over here take out the new socket and connect it to the value go to the toolbar and double click to change its name we'll rename it to bending and now we have five different parameters to control in the modifier properties now the benefit of doing all this is that we can now create different duplicates of this grass patch and control its appearance directly from here for this with the grass selected press shift plus d let's move it in the wi Direction and place it over here with this cross patch I'll reduce its height from here so let's reduce it to something like 0.7 or 0.6 let's also reduce its bending to minus 0.3 and let's increase its density from here now all the changes that I'm doing here are completely random it only depends on you that exactly which type of grass you need for your scene so you can change these settings yourself in order to make the best looking grass but let's also create another duplicate by pressing shift plus d move it in by Direction and place it over here and this time I'll increase its height to something like 0.9 or maybe 1 M let's also increase the bending and this time I'll be reducing the size of the patch of grass let's slightly increase the density also and now it looks perfect and now we have three different patches of grass with slight variations in each one of them now before placing them on our landscape we first have to create a collection of these three grass for this I'll select all of them and to create a new collection with only these three patches of grass the shortcut is to press cr+ G you can change the name of the collection from here so I'll rename it to Grass it will basically create a collection where it will store the three types of grass that we created now coming back to the landscape if you remember we distributed these points or basically these cubes on the faces of this landscape with the help of these two nodes that is the distribute points on faces and the instance on points but we'll be placing the grass that we created in place of these cubes for this I'll delete this Cube node by selecting it and pressing X and now to connect the collection of grass that we created to this instant socket we'll be using the collection info node to add it here press shift plus a go to input and in scene select the collection info let's place it over here now to select the collection of grass click on this collection and select the grass now I'll take this instance socket and connect it to the instance now let's zoom out and you can see here that the size of this grass is too high to fix this I'll first go to the density and reduce it to something like 0.1 then I'll go to the scale values and change it in all the three axes to a lower number like 0.1 M and now here we have the different patches of grass placed at different points in the landscape now if I zoom out you can see here that the position of this grass is not perfect some of the patches of grass are lying outside this plane and to fix this you simply need to turn on the separate children and the reset children in the collection info node this will place the grass patches or any other object that you choose only on the plane or this landscape now if I go to the camera view by pressing zero on the numpad this is how our scene is looking right now also you can notice some imperfections for example this fence is going below the plane but we'll be fixing it in the next chapter but for now if you want to render it then to change the camera view press n and in in the view section enable the lock camera to view now you can change the view of your camera by holding the middle Mouse button and dragging your cursor like this now to hide that area which is outside the camera view we'll be changing some settings so for this select the camera in the scene collection and in the object data properties go to this passive part out option in the viewport display and increase its value from 0.5 to 1 and now we'll be seeing only that area which is inside the camera view let's also change the density and the size of this grass so let's increase the density of grass from the den it option over here but I think that the density at 0.1 looks fine so we won't be changing it and for the size we'll go to these scale values and let's reduce them down to something like 0.05 and now I can increase the density so that our scene is filled with grass now if you want you can also change the color of the base of this landscape for this you can go to the material properties click on the new button and change the base color from here so if I reduce the brightness and change it to brown color then our scene would look like this but for now I'll be removing this material from the base of the landscape because we'll be working on it later on so click on this minus icon to remove it now we can make this scene look better by properly placing this fence and also by adding some rocks and in this way we can finalize our scene but we'll be doing all this in the next chapter so this brings us to the end of this chapter in this particular chapter you learned about creating and adding grass on different points of faces on a plain object and we understood all this with the help of geometry notes in blender our next chapter will be the chapter number 35 geometry nodes creating rocks so don't forget to subscribe to our Channel press that notification Bell so so that you can get timely updates about the upcoming chapters thank you for watching and we'll see you in the next one