Procedural Game Asset creation with Geometry Nodes in Blender

In this article, you’ll learn about procedural asset creation in Blender using geometry nodes. In the process, you’ll create a treasure chest with a guardian protecting its treasure. By Ayush.

Leave a rating/review
Download materials
Save for later
Share

Modeling in Blender involves object-level transformations and component-level operations like extruding, insets, bevels and much more. However, reversing these actions if needed is very time-consuming. Hence, this modeling technique is also known as destructive modeling. In contrast, non-destructive modeling refers to adding changes to a base model in a well-defined manner so that reversing the changes becomes easy. This approach encourages experimentation and can create variations to the final model if needed. In this article, you’ll use non-destructive or procedural techniques to create a treasure chest asset.

Note: This tutorial assumes a basic knowledge of Blender and its UI.

Getting Started

Download the starter project by clicking the Download Materials link at the top or bottom of the tutorial.

The starter project is a basic blend file containing a few primitive meshes, curves and basic materials.

starter screen for blender project

Using Geometry Nodes

Blender uses geometry nodes to implement non-destructive modeling. The geometry nodes workspace in Blender can be accessed from the topbar.

getting to the geometry nodes workspace

It’s a pre-defined layout that has the usual 3D viewport, spreadsheet and the node graph.

Utilizing the Spreadsheet

The spreadsheet window displays the information related to the currently selected mesh. It can be opened by pressing the Editor Type button in one of your editor windows and selecting Spreadsheet. The information in this window includes mesh and curve data also referred to as attribute domain. The spreadsheet is therefore useful for debugging and optimization. Each attribute domain is a combination of properties — or attributes. For instance, the Vertex attribute domain has a list of coordinates where each coordinate is the position attribute and the row number is the index attribute.

the spreadsheet in blender

Using the Node Editor

The node graph provided contains all the tools needed to create a procedural asset. Select the body object and open the geometry nodes workspace.

the base node tree for the treasure chest project

The Node tree is the structure connecting blocks, or nodes. You can move each node independently, and the connection between them will react accordingly.

Note: This connection is also sometimes referred to as a noodle. Fun!

A node contains a title and a combination of left-aligned sockets (input) and right-aligned sockets (output). You can create noodles by dragging from the output socket of one node to the input socket of another node. This visually represents data flowing from one socket to another socket. You can delete noodles by dragging from a connected input socket or by “cutting” the noodle by performing a right-mouse-button drag across the noodle while holding the Control key. If a node doesn’t have any noodles from its output socket, then it doesn’t contribute to the render at all.

A basic node tree contains two commonly used and important nodes:

  • Group Output: Represents the final render of the geometry nodes system. All noodles present in a node tree must merge into this node to create a meaningful render.
  • Group Input: Represents the original geometry that will be manipulated non-destructively by a geometry node system. However, unlike the Group Output node, this node is not required in a node tree, as you’ll see later.

You can search and add other nodes from the node editor topbar.

add and search for nodes from the node editor topbar

Spend some time exploring all the nodes that Blender has to offer. Once you’re ready, continue to the next section to begin creating your treasure chest.

Modeling with Geometry Nodes

Now that you understand the basics of the geometry node editor, using and understanding the function of common nodes and the node tree as a whole to create a treasure chest will be easy.

Treasure chests commonly contain a body to house the treasure and a cover to protect the treasure. Since the object is made of multiple components, there will be a lot of nodes connected to each other. As geometry node systems grow, it’s a good practice to group related nodes into something called a node group to improve readability and reuseability. Clicking the top-right icon of a group expands it, and using the Exit Group option from the node context menu inside a group collapses it.

expanding and collapsing a nodegroup

Data Flow in Geometry Nodes

The chest body is usually a rectangular box shape with a cavity. Achieve the rectangular shape by scaling. Scaling and other transformations can be achieved using the Transform node.
Expand the body_nodes group and drag the Transform Geometry node labeled scale-y between Group Input and Group Output.

transform node added to elongate cube in the y-axis

3D view after performing step 1

Next, create the cavity by subtracting a similarly shaped but slightly smaller cube from the newly transformed cube. Boolean operations such as subtraction can be performed with the Mesh Boolean node. The Mesh 2 input of the Mesh Boolean node comes with an elongated socket. This shape is used to represent the fact that Mesh 2 can accept multiple noodles. It makes sense because a Boolean operation can have multiple operands. To get the cavity of an actual chest, you need a second cube to perform a Boolean difference operation.

In the body_nodes group make the following changes:

  1. Drop the Mesh Boolean node between the node labeled scale-y and Group Output.
  2. Connect the geometry output from the node labeled scale-y to the Mesh Boolean node’s Mesh 2 input. Then drop the Transform Geometry node labeled translate-z between them.

a rectangular box with cavity and the node system used to create it

3D view result of step 2

The cube will now have a cavity resembling the main body of a chest.

At this point, the node tree will have quite a few noodles running through its nodes — even branching out at one point. They represent the left to right data flow direction in a node tree. Hence, the data represented by the output socket is passed to the socket of node at the opposite end of a noodle. For instance, the geometry socket of the Transform node passes the mesh data to the geometry socket Mesh Boolean for the Boolean operation. Multiple noodles can also start from a single socket, meaning that the input sockets at the opposite end of these noodles will receive the same data.

Extruding the Chest Panels

Now that the chest body is complete, you’ll add side trims by extruding a selection of interior faces inwards. This selection is present in the project as the faces vertex-group.

a selection of interior faces for creating side trims

The Extrude Mesh node can be used to perform extrusions. Aside from the mandatory Mesh input, it also has a selection input to dictate what faces to extrude. This selection should be passed to the body_nodes group using the Group Input node. Group Input and Group Output have the ability to pass data to and from node systems. They act as a layer of encapsulation and make it easier to manipulate node systems. For this use case, the Group Input will require a second input socket. The process of creating this second input socket is to drag a noodle from any existing input socket from a node to the empty socket in the Group Input node.

Update the body_nodes group by dropping the Extrude Mesh between Mesh Boolean and the node labeled scale-y and connecting the selection input from Extrude Mesh to the empty output in the Group Input node.

Next, go up one level to the root node system and connect the new selection input in body_nodes group to the empty output socket in Group Input node.

using the vertex group as a selection, extruded the body faces inwards

Reset the selection input in the modifiers panel to take the faces group as the input. Use the Input Attribute Toggle button to do this.

3D view after performing step 3

Note: By now, you should see a brand-new socket shape and even a dotted noodle. You’ll explore this new representation further in the next section, but for now, it’s enough to understand that wherever there is a noodle, data is being passed.