This is a tool made with Houdini to create Montreal type houses and is used as a digital asset in Unity using the Houdini Engine.
It has parameters to change the size of the house, the size of each modules (balconies, doors, windows, etc), their placements, the colors. The tool also allows to replace each module with external ones made in 3dsMax for example.
One of the main features is the procedural UVs of the body of the house and how they adapt to the size changes, and how the height of the modules adapt to the number of bricks on the house material.
All textures are made in Substance Designer, materials have custom shaders created in Shaderforge to allow vertex color tint on base color.
See the video presentation here : https://vimeo.com/245748556
My reference for the buildings was the houses in Montreal. They have a simple look yet many subtle variations that make a great base for proceduralism, it is easy to get lost in many variations and parameters while doing a procedural asset. Choosing a specific reference like this helps to keep a realistic procedural creation and avoid the mistake of going into too much variations cases as the rules are already defined.
MODULAR UV :
As the house is built by stacking one floor on top of each other, each one can be separated, which will make the unwrapping part a little easier.
I wanted each floor wall to match it’s height size to the 0-1 V space in the UVs (see image below). This way the texture will tile seamlessly between all the floors.
To achieve that, I used a for-each-loop to unwrap each primitive alone, this way I can have all my UV shells stacked on top of each other. Still It was not aligned to the top of my UV space (see image below). I needed to find a scale factor for my UVs to make them fit perfectly.
What I decided to do is isolate one wall UV shell, get the coordinates of it’s top point. If I divide 1 (which is the max value of the UVs V space) by the coordinate in V of this point, I get the scale factor needed to scale my UVs.
For example if the V coordinate of the top point of my UV shell is 0.7, the scale factor of the Uv would be 1/0,7=1,42xx.
Using this method everything is scaled correctly. It works even with the windows cut out of the shape since I select the highest point of a wall all the other geometry are not taken into account.
MATCHING MODULES HEIGHT TO BRICKS :
When making procedural UVs there was one thing I wanted to avoid is having a module that cut a brick in the middle :
In order to avoid this I created a line with the same height as one floor, and resampled it by the number of bricks on my texture. Since my texture comes from a Substance file, it is easy to match by hand the brick number of the substance slider to the line slider. On that line, each point is placed where there would be mortar between bricks. So the length between two points represent the height of a brick.
Then the modules have to be rescaled so they fit in between 2 bricks. This is easily done since I have that line that represents the bricks positions.
First I isolated one point on the line : this point will be used to get the maximum height for a door for example. Then I merge it with a point at 0,0,0 and I have a line that gives me the correct height for a door that will fit in between of the bricks. It works the same way for the windows, the doors and the balconies.
If my line for example is 10 meters long, and the isolated point is at 7 meters, this would mean my door would measure 70% of the total height of one wall.
I used a line to get the final height of a module because for the window modules I needed to have a top and bottom point selection.
Now that I have all the measurements I need, I only need to transfer it on my module. With the lattice node I can resize any mesh I input with an other bounding box. In my case I created a box with it’s height linked to the line length I created earlier. Then I made one slider in the parameter interface to control the width.
I did the exact same thing for the other doors, the windows and the balconies. They all have their own controllers that are separated. The placement worked with the same base : using the floor height and brick height to determine where the modules would be copied.
Here is how it looks in Unity:
REPLACING BOUNDING BOX BY REAL MODULES :
One of the features of the tools allows to use modules made by artists and use them instead of placeholder boxes. But it involve a little trick about materials. The materials informations are stored in the primitives attributes when you import a mesh in Houdini but in the Houdini Engine in Unity only the points Attributes are kept. You can give material ID in Houdini by creating attributes, but in this case I need to get attributes back from an GameObject in Unity into Houdini Engine. Since the Houdini Engine for Unity only keeps points attributes for now, so I decided to use vertex color to store the material information.
Here was my 3dsMax setup : I created a multi-material with all the material type I needed with one specific color per material.
Then I used one feature of 3dsMax that allows me to transfer the material diffuse color to vertex color (In the Utility pannel > More > Assign Vertex Color). In Houdini I first convert those informations into primitives attributes. The Material information needs to be stored in primitives to be used in Unity, then I use the primitive wrangle node to add attributes values that correspond to each colors. I also used a partition node to create a group with each different material, otherwise it won’t work correctly in Unity.
The object merge node is what allows an external mesh to be input in a digital asset in Unity. This node is linked to the parameter interface with an operator path.
THE STAIRS :
The stairs are mainly created in Houdini, the only part of the stairs that can be replaced in Unity with modules are the steps.
First I had to figure out the curve of the stairs, On top view a simple quarter of a circle wasn’t working that great, I had to combine 2 lines and a quarter of a circle to create a better shape.
To build the structure of the stairs I used a two peak node on the curve, one on each direction with half of the step size as a value (the line on the middle is the one to copy the steps), this way each line is perfectly aligned to the borders of the steps.
For the structure I combined the line I peaked earlier with a line created using the bottom point of the steps I copied. This way it fits perfectly to the steps size if changed. I used a polyextrude node following the line normals to give the thickness to the structure.
The same technique is used for both front and back stairs. The stairs also resample the number of steps according to the building height (see gif below).
Thank you for reading. If you have any questions regarding this project you can reach me at @lucielescuyer.