Procedurally building a level with Houdini
Hi! In this post I will cover some client work on how I used Houdini to create levels for the Roblox Engine.
The task was to create a handful of islands that were different from each other, each island needed to have an arena in the center and a path around it where the player could walk to each building.
My idea was to use Houdini to generate a profile for each island and have the user go in and hand place the footpath and buildings using curves they can place down. Houdini really excels at this kind of workflow because I can get many iterations out and try lots of things quickly.
The island generation is mostly broken in a few steps.
The island's profile is generated by a curve
Buildings and paths are placed onto the island using a curves
Trees and rocks are placed based on masked off areas
Island profile generation
The island starts with a curve that defines the perimeter of the terrain. I also added some noise to raise the terrain to be uneven. giving the terrain some depth.
Buildings and Path placement
After the island base is made I then create new curves to control where the path and buildings will be placed. from here I raycast the curves to the levels surface and sample the curves to place the corresponding geometry, this way the path and building are perfectly in light with the terrain.
You might have noticed the squares underneath the buildings and there is a good reason for this. The buildings need to be placed flat on the ground and the area around them also needs to be flat so there are no awkward intersections, I achieved this by raycasting the area around the squares and morphing the terrain to the squares, you can see this below.
I am also flattening other areas such as the arena in the middle and the resting areas which are the smaller circles on the sides. The paths don't need flattening since I wanted them to follow the curvature of the terrain.
Trees and rocks generation and placement
Since I didn't want to make a bunch of trees and rocks to place, I generated them with Houdini instead.
The tree's I wanted to make were pretty simple, the base needed to fan out bit and I wanted to see some branches. Since this was to be used in the roblox engine I couldn't use any leaves so I decided to use the clumped mass approach for the tree tops.
It This was pretty much the same process for the rocks as well, I just proceduraly generated a bunch.
The only downside is that they are pretty
simple looking and some of the generated
rocks have really sharp edges, the way I
combated this is by cherry picking the rocks that I liked.
The next step is to actually place the rocks and trees onto the terrain. The problem here is to avoid placing the objects along the path or any key areas where they might look weird. This is actually pretty easy as we already have all the other components done so all we need to do is generate a mask where we want these object to be placed.
Since there are trees and rocks I placed the trees first and then added the trees to the mask so the rocks wouldn't be clipping into trees.
While my implementation is rudimentary it does get a pretty general spread of the objects. Ideally the I would be going in after the fact and do some cleanup with manual placement.
Below you can see the steps taken to generate the mask.
Ps. sorry the images are not from the same angle.
Bringing it all together
While it may look like its ready to export and cleanup in post, there is a lot of house keeping involved in making this usable. All the trees, rocks and buildings need to be separated into their own objects and materials for texturing and named accordingly, export groups need to be setup as well since this model was made in the Geometry level, after all that is done then I can export it and do some post, like cleaning up object locations and placing new objects.
Realistically this level generator tool is no where near complete and I'm currently not working on it anymore, I would of liked to add in foliage and smarter object placement with dynamic grouping but I don't think there will be a chance with this projects. I did however learn a metric ton about Houdini and procedural generation so it not all losses.
Thanks for Reading!
If you have any questions or comments leave them down below!