Linus Tegelbratt shared the workflow behind the customizable fence generator, showed the nodes used in the project, and explained how the gate HDA functions.
Hello there! My name is Linus Tegelbratt and I’m from Sweden. I started my career as an intern at MachineGames, working on Wolfenstein Youngblood as an Environment Artist. Then I worked for Marmoset as a contract material artist, mainly focused on creating base materials for the Toolbag 4 library.
I used Substance 3D Designer every day for a few years, and I liked the procedural aspect of it. Also, I really enjoyed making useful nodes to speed up my workflow and make things easier.
It felt like the next natural step was to start learning Houdini and bring a similar procedural workflow to a larger scale. I like the problem-solving process when it comes to figuring out a certain solution to a problem.
To master Houdini’s tools and nodes, you need to watch a lot of tutorials, familiarize yourself with the program and all the nodes, then start making your own projects. Start with small projects in the beginning, then gradually try larger and more complicated projects as you get more comfortable in the program.
Personally, I felt that the VEX part of Houdini was the most daunting aspect of it all, so I tried to focus on that part once I felt I had the basics. I highly recommend getting familiar with the Wrangle nodes, as they are very versatile to use and probably one of the most used nodes in my projects.
One thing I like to do is sometimes try to recreate the functionality of a standard node by using VEX. For example, if you want to measure the distance of a curve that has 2 points, you could use the measurement node or check the distance between point 0 and 1 in VEX.
The Fence Generator
The main goal for me was to create a tool that’s easy to use, and I also wanted to see if I could have functional gates that could be spawned at specific tiles. I wanted it to be customizable in terms of the look. So I only wanted it to use geometry you feed into the tool and not generate any custom geometry. That way, I figured it would be easier for the user to make different types of fences or walls.
The tool is using a curve as input for the shape, then inputs for the 3D models to use, and a blueprint input if the user wants to have gates.
For my main curve, I use a Resample node on the input curve for an easy way to control the length of the segments. Also, the same curve is used to spawn the main poles of the fence.
For my secondary curve that will be used to spawn the planks in each segment, I take the main curve and a primitive wrangle to set the point normals outwards in each curve segment. Then I move those points based on the main pole width.
I then take a Resample again to control the number of planks that will be spawned on the curves.
Then I split up the curve into individual pieces with the Carve node so I can measure each piece. For measurement, I use a primitive wrangle to find the distance between each point on each primitive, the measured length is used for setting the scale in width for the planks so they don’t intersect each other.
Now I need to create the points in the middle of each line that will be used as a spawn point. For that I use a Subdivide node, then an Attribute Promote node to promote the length to the point class instead of the primitive class. Then I use a point wrangle to only keep the points added by the Subdivide node, those points in the middle. Essentially I’m checking if my subdivided curve has any points near those points from the non-subdivided curve, and then removing those.
One problem I faced with using existing models is that they can all be oriented differently, so I had to manually rotate each object in the beginning. So I made a small setup to have all imported models auto-orient based on length and width and then aligned to the floor.
Then all my imported geometry is scaled to fit within 1 unit in X, Y, and Z. That way the size of the geometry is determined by the scale value per point, which is set by using the point wrangle nodes.
Limits & Customization
One aspect is that the geometry could get a lot of stretching and the textures wouldn’t look that good if using geometry that doesn’t fit that great in the fence you’re making. Compared to if the geometry would've been generated in Houdini as well, then the UVs could scale to whatever size you set. So if you want to make a fence that has a height of 2 meters, then you probably need to have the input geometry to have similar dimensions if you want to avoid unnecessary stretching in your textures.
The gate HDA is more of a proof of concept, rather than a fine-tuned HDA for creating gates. It’s essentially a copy of the fence HDA with minor tweaks to create a gate. Ideally, you would want to flesh out that tool and have it more customizable. How it works right now is that you create a gate with the meshes you want, bake it to a static mesh, and put that mesh to a blueprint so you have the functionality that the gate will open and close when the player interacts with it. You assign the correct blueprint in the Fence tool and then it will spawn and scale it so it fits.
One of the main challenges was probably to get the bending outwards and random rotation working correctly as I wanted. It took some trial and error in the beginning when working with the orient attribute. Working with vectors and the math involved is a bit getting used to as well when working with Houdini compared to a lot of other 3D programs that I’ve used in the past. Making and organizing the systems for the tools can feel complicated at times, so having comments that describe the nodes and functions is always a good practice, keeping the graph nicely organized so it’s easy for yourself or another person to understand how it’s made.