Blender page button below.
I want to learn geometry nodes. Geometry nodes is a modifier which is highly customizable and can create many different effects using its node based system. It's important to note I have already used geometry nodes in some basic forms before starting this however I'm starting again from the beginning, this time properly.
For the first parts of geometry nodes I'm learning from a YouTube tutorial series by CGMatter link below.
When you create a new geometry node network, it creates two new nodes, the group input and group output nodes. All nodes go within these two nodes in order for the modifier to work (exceptions occur when you add other shapes or geometric objects instead). The group input is the node which holds the information the modifier starts with (if the modifier is attached to a cube, the Group Input holds the information of the cube). The group output is the node which ends the node network and so holds all the information from start to beginning.
Much like the shader node based system you can create new geometry nodes by going to the geometry nodes tab and at the top of the node network you can press new. You can also add geometry nodes via the modifiers tab in the properties window.
This is an extremely basic use of geometry nodes, this node is the transform node and so you can change the position, rotation and scale of the object the modifier is applied to. In this case a cube scales in size by two.
This modifier can be applied to any object so if I want to scale something else by two, I can simply apply this modifier to it.
First Geometry node:
For the first geometry node, any object the modifier is applied to will become a sphere no matter how complex.
One way to change the geometry from its original geometry to another is to create mesh primitives. By scrolling to Mesh-Primitives and picking one of the shapes it will add the shape as a node this way if you connect it to the group output it will now show up as the new geometry, also the input will not be connected anymore. Adding primitives also allows you to change extra data, for example the UV sphere can have its number of segments and rings as well as its radius changed.
Node Wrangler Shortcuts
This isn't necessarily to do with just geometry nodes but is just as important.Ā
To sever a connection you can hold ctrl and right click then drag the cutting tool over the connection to cut it.
To make a connection you hold alt then right click and drag.
You can also shift right click drag to add a reroute, which essentially allows you to reroute one or more connections.
You can use shift ctrl right click drag to Join geometry, this takes multiple inputs from geometry and funnels it into one output.
Shift alt allows you to change the output from one node to another, in other words if you have two nodes and one of them is connected to the Group output, by pressing shift alt on the other node it switches the connections from the original node to the new one.
Here I've used what I learnt and connected basic primitive shapes along with transform nodes, joined all of the geometry together and changed the location rotation and scale of each object. Now once this modifier is applied, any object with the modifier will become a snow many made from primitive shapes.
Here I found out you can organize groups of nodes into different boxes which helps for organizing complex node networks. To organize the node groups select the nodes and hold shift and p.
The set position node is essentially a more complex transform node, allowing you to move the object in edit mode, this offsets the geometry from its origin point. The set position node only works for the selected geometry, this means we can select certain vertices, edges or faces to be the only ones affected by the transform.Ā
Now the selection is connected to an equal node which is connected to the index node. Equal node outputs the result only if the input(A) is equal to the output(B). In this case we have an index node into A and the value 0 in B, which means that in the spreadsheet for this geometry node, the vertex labelled 0 is the selection outputed.
As you can see here only one vertex is displaced along the y axis 0.72 metres.
You can also set the option to Greater than meaning in the spreadsheet the vertices labeled three and higher will be selected.
Here the position is linked with a combine XYZ node which combines x y and z axis into one output allowing you to only affect specific axis. In this case as the index is set into the x value the position of the vertices are only on transformed on the x axis.
You can also make a more complex modifier by adding a mix node changing it to vector, then plugging the original combine XYZ node into the A, and a new node called position(the original position of the geometry) into B. This way when you slide the factor up and down it goes from a regular cube to the line of vertices seen before.
You can also add things from the shader editor, for example a noise texture and this will then be used to offset the geometry. In this case the noise texture is set to 4D which gives us the W factor which can b easily animated to make the cube wobble.
Here I created a capsule shape by separating the position into the z axis only then plugging that into a greater than node setting the B value to 0 and connecting that to the selection of the set position node. This way when I change the offset of the vertices only the vertices higher 0 on the z axis get displaced.
Here I learnt how to take a regular cube and turn it into other mesh primitives. To make a spherical shape you can increase the vertices to around 6, or more for a higher quality sphere, and then add a position node linked to the position in the set position node with a vector math node set to normalize in the middle. This sets the magnitude of the selected vertices positions to one, this way all the vertices are exactly equal length away from the centre point.
Here I just increased the number of vertices in the cube node, then added a set shade smooth node after the set position node which shades the mesh smooth.
You can also take the group input(cube in this case) then add a subdivide mesh node which gives the same result only this time you increase the levels instead of each axis individually.
You can also achieve the same result more manually. Take the position node and link it to a scale and a length vector math node the scale directly links to the set position node but the length branches of into a math node set to divide. The length goes in the bottom value of the divide node and the top value is set to one, effectively taking the reciprocal. We need to this as if we don't it will create a different shape essentially inversing it so that the furthest vertices from the center get even further away.
HereĀ the position branches of into a multiply on the x and y axis which then branches of to a normalize vector math node, which is then separated into x and y axis. The x and y axis from the separate node are then linked to a combine x y z node, and from the original position node a separate x y and z node is linked to the z axis in the combine xyz node. What this does is seperates x and y then moves then normalizes them creating a circle the is combine with the original z axis position, making a cylindrical shape.
To create a cone you can take the same nodes made to make a cylinder, then you create a new set position node from the original set position node, this means that we're making a new edit to the mesh and not affecting the old nodes. Then From the position node use a multiply node, and from the position node separate x y and z into z axis, multiply it by -1, then add 1, then divide by 2 and finally combine x y and z back into the original multiply node. This is done using math nodes so the math done doesn't affect the geometry until the very end when the combine x y and z is reconnected to the multiply. So we separate the z axis, multiply it by -1, this way the vertices with value 1 are now equal to -1 and the vertices with value -1 are now equal to 1, so the top vertices have value -1 and the bottom vertices have a value of 1. Then we add one, so the top vertices now have a value of 0 and the bottom vertices have a value of 2. We then also divide these values by 2, so the top vertices remain at a value of 0, but the bottom vertices have a value of 1. Then we combine the z math nodes from z axis into x and y axis which means the vertices will only be affected on these axis, so when we plug it back into the vector math multiply node, the top vertices which have a value of 0 are merged to the centre at position 0. Whereas the bottom vertices with a value 1 are exactly 1 metre away from the centre point. Effectively funneling the top vertices into a singular point, creating a cone shape.
Like before however instead of the multiply, add and divide math nodes we can use a map range which essentially allows us to set a range of numbers so we can set the range from -1 to 1 and then the bottom range affects each one individually so if I were to set the bottom min value to 2 the base of the cone would double its radius.
You can also group nodes together into one node, to do this you hold ctrl and press z. This only converts all the nodes selected into a single node allowing for you to change the values all in one place.
Here I recreated the snow man from before, this time using the new node groups and I also animated and textured them. This is looks very complex but it's mostly just geometry joined together changed their scale position and rotation so that it looks like a snowman, then keyframing the right transform nodes so that the animation I want happens. Due to the objects of the snowman being created via geometry nodes I must animate and add materials in geometry nodes as they don't exist as separate objects. To add materials you simply create a set Material node select the material and plug the geometry you want the material to be applied to, into the set material node.
I then learnt how to animate without keyframes. To do so we add a transform geometry, then in the translation connect a combine x y z. To make the geometry move upwards you add a scene time node into the z axis. In-between the combine x y z and scene time nodes, a multiply to speed up the animation. Then, to make the cube go up then come back down, you can add a sine math node, sine math gives a sine wave which is a curve that goes from 1 to -1 overtime. The sine node is plugged into a map range which then, the first min and max values are set to that of a sine graph (-1 to 1). Then to make the cube stay above 0 on the z axis, set the second min to max value to 1 and 2. From there you can connect the map range back into the z axis of the combine x y z (if not already). To make it move forward as well as jumping you can add a multiply mode connected to the scene time node and into either the x or y axis.
Here the cube has some random now has random rotation. To do this, from the sine node add another map range and connect it to a new combine x y z in the y axis. Then to add randomness from the scene time node connect a noise texture via a divide math node(to slow down the speed of rotation), then make the noise texture 1D, connect it to a subtract node and subtract all values by 0.5( makes the noise texture go from value 0-1 to value -0.5 to 0.5). The subtract node goes into a scale node( scales how random the rotation is) Then take the combine x y z from earlier and connect it with the scale in an add math node, plugging it into the rotation of the transform geometry node. What all this does is first, give the cube a tilt when it move in the air and tilts back to normal after, the with the noise texture section it adds some random rotation.
I went back to the snowman geometry node, and edited it, adding in a value and combine x y and z node to compact animating the arms and hat into single nodes, then I took everything but the value nodes and created a node group this way only the animatable sliders are visible. Then after the node group is created I renamed the y and z to Arm Rotation and Hat Height and now the value nodes are no longer needed and can instead be changed in one node.
Then I recreated the cube movement nodes except this time for the snowman, with some minor tweaks to how much it is affected by the noise texture etc.
After that I then set up the animation for the hat and arms to look better. The arms are animated using a noise texture for randomness, and the hat follows the sine wave so when the snowman jumps the hat jumps.
Final Animation for snowman. This is the end of the tutorial I watched by CGMatter for geometry nodes. So far I've learnt some basic nodes like set postion, transform geometry, math and vector maths etc. I've learnt how to use nodes to turn a cube into other primitive shapes like a sphere, cylinder and cone. Finally I used all the knowledge given to create this animated snowman.
I also figured out that you can set the cube with the geometry nodes applied as the rendered object in a hair particle system and it will keep everything to do with the geometry nodes.
Flowers:
So I finished the very basic geometry node so now I will be following the flower tutorial by Ryan King Art. In this tutorial I will be learning how to use geometry nodes with a curve and how to distribute objects on a mesh to create a basic flower model using geometry nodes. Later in the tutorial I will also learn how to procedurally generate flowers by drawing in the 3D viewport.
The first thing I needed to do was model a basic leaf model to be distributed on the stem.
After first section of geometry nodes.
This is the geometry node created in order to create the stem and distribute the leaf model on the stem and rotate it etc. To start I created a Bezier curve and changed the curve handles to look like a stem shape. Then I created a new geometry node network on the curve, the first node added was the curve to mesh node, this way we can give thickness to the curve using a curve circle as its Profile curve and reducing the resolution and radius (the circle curve became the thickness of the Bezier curve). Then I added an instance on points node and an object info node connected to the instance input, selecting the leaf as the instance object and now I had leaves distributed along where the curve should be. However, the number of leaves added was too much so I added a distribute points on faces node to reduce the density of leaves and in order to see both the stem and leaves I joined the curve to mesh and Instance on points node with join geometry. For the rotation I added a random value node (gives a random value between a range and connected it to the rotation, I also changed it from float to vector in order to change the specific axis separately. After, I then changed the distribute points on faces node from Random to Poisson disk this way the leaves can have a minimum distance between each other, and I also reduced the scale of the leaves. Finally, I learnt you can label the boxes for easier understanding of what each part does.
These Nodes are for the flower head(top) and flower petals (bottom). For the flower head, it is just a simple cone mesh into a subdivision surface and a shade smooth node (transform geometry is just to align with petals). The cones side and fill segments are increased to give a smoother look and the radius and depth are reduced to have a more accurate flower head size. For the petal distribution, the petals themselves are cylinders which again have increased segments, decreased depth and radius along with a transform geometry to scale it into the general shape of a petal. Then I added another subdivision surface and shade smooth node to (smooth the mesh). To make the petals align in a circular shape I added a mesh circle connected to an instance on points node and took the petal as the instance. Finally, to align the petals rotation I added two new nodes, Normal and Align Euler to Vector nodes. The normal node takes the normal value of the mesh(circle) And the align Euler to vector aligns the axis values to the vector (in this case the normal values) so the petals are rotated so that they point out from the normal values of the circles vertices. Finally I joined the petal and flower head together and also tweaked the values to look how I want.