Linus Tegelbratt showed us the process of creating a playground generator in Houdini and explained how the option to spawn decals was set up.
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.
We have a playground near our home, where my daughter usually wants to play. It was from there that I got my idea for this project. I wanted to see if I could make something similar with a procedural system in Houdini.
I start with making a 3x3 grid:
The next step is to set some point attributes that will be used throughout the system. The middle point gets its own attribute, then the corners, and then the remaining points will be used as spawning points for new platforms. That way we have 3 different attributes on this grid. The normals of each point are set to point outwards as well.
Then I use a “For Each Number” loop with the setting “Feedback Each Iteration”. That way I can get the result from each iteration and use that in the loop.
So for each iteration of the loop, I blast away the not active spawn points, select 1 random point of those, move the selected point along its normal, and then merge each iteration.
Then I need to make sure to remove any unwanted spawn points to keep the platforms from clustering into a big mess.
First, I flatten everything so it also works for the multiple levels later on, then I move all of the spawn points along its normal with a distance of the half size of the starting grid. I check if any of the points have any overlapping points within a small distance, if they do, then I remove those from the spawn points. Then I reverse the transform and unflatten the geometry to the original position. This is also the same approach I use to make sure there are no slides intersecting with each other.
Here you can see how each iteration in the loop spawns a new platform with the green arrows representing a potential spawn point.
The next step was to add the system for having multiple levels, which is again handled by another point wrangle node. You can set the maximum of levels and the chance of the point will go up one level. I also add a floor attribute to the points so I can separate different levels later on.
That’s the base functionality when it comes to the shape, then there are a few more steps to set the walls and such, checking that the slides won’t intersect with each other, and so on.
I will use that base shape and points for creating the rest of the HDA. For instance, for creating my poles in the play frame.
The height for the poles will be set by what floor it’s supporting, which we will use the floor attribute to determine.
I will start with getting my points with an object merge, then removing everything except the points with the corner attribute and flatten all points to the ground. This will create multiple overlapping points, which may have different floor attribute values, so I need to set the largest floor attribute for all overlapping points. For that, I am using a point wrangle with the “nearpoints” function, which will add all overlapping points to an array and then loop through that array and set the largest value on all points in that array.
I’m setting the scale for each point, which will control the size of the poles when I’m using the “copy to points” node. I am multiplying my floor attribute with my pole height, which will ensure that the size of the poles will scale along when it goes up a level. Then after the “copy to points” I’m also applying the same scale to the UVs of the poles so it’s also based on the pole height and doesn’t stretch.
I am also utilizing curves for modifying the shapes for a lot of the parts so the user can shape it how they want. Which is also used with a point wrangle node. I am using this on a lot of things in the HDA to give the user more control, such as the shape of the walls, slides, handles, and more.
One of the last parts I did was to have the option to have some decals spawning, for that, I am creating some points, then setting the orient attribute so they are correctly oriented in Unreal Engine, and then an “unreal_instance” string attribute that points towards the decal you want to use. In this case, I am using a blueprint. For some places, like the walls, I am also setting the scale of the decals so they scale along the wall if the height or width changes.
One of the main challenges was to organize all the parameters for the user, there’s a lot of parameters to adjust in the HDA for every part. I tried to keep it simple but still have the option to change as much as possible, though I could probably take some more time and simplify the layout a bit.
Overall, it was a very fun project to do, and you could probably expand on it a lot more and add new parts to the system, break up the shape a bit more, and so on.