Home Game Development Taking Blender to the Next Level

Taking Blender to the Next Level

By Ruan Lotter
books-svg-icon Book
eBook $63.99 $43.99
Print $79.99
Subscription $15.99 $10 p/m for three months
$10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
BUY NOW $10 p/m for first 3 months. $15.99 p/m after that. Cancel Anytime!
eBook $63.99 $43.99
Print $79.99
Subscription $15.99 $10 p/m for three months
What do you get with a Packt Subscription?
This book & 7000+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook + Subscription?
Download this book in EPUB and PDF formats, plus a monthly download credit
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with a Packt Subscription?
This book & 6500+ ebooks & video courses on 1000+ technologies
60+ curated reading lists for various learning paths
50+ new titles added every month on new and emerging tech
Early Access to eBooks as they are being written
Personalised content suggestions
Customised display settings for better reading experience
50+ new titles added every month on new and emerging tech
Playlists, Notes and Bookmarks to easily manage your learning
Mobile App with offline access
What do you get with eBook?
Download this book in EPUB and PDF formats
Access this title in our online reader
DRM FREE - Read whenever, wherever and however you want
Online reader with customised display settings for better reading experience
What do you get with video?
Download this video in MP4 format
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with video?
Stream this video
Access this title in our online reader
DRM FREE - Watch whenever, wherever and however you want
Online reader with customised display settings for better learning experience
What do you get with Audiobook?
Download a zip folder consisting of audio files (in MP3 Format) along with supplementary PDF
What do you get with Exam Trainer?
Flashcards, Mock exams, Exam Tips, Practice Questions
Access these resources with our interactive certification platform
Mobile compatible-Practice whenever, wherever, however you want
  1. Free Chapter
    Chapter 1: Using Geometry Nodes to Create Dynamic Scenes
About this book
If you're ready to start exploring the more advanced workflows and processes in Blender to create intricate 3D models, then Taking Blender to the Next Level is for you. This book focuses on a few different VFX-related workflows such as geometry nodes, organic modeling, 3D camera tracking, photogrammetry, sculpting, compositing, and physics simulations. You’ll learn how to use geometry nodes to create dynamic motion graphic scenes as well as perform 3D scanning of real-world objects using photogrammetry. You’ll also find out how to model, rig, and animate your own 3D characters from scratch. Next, you’ll progress to using simulations to break objects apart and then use cloth and hair simulations to add realism to your 3D creations. Finally, you’ll go over the final render settings and export your 3D animation masterpiece as a video. By the end of this Blender book, you’ll be able to model your own 3D characters, objects, and landscapes; rig, animate, and texture your characters; 3D track live-action footage; and composite your 3D characters into live-action scenes.
Publication date:
May 2022
Publisher
Packt
Pages
520
ISBN
9781803233567

 

Chapter 1: Using Geometry Nodes to Create Dynamic Scenes

Geometry Nodes is one of the latest additions to the ever-evolving world of Blender and is one extremely powerful tool. It allows you to create and change an object's geometry in more complex ways than regular modifiers, and it allows you to create complex scenes quickly and in non-destructive ways, meaning you can always go back and tweak some of the parameters, making it extremely dynamic and versatile. Welcome to the exciting world of Geometry Nodes!

One thing to note is that Geometry Nodes is still being developed extensively by the developers of Blender, which means that new nodes will be added, and more workflow options will be available to you, making it one of the most exciting new features to come to the Blender toolset.

In this chapter, you will learn how to use some of the most popular nodes, and you will get a feel of what you can do using Geometry Nodes. You will learn how to distribute objects on points, using Math nodes to calculate attributes such as the distance between objects, as well as how to modify certain attributes such as scale, position, and rotation. Additionally, you will learn how to randomize certain attributes, which is important when creating dynamic motion graphics scenes.

This chapter will give you a good, but basic, understanding of Geometry Nodes, and later in this book, we will make use of other methods that will build on this chapter.

In this chapter, we're going to cover the following main topics:

  • Introduction to Geometry Nodes in Blender
  • Creating and manipulating geometry using nodes
  • Using textures to control attributes
  • Animating with Math nodes

    Technical Requirements

    All the projects in this book have been created and built on Blender 2.93.x. The projects should work perfectly fine with Blender 3.x versions too. There may obviously be slight changes going forward as they develop Blender 3, but most of the changes they usually do are minor and should not break any workflows. However, the Geometry nodes chapters will work strictly on versions 2.93.x, since these nodes are updated with every version change. Version 2.93 has Long Term Support (LTS) till 2023 and you can download it from here. https://www.blender.org/download/lts/2-93/

    All the projects of this book have been uploaded on Github here: https://github.com/PacktPublishing/Taking-Blender-to-the-Next-Level

 

Introduction to Geometry Nodes in Blender

In this section, we will be looking at the Geometry Nodes workspace and how to apply the Geometry Nodes modifier to our base mesh. Additionally, we will take a quick look at the different nodes that are currently available in Blender. You will learn how to distribute an instance object across points on another object. Additionally, we will make use of some of the most used nodes such as the Point Instance node and the Subdivide node. You will also learn what attributes are and how you can use them to change the way your instance objects are displayed. Finally, we will use nodes to randomize different attributes of our instance objects such as the position, rotation, and scale.

The Geometry Nodes workspace

Geometry Nodes functions as a basic modifier, but it also has its own workspace and editor. If you look at the top of the Blender interface, you should see a tab called Geometry Nodes. Additionally, you can change any window in Blender to the Geometry Nodes workspace by clicking on the drop-down menu in the upper-left corner of the window and selecting Geometry Node Editor from the list of available workspaces. This means you always have control over how you work:

Figure 1.1 – The Geometry Node Editor

Figure 1.1 – The Geometry Node Editor

If you look at the workspace, you will see the 3D Viewport window in the upper-right corner, the Spreadsheet window in the upper-left corner, and the Geometry Nodes window at the bottom. Currently, there is a total of 63 nodes in Blender version 2.93.2, but this number will quickly grow in later versions of Blender:

Figure 1.2 – The Geometry Nodes workspace

Figure 1.2 – The Geometry Nodes workspace

One area that Blender has been lacking in for a while now is in the creation of MoGraph dynamically; Geometry Nodes changes that completely by turning Blender into a powerful MoGraph-making machine! The reason why Geometry Nodes is perfect for MoGraph is that you can quickly manipulate many objects at once and because of its non-destructive nature. Additionally, you can introduce textures to drive movement or even use other modifiers in conjunction with Geometry Nodes.

Another great use for Geometry Nodes is for scattering objects quickly and easily. In previous versions of Blender, we had to make use of a particle or hair system to scatter objects across geometry, and that only gave us a certain amount of control. However, with Geometry Nodes, we have complete control to customize our node tree exactly the way we want.

You can even expose some of the parameters and values directly in the Modifier panel, making it very easy to customize your Geometry Nodes creations or giving you the ability to build custom node setups to share with others.

Geometry Nodes

As mentioned earlier, there are currently 63 available nodes to use (including the Frame and Reroute nodes), as shown in the following screenshot. This number will likely increase with later versions:

Figure 1.3 – All of the Geometry Nodes currently available in Blender 2.93.2

Figure 1.3 – All of the Geometry Nodes currently available in Blender 2.93.2

If you have used the Compositing or Shading workspaces before, then you should be familiar with using nodes. However, don't fear if this is your first time using nodes. It can be very daunting at first, but we will look at the process step by step, and in no time, you will be able to create amazing and dynamic scenes using Geometry Nodes. In the next section, we will create our first, very basic node setup, and see it in action!

 

Creating and manipulating geometry using nodes

In this section, we will be creating our very first basic scene using Geometry Nodes. You will learn how to add the Geometry Nodes modifier to your base mesh and how to instance an object onto each vertex of your base mesh. We will look at some of the nodes that you can use to manipulate these instances such as Position, Scale, and Rotation. Additionally, you will learn how to randomize certain attributes, and we will also take a look at the different types of attributes and how they are used.

Let's begin by creating a new Blender project.

Creating the base mesh

Let's begin by creating our base mesh. For this example, we will be creating a plane object and applying the Geometry Nodes modifier to it. Then, we will use this plane object to distribute instances of another object across it:

  1. Click on File and select New | General.
  2. Delete everything in your scene by pressing A and then pressing X. Click on Delete to confirm. You now should have a blank new scene. Now feel free to save your project!
  3. Create a plane by pressing Shift + A and selecting Mesh | Plane.

Now, let's scale our plane.

  1. Select the plane, press S, then 10, and then Enter. This will scale your plane to a size of 10 m x 10 m. It's always good practice to select Apply your scale whenever you modify the scale of an object in Blender, especially if you will be adding any modifiers to that mesh.
  2. To do this, select the plane, press Ctrl + A, and then select Scale from the drop-down menu. This will apply the scale factor and reset the object's scale to 1:
Figure 1.4 – Applying the scale to your plane

Figure 1.4 – Applying the scale to your plane

  1. You can view the scale factor by selecting your plane and pressing the N shortcut to open the side menu. In the Item tab, underneath Transform, you will see the Scale factor, which should currently be X: 1.000/Y: 1.000/Z: 1.000:
Figure 1.5 – The scale of the plane set to 1/1/1

Figure 1.5 – The scale of the plane set to 1/1/1

Creating a new Geometry Nodes modifier

Now, let's open the Geometry Nodes workspace by clicking on the tab at the top of the Geometry Nodes interface. You will now see the Geometry Nodes workspace split into three main views: the 3D Viewport window (in the upper-right corner), the Spreadsheet window (in the upper-left corner), and the Geometry Node Editor window at the bottom. Perform the following steps:

  1. To create our first Geometry Nodes system, let's click on our plane to select it.
  2. Click on the NEW button at the top of the Geometry Node Editor:
Figure 1.6 – The Geometry Node Editor

Figure 1.6 – The Geometry Node Editor

Congratulations! You have created your first Geometry Nodes setup! You will see two nodes that have been added automatically: the Group Input node and the Group Output node.

It's important to note that your data will always flow from the Group Input node on the left-hand side to the Group Output node on the right-hand side. Everything between these two nodes will modify our geometry.

Creating our instance object

Before we start adding any nodes to our node setup, we need something to use as our instance object. So, let's create a mesh that we can use:

  1. With your mouse pointer over the 3D Viewport window (in the upper-right corner), press Shift + A and select Mesh | Icosphere.
  2. Select the Icosphere instance in the 3D Viewport window, press G, and then press X to move it along the X axis away from the plane.

In the next section, we will use this Icosphere node as an instance object.

Creating our first nodes

Let's begin adding some nodes! In this section, we will look at how you can add new nodes to the node tree and how to distribute your instance object across your base mesh:

  1. Click on the plane object in the 3D Viewport window to select it.

With your Icosphere instance out of the way and your plane selected, you should now see two nodes in the Geometry Node Editor. If you don't see any nodes, make sure that the Geometry Nodes modifier is selected or has been highlighted in the modifiers panel on the right-hand side:

Figure 1.7 – The Geometry Nodes modifier

Figure 1.7 – The Geometry Nodes modifier

  1. With your mouse pointer over the Geometry Node Editor window, press Shift + A to access the Node Add menu.
  2. Hover over the Point category and click on Point Instance to create your first node.
  3. Click anywhere to place your node.
  4. Now, let's drag our new node onto the line that connects the Group Input node and the Group Output node.
  5. Additionally, you can zoom in and out by scrolling the mouse wheel and pan by holding down the mouse wheel.
  6. Move your Point Instance node closer to the Group Output node as we will be adding new nodes, mainly between the Group Input node and the Point Instance node, in this example:
Figure 1.8 – Your node tree should now look like this

Figure 1.8 – Your node tree should now look like this

Nodes that change attributes should almost always be placed before the Point Instance node, as the points are not referenced after this node.

Specifying the instance object

Note that your plane object has disappeared in the 3D Viewport window! The reason for this is that we have not yet specified an instance object for our Point Instance node.

Let's do this now:

  1. Click on the Object drop-down menu on the Point Instance node to select the Icosphere mesh object that we created from the list earlier:
Figure 1.9 – The Point Instance node

Figure 1.9 – The Point Instance node

  1. You can also click on the eyedropper icon and select the Icosphere object that way.

Now, let's take a look at what has happened in the 3D Viewport window:

Figure 1.10 – Instances are placed on each vertex of the plane

Figure 1.10 – Instances are placed on each vertex of the plane

As you can see, we now have four Icosphere instances. Ignore the original Icosphere instance that we moved off to the side – you can even hide it if you want. The reason we see four Icosphere instances is that our plane has four vertices. It's creating an instance on each vertex. Let's increase the number of vertices by subdividing our plane. We can do this right inside the Geometry Node Editor as there is a Subdivide node that we can use.

The Subdivide node

The Subdivide node will increase the number of points or vertices on our base mesh. Let's examine how we can use it in our scene:

  1. Press Shift + A to access the Add menu, point to the Mesh category, and click on the Subdivide node.
  2. Move the node and place it on the line just right of the Group Input node:
Figure 1.11 – Your node tree should now look like this

Figure 1.11 – Your node tree should now look like this

Notice that you now have nine Icospheres in your scene. The reason for this is that our plane now has nine vertices because of the Level 1 Subdivide node.

  1. Change the subdivision Level value to 3. Now you should see a total of 81 Icospheres because we have increased the number of vertices on our plane to 81:
Figure 1.12 – Increasing the number of vertices will increase the number of instance objects

Figure 1.12 – Increasing the number of vertices will increase the number of instance objects

The Point Scale node

Now, let's change the scale of our Icospheres – there is a node for that, too! Let's add a Point Scale node:

  1. Press Shift + A and select Point | Point Scale.
  2. Slot it in right after our Subdivide node:
Figure 1.13 – Your node tree should now look like this

Figure 1.13 – Your node tree should now look like this

Additionally, you can search for nodes without needing to know where to find them. When you press Shift + A to bring up the nodes menu, click on the Search option at the top and type in the name of the node you are looking for.

Notice that on the Point Scale node, you have access to three different numbers: X, Y, and Z. This is called a vector as it's a set of three numbers. Change one of the numbers by clicking on it and dragging sideways. You will see how the scale of your Icospheres changes according to the axis you scale on. Let's change the Type setting from Vector to Float.

  1. Click on the drop-down menu next to Type and select Float from the list. Now you only have one number to change, which will scale your Icospheres uniformly.
  2. Click and drag the Factor value to adjust the size of the instance. For now, set it to any size you like.

We have now set the scale of our instance objects using the Point Scale node. In the next section, we will look at the different types of attributes available in Geometry Nodes.

Different types of attributes

Let's take a moment to look at the different types of attributes and data types that you will see:

  • Integer: An integer is a number that can be written without a fractional component.
  • Float: A float is a floating-point number, which means it is a number that has a decimal place.
  • Vector: A vector is a set of three float numbers and is mostly used to calculate a position in world space.
  • Boolean: A Boolean only has two values and can be used for something that's either true or false.
  • Attribute: This is a text field to input an attribute name.

The most commonly used attributes are Position, Scale, and Rotation (these are all vector-based as they consist of three numbers, which each correspond to the three axes of X, Y, and Z). However, there are also a few others that we will look at in later chapters.

The Point Rotate node

Let's look at how we can rotate our objects. To do this, we will need a new node called Point Rotate. Let's add it to our tree:

  1. Press Shift + A and select Point | Point Rotate (or you can use the search function).
  2. Add this node to the right-hand side of the Point Scale node:
Figure 1.14 – Your node tree should now look like this

Figure 1.14 – Your node tree should now look like this

You will see that the Point Rotate node uses a Vector data type because you can rotate using the different X, Y, and Z axes.

Click and drag the values next to the different axes to see how your Icospheres rotate in your scene. Please note that the difference between Object and Point is that Object will rotate every point in the local space of the object, while Point will rotate every point in its local space as specified by its Rotation attribute.

The Point Translate node

Next, let's take a look at how to change the position of our objects. For this, we need the Point Translate node. Let's add it now after our Point Rotate node:

  1. Press Shift + A and select Point | Point Translate or use the search function. Again, you will see that it uses a vector as we can translate in either X, Y, or Z.
  2. Drag the values next to X, Y, and Z to see all of your Icospheres moving along that axis:
Figure 1.15 – Your node tree now looks like this

Figure 1.15 – Your node tree now looks like this

The Attribute Randomize node

Our scene still looks very uniform and a bit boring; however, Geometry Nodes allows you to easily randomize your attributes! Let's see how we can randomize the Scale attribute of our Icospheres. For this, we will need a node called Attribute Randomize.

Let's add it now:

  1. Press Shift + A and select Attribute | Attribute Randomize to add the node.
  2. Place it on the right-hand side of the Point Translate node:
Figure 1.16 – The Attribute Randomize node

Figure 1.16 – The Attribute Randomize node

This node is slightly more complex, as we can choose which attribute it will randomize and how it will influence the current attribute values.

Let's examine how we can randomize the Scale attribute.

Randomizing the Scale attribute

We can use the Attribute Randomize node to randomize different attributes. Let's see how we can randomize the Scale attribute of our instance objects:

  1. Click on the empty box next to Attribute. You will see a list of available attributes that we can use.
  2. Select Scale from the list. Instantly, you will see that all of your Icospheres now have different sizes! Additionally, you can type in the attribute name in the empty box. However, note that the attribute names are case sensitive, so be aware of this when typing in an attribute name rather than selecting it from the drop-down list.
  3. The Min and Max float numbers determine the range of randomness. Change these numbers to see how they affect your scene. (Tip: Hold Shift while dragging these values to have more accurate control.)

The default data type value is set to Float, which means we use one number for all three axes, which will result in a uniform scale.

  1. Change this to Vector by clicking on the drop-down list at the top of the node and selecting Vector:
Figure 1.17 – The Attribute Randomize node

Figure 1.17 – The Attribute Randomize node

Now we have much more control over how our instances will be scaled. We can adjust the minimum and maximum values for all three X, Y, and Z axes.

  1. Adjust the three values under Min and Max to see how this affects your scene and how the scaling is no longer uniform by adjusting these values:
Figure 1.18 – The 3D Viewport window showing non-uniform scaling because of the vector

Figure 1.18 – The 3D Viewport window showing non-uniform scaling because of the vector

  1. This might be the desired effect you are going for, but let's change the data type back to Float so that we're scaling our instance uniformly.
  2. Set the Min value to 0 and the Max value to 1. Notice that some of the Icospheres are not being displayed or might be very tiny. This is because we're using the Replace/Create operator, which means we're choosing a value between 0 and 1 and replacing the current Scale attribute with this new number. Note this value can be 0, which will result in some Icospheres with a scale of 0, making them disappear.
  3. Change the operator setting from Replace/Create to Add.

Now we are adding our random value to the current Scale attribute, which will not result in Icospheres with a scale of 0. Other operators you can use are Multiply and Subtract, which work in a similar way to the Add operator.

Randomizing the Position attribute

Let's randomize the position of our Icospheres!

This time, we're going to duplicate our Attribute Randomize node and reuse it for the Position attribute:

  1. Click the current Attribute Randomize node to select it.
  2. Press Shift + D to create a duplicate copy.
  3. Drag the new copy to the right-hand side of the current Attribute Randomize node:
Figure 1.19 – The Attribute Randomize node

Figure 1.19 – The Attribute Randomize node

Let's configure the node as follows:

  1. Change the data type to Vector. The reason for this is that we want to randomize the X, Y, and Z positions for each instance.
  2. Set the Operator setting to Add.
  3. Select the position attribute from the Attribute drop-down box, or you can simply type position into the box. Please note that attribute names are case sensitive:
Figure 1.20 – Your node tree should now look like this

Figure 1.20 – Your node tree should now look like this

  1. Set your Min value to -10 and Max value to 10. This will randomize our Icospheres' positions from -10, -10, and -10 to 10, 10, and 10 in world space:
Figure 1.21 – The 3D Viewport window showing the randomized positions

Figure 1.21 – The 3D Viewport window showing the randomized positions

Randomizing the Rotation attribute

Let's randomize the rotation of our Icospheres. For this, we will again duplicate our Attribute Randomize node and place it on the right-hand side of the position Attribute Randomize node:

Figure 1.22 – The Attribute Randomize node

Figure 1.22 – The Attribute Randomize node

Let's configure this node as follows:

  1. Change the data type to Float. The reason we're using a float is that we want to use one value to rotate our instance in all axes. You can use a vector to have exact control over how we rotate. However, for this example, we're going to use a float.
  2. Change the Operator setting to Replace/Create.
  3. Change the Attribute setting to rotation:
Figure 1.23 – Your node tree and scene should now look like this

Figure 1.23 – Your node tree and scene should now look like this

  1. Set the Min value to 0 and the Max value to 10:
Figure 1.24 – The 3D Viewport window showing randomized rotations

Figure 1.24 – The 3D Viewport window showing randomized rotations

Changing the instance object

It's very easy to change your instance object into something else. Let's do that now.

Start by creating a new instance object in our scene. For this, we will be adding a Suzanne object:

  1. With your mouse pointer over the 3D Viewport window, press Shift + A and select Mesh | Monkey.
  2. Move the Suzanne mesh to the side of our scene by pressing G and then pressing X.
  3. Click on one of the Icospheres to view your Geometry Nodes.
  4. Click on the Point Instance node to select it.
  5. Click on the Icosphere item next to Object and select Suzanne from the drop-down list:
Figure 1.25 – The Point Instance node

Figure 1.25 – The Point Instance node

Now, let's take a look at what happened in the 3D Viewport window:

Figure 1.26 – Updated instances in the 3D Viewport window

Figure 1.26 – Updated instances in the 3D Viewport window

Muting nodes

You can also mute or deactivate certain nodes to see exactly what they do. This is good practice for troubleshooting your node tree. To do this, highlight the node or nodes you want to mute and press the M shortcut.

Now, let's mute our three Attribute Randomize nodes:

Figure 1.27 – Muting nodes by selecting them and pressing M

Figure 1.27 – Muting nodes by selecting them and pressing M

Observe how your scene will update instantly! You can unmute/reactivate these nodes again by selecting them all and pressing M again.

Congratulations! You have now created your first basic scene using Geometry Nodes. Please save your project now, as we will continue to work on it during the next section.

 

Using textures to control attributes

In this section, we will be using textures to manipulate attributes to create interesting and more complex scenes. You will learn how to use the Attribute Sample Texture node to change specific attributes using a texture map.

Let's begin by making some changes to the scene that we saved in the previous section:

  1. First, let's delete all three of our Attribute Randomize nodes. You can highlight them all at once and press X to delete them. However, remember to reconnect the line between the Point Translate node and the Point Instance node. Additionally, you can also use the Ctrl + X shortcut when deleting nodes while keeping the connection in place.
  2. Next, let's increase our level of subdivisions to 5 by adjusting the Level value on the Subdivide node. This will increase the number of instances we have in our scene.
  3. Also, decrease the Point Scale factor to 0.2 to decrease the size of our Suzanne instances:
Figure 1.28 – Your node tree and scene should now look like this

Figure 1.28 – Your node tree and scene should now look like this

Now, let's take a look at what happened in the 3D Viewport window:

Figure 1.29 – The 3D Viewport window showing the updated scene

Figure 1.29 – The 3D Viewport window showing the updated scene

The Attribute Sample Texture node

Now it's time to introduce a new node called the Attribute Sample Texture node. This node is used to sample a texture and apply the results to an attribute such as Rotation, Scale or Position:

  1. Add a new Attribute Sample Texture node to your node tree between the Point Translate node and the Point Instance node:
Figure 1.30 – The node tree

Figure 1.30 – The node tree

  1. Click on New on the Attribute Sample Texture node to create a blank texture.
  2. You can also name your texture here – let's call it MyTexture.
  3. Click on the Show texture in texture tab icon on this node to open the new texture in the texture side menu:
Figure 1.31 – The Attribute Sample Texture node

Figure 1.31 – The Attribute Sample Texture node

Your texture will now be displayed in the side menu:

Figure 1.32 – The texture side menu

Figure 1.32 – The texture side menu

  1. Let's change the texture type by clicking on the drop-down list that is currently showing Image or Movie. For now, change this to a Wood texture:
Figure 1.33 – The Wood texture

Figure 1.33 – The Wood texture

Nothing will happen yet as we still need to configure our new node. Let's do that next.

Back in the Geometry Node Editor, let's take a look at the Attribute Sample Texture node. It has two attribute slots that we can use. The Mapping attribute is used to determine where and how the texture is evaluated.

  1. Click on the empty box next to Mapping and select UVMap from the list of attributes.
  2. The Result setting can be any attribute we want to affect using the texture. So, let's choose scale. You can either select it from the drop-down list or type the word scale, in lowercase, and then press Enter:
Figure 1.34 – Your scene will now update and should appear like this

Figure 1.34 – Your scene will now update and should appear like this

Notice that our instance's scale has been updated and matches our wood texture. Where we have black pixels, the scale factor will be set to 0. And where we have white pixels, we will have a scale factor of 1. Feel free to experiment with other texture types to see how it affects your scene.

You can even load your own custom image texture by choosing Image or Movie as the Type setting and then clicking on Open to load your image:

Figure 1.35 – Loading a custom image texture

Figure 1.35 – Loading a custom image texture

Try loading a grayscale image to see how it affects the scale of your instances. The following example uses a grayscale image of the Blender logo:

Figure 1.36 – Here is an example of using a grayscale Blender logo

Figure 1.36 – Here is an example of using a grayscale Blender logo

For this example, I've moved the Point Scale node after the Attribute Sample Texture node and lowered the value to 0.4. The reason for placing the node here is that our Attribute Sample Texture node is changing our scale attribute. Therefore, any node before the Attribute Sample Texture node will not have any effect on the scale attribute. Remember that the data is flowing from left to right:

Figure 1.37 – This is what your node tree should look like to get this effect

Figure 1.37 – This is what your node tree should look like to get this effect

By now, you should have a basic understanding of what Geometry Nodes is and how it can be used to create amazing patterns or scenes.

In the next section, we will look at how to add keyframes and animation to our Geometry Nodes using basic math.

 

Animating with Math nodes

In this section, we look at how to create interesting animations using Math nodes and other objects in your scene. We will create a basic scaling animation by using the distance value between two objects in our scene and modify the scaling attribute using some easy math. So, let's get started!

For this section, you can start with a new Blender project:

  1. Delete all of the default objects by pressing A and then pressing X to confirm the deletion.
  2. Create a plane object by pressing Shift + A and selecting Mesh | Plane.
  3. Using the pop-up Add Plane dialog box in the lower-left corner of the 3D Viewport window, set the Size setting of the plane to 10 m. Click anywhere in the viewport to confirm these parameters:
Figure 1.38 – The Add Plane dialog box

Figure 1.38 – The Add Plane dialog box

  1. With the plane selected, click on the Geometry Nodes tab at the top of the interface.
  2. Click on the New button to create a new Geometry Nodes modifier on the plane. You should now see the Geometry Node Editor with two default nodes, Group Input and Group Output.
  3. Let's create our instance mesh. With your mouse pointer hovering over the 3D Viewport window, press Shift + A and select Mesh | Torus.
  4. Scale down the torus by 50% by pressing S and then pressing 0.5.
  5. Move the torus out of view by pressing G then pressing X. Move the mouse until it's away from our plane object.
  6. Most importantly, we need to apply the scale of this torus; otherwise, we might run into some interesting surprises later. With the torus selected, press Ctrl + A and click on Scale. Now, let's jump back into our node tree!
  7. Select the plane to enable the Geometry Nodes view. Remember, if you still can't see the nodes, ensure that the Geometry Nodes modifier is highlighted if you have other modifiers in this object.

Now, let's add our first nodes.

  1. For node number one, we will create a Subdivide node. Slot it in just after the Group Input node.
  2. Additionally, we need a Point Instance node to instance our mesh. Slot it right before the Group Output node.
  3. Set your Subdivide node Level to 3.
  4. Select your new Torus object from the drop-down list of the Point Instance node:
Figure 1.39 – Your node tree should now look like this

Figure 1.39 – Your node tree should now look like this

Note that you have lots of tori in your scene. Yup, I also didn't know that the plural of a torus is tori until now!

Now, let's create a new cube object in our scene that we will use to calculate some math later on:

  1. Hover over the 3D Viewport window, press Shift + A, and select Mesh | Cube.
  2. Move the cube to the edge of our torus instances by pressing G and then pressing X:
Figure 1.40 – Your scene should now look like this

Figure 1.40 – Your scene should now look like this

  1. Back in our node tree, click on one of the torus instances to view the node tree if it's not visible.
  2. Add a new node, called the Object Info node, by pressing Shift + A and selecting Input | Object Info or using the search function. We are not going to connect this node to our other nodes at this moment – just place it directly beneath the Subdivide node. We are going to use this node to calculate the distance between our tori and the cube object.
  3. On this Object Info node, click on the Object drop-down list and select the Cube object from the list. You can also use the eyedropper tool.
  4. Then, click on the Relative button. This will calculate the current information of the cube and not just the original data:
Figure 1.41 – The Object Info node

Figure 1.41 – The Object Info node

Great! You should now have enough instance objects in the scene. In the next section, we will use basic math to calculate the distance between the cube object and each of the instance objects.

The Attribute Vector Math node

Now, let's create our first Math node – the Attribute Vector Math node. There are a few Math nodes available, but for this specific example, we need to use the Attribute Vector Math node because of its Distance operator:

  1. Press Shift + A and select Attribute | Attribute Vector Math.
  2. Slot it in right after the Subdivide node:
Figure 1.42 – Your node tree should now look like this

Figure 1.42 – Your node tree should now look like this

Notice that the Object Info node is not yet connected.

Important Note

One thing to bear in mind is that any node that uses an attribute is calculating that attribute for each instance in every frame.

Now, let's take a moment to look at the Attribute Vector Math node and how we will use it. We want to calculate the distance between our Cube object and every Torus instance object. We already have the position value of each Torus instance saved in the position attribute, and with our Object Info node (connected to our cube object), we also have the relative position of the cube. Let's see how we can calculate the distance.

  1. First, let's change the operation of our Attribute Vector Math node from Add to Distance by clicking on the top drop-down menu on the node and selecting Distance from the many different operations available.
  2. Then, change B from Attribute to Vector. The reason we're using a vector here is that the cube's position will be a type of vector for each axis:
Figure 1.43 – Your node should now look like this

Figure 1.43 – Your node should now look like this

  1. For attribute A, we want to use our torus positions. To do this, click on the empty box next to A and select position from the list or enter the word position and press Enter.
  2. For attribute B, we want to use our cube's position, so let's connect our Object Info node's Location to the Attribute Vector Math node's B input.

Now we need to save the result of this operation to an attribute. Here, we can create our new attribute by entering a new attribute name that's not in use, but an easier option would be to simply overwrite the current scale attribute with our new result. Let's do that next.

  1. Click on the empty box next to Result and select scale from the list. If you don't see the scale attribute in the list, you can type in the word scale and press Enter:
Figure 1.44 – Your node tree should now look like this

Figure 1.44 – Your node tree should now look like this

  1. Looking at the 3D Viewport window, you will see that the scale of the instance objects has changed. Instances closer to the cube have a smaller scale, while instances further away from the cube have a bigger scale value. Please refer to the following screenshot:
Figure 1.45 – You will see something interesting happening in the 3D Viewport window

Figure 1.45 – You will see something interesting happening in the 3D Viewport window

As you can see in the 3D Viewport window, our scale factor is currently too big. We can use some more basic math to change that:

  1. Add a new Attribute Math node and slot it in after the Attribute Vector Math node. Note these are different nodes – one uses vectors and the other uses float data types.

We want to make our scale factor smaller, so let's use the divide operation to do this. We will perform a simple calculation to make our scale factor smaller:

scale / value = smaller scale

  1. Change the operation at the top of this node from Add to Divide. Leave A as Attribute, but let's change B to Float. This will give us access to change this value manually.
  2. For Attribute A, select scale from the drop-down menu, or you can enter it manually and press Enter to confirm.

For the Result setting, we can overwrite an existing attribute. In this example, let's overwrite the scale attribute. To do this, click on the empty box next to Result and select scale from the list. Again, you can enter this manually and press Enter to confirm.

Your tori will disappear from the 3D Viewport window because we are now dividing by 0, resulting in their new scale being 0.

  1. Let's change our B value by clicking and dragging the Float value to the right-hand side – find a number that gives you good results. I chose 10.

Let's examine our node tree:

Figure 1.46 – Your node tree should now look like this

Figure 1.46 – Your node tree should now look like this

First, we are subdividing our plane into three levels. Then, we calculate the distance between our cube object and every torus in our scene by using the Attribute Vector Math node. We then save this distance value into our existing scale attribute, overwriting the current value. Following this, we divide our new scale attribute by 10 (the float we entered manually), resulting in a smaller scale factor.

Now, let's move our cube around the scene to see the effect in action.

  1. Select your cube in the 3D Viewport window and press G. Then, press Shift + Z. This key combination will limit your cube's movement to the X and Y axes, excluding the Z axis. As you can see, you have created a cool-looking scaling animation. The closer the cube gets to a torus, the smaller the torus will become.
  2. Experiment by adding some position keyframes to your cube and see what you can create:
Figure 1.47 – Your first Geometry Nodes scene that animates dynamically

Figure 1.47 – Your first Geometry Nodes scene that animates dynamically

Using this method, you can easily create interesting and dynamic motion graphics scenes inside of Blender. Experiment with this technique and try to affect the rotation or position of your instance objects rather than their scale. Have fun creating interesting animations!

 

Summary

Congratulations! You should now have a basic understanding of how to create different Geometry Nodes and how to use them to change certain attributes to create dynamic effects. Now, let's use what we have learned to create something more interesting.

In the next chapter, we will create a motion graphics scene using all of the techniques we've learned so far. Additionally, we will look at how to apply materials to our instance objects!

About the Author
  • Ruan Lotter

    Ruan is a 3D Generalist and Visual Effects (VFX) Artist specializing in Motion Graphics, Compositing, 3D Tracking, and 3D Simulations. He currently works as a VFX artist and compositor in the advertising industry and also teaches multiple 3D and VFX-related classes online. He also created the YouTube channel, TunnelvizionTV where he shares tutorials on multiple creative topics.

    Browse publications by this author
Latest Reviews (1 reviews total)
Me parece fantástico que por la suscripción al sistema pueda uno adquirir a precios muy accesibles libros de diversos programas y grado de dificultad. Lamento no disponer del tiempo necesario para estudiar consistentemente los programas de cómputo que me interesan.
Taking Blender to the Next Level
Unlock this book and the full library FREE for 7 days
Start now