A small wooden fence model on an oak desk
| |

Blender Geometry Nodes for Game Assets

You will build one procedural fence in Geometry Nodes, tune it with two sliders, and turn it into a plain mesh that any game engine can import.

Geometry Nodes lets you describe how a model is built instead of modeling every piece by hand. For a solo developer, that matters most on boring, repeated props. A fence is a good first target. It has posts, rails, and a length that changes every time you place it.

Blender moves menus and renames nodes between releases. The node names below match the current Blender manual at the time of writing. If one is missing in your version, search the official manual for your exact release before you guess.

Set up an empty modifier

Start a new file. Add a plain mesh object, such as a cube, and name it Fence. The original geometry does not matter, because the node tree will replace it.

Open the Geometry Nodes workspace and create a new node group on the object. You get a Group Input and a Group Output. Delete the link between them. You will build everything from scratch.

Before you add nodes, decide on your size. Pick the post height and spacing that your game’s character needs, then stick to them. Do not copy numbers from a tutorial. Your scale rules come from your own project.

Draw the path with a Curve Line

Add a Curve Line node. In Points mode it draws a straight line from a start point to an end point. Set the start at the origin and the end along the X axis.

Now expose the length. Plug a value into the End position so the X component comes from the Group Input. A Combine XYZ node does this cleanly. Name the input Length. When you change Length in the modifier panel, the line grows or shrinks.

Place posts with Resample Curve and Instance on Points

A line has only two points. You need one point per post. Add a Resample Curve node after the Curve Line. Set its mode to Count, then expose Count as a second Group Input named Posts.

Add a Cube node for the post shape. Make it tall and thin. A cube is centered on its origin, so half of it would sink below the ground. Add a Transform Geometry node after the cube and move it up by half its height.

Add an Instance on Points node. Feed the resampled curve into Points and the raised cube into Instance. You should see a row of posts that spreads out evenly as you drag Length and Posts.

Build rails with Curve to Mesh

Rails run along the same path. Take the original Curve Line output again, before the resample. Add a Transform Geometry node to lift it to the height of the lower rail. Duplicate that pair and lift the second copy to the upper rail height.

Combine the two lifted lines with a Join Geometry node.

Now give them thickness. Add a Quadrilateral node in Rectangle mode, set a small width and height, and plug it into the Profile Curve input of a Curve to Mesh node. Feed the joined lines into the Curve input. Turn on Fill Caps so the rail ends are closed.

Drag Length again. The rails should stretch with the posts, and both should stay lined up.

Join, add a material, and test

Add a final Join Geometry node. Plug in the posts and the rails. Connect it to the Group Output.

Add a Set Material node before the output and assign one simple material. One material keeps the engine side easy. If you want painted posts and bare rails later, you can split them, but finish the plain version first.

Test the edge cases:

  • Set Posts to its lowest useful value. You want a post at each end.
  • Make Length very short. Check that posts do not overlap in a way that looks broken.
  • Make Length long. Check that the gaps still read as a fence at your game’s camera distance.

If a case looks wrong, clamp the input range in the node group’s interface settings instead of fixing it by hand every time.

Realize the instances

Game engines do not read Blender’s node tree. They read vertices, faces, normals, UVs, and materials. Your posts are still instances, so you need to turn them into real geometry.

Add a Realize Instances node just before the Group Output. The Blender manual describes it as turning instances into real geometry data. After this node, the posts are ordinary mesh parts, just like the rails.

Apply the modifier to get a real mesh

You now have two choices. Both leave the original node file safe if you work on a copy.

Option one: keep a master and bake copies. Save your node group in an asset file. For each fence you need, duplicate the object, set Length and Posts, then apply the modifier from the modifier’s dropdown menu. The object becomes a plain mesh. The node tree is gone from that copy, but the group still lives in your master file.

Option two: let the exporter evaluate it. Most exporters can apply modifiers during export. Check the export dialog for your format. This keeps your scene editable, but you must remember the setting on every export.

For a solo developer, option one is safer. A baked mesh behaves the same in every tool.

After applying, inspect the result:

  • Enter Edit Mode and look for stray loose geometry.
  • Merge vertices by distance if the rails and posts were meant to touch.
  • Recalculate normals so they point outward.
  • Apply scale and rotation so the engine receives clean transforms.

Fix UVs before export

Procedural geometry often comes out with UVs that are missing or stretched. A cube primitive usually has simple UVs, but the rails from Curve to Mesh may not suit your texture.

The fast fix for a stylized game is a small color atlas. Unwrap the baked mesh, scale islands down, and place them over the right color swatch. For a textured wood look, use a projection unwrap and check for stretching on the long rails.

If you want UVs generated inside the node tree, the manual covers UV-related nodes and options. Check what your version offers before building around it.

Export and check in the engine

Export as FBX or glTF, whichever your engine prefers. Include only the selected object. Then import it and check three things:

  1. The fence sits on the ground with its pivot where you expect.
  2. The size matches a reference object, like your player capsule.
  3. The material slot comes through, even if you rebuild the material in the engine.

If the size is off, fix it in Blender, apply scale again, and re-export. Do not patch it with a scale value in the engine. That habit causes trouble when you have dozens of props.

Make it a reusable tool

Once the fence works, mark the node group as an asset so you can drag it into any file. Add a few more inputs only if your game needs them, such as post thickness or a random height offset.

Resist the urge to add every option. A small group with three inputs that you trust is worth more than one with twenty inputs you forget.

What to do next

Build two more props the same way: a row of planks for a dock and a short stone wall. You will reuse most of this tree. The pattern is always the same. Draw a path, place parts on it, join, realize, apply, and export.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *