Monday, 14 February 2011

How World Machine and I made up

A few years ago, I had a look at various free terrain generation software. World Machine caught my eye and seemed powerful but the graph-based interface made me puke as it seemed completely unintuitive. Instead, I turned to L3DT, whose Design Map feature was quite appealing (I even wrote an article about that).

But recently, I've decided to create a race track level in Unreal, for a project I'll be writing about later on this blog. However, I found out that L3DT's road making abilities are quite limited, so I looked for another solution. That's when I discovered World Machine's Layout Generator feature, and realized how this made the graph-based interface terrifyingly powerful.

Now, it's highly probable that the Layout Generator has been there for a long time, but I did not notice it at the time I was trying World Machine out.

I won't be making a complete tutorial here, but I'll outline the main concepts of the system.

Layouts can have two functions:
  • Adjusting a heightmap.
  • Defining a mask.
A layout is composed of one or more shapes (box, circle, polygon, line). For each of these shapes, you can define its altitude, the way it blends with existing terrain (falloff), and how far the blending reaches.

Layout Editor

Polygons and lines are vertex-based shapes and can be turned into bezier curves. Bezier lines are the ideal tool to create roads.

A road cutting through a hill. 

Falloff curve of the road pictured above
You can see in the picture above that the road has been painted in grey. This has been achieved by using the bezier curve that shapes the road as a mask that in turn is used to colourize the terrain.

By combining various layouts, it's extremely easy to create alpha maps, which will save you the trouble of painting the entire terrain by hand.

Using the layouts as masks lets you precisely define how you want to shape the terrain, as you can feed the masks into perlin noise or erosion generators. Once you understand that, the graph based interface suddenly becomes obvious and brilliant.

On the picture above, the Advanced Perlin generates basic terrain. On top of that I use a layout to create roads. On the resulting terrain I generate some erosion. However, as I don't want the roads to be eroded, I tell the Erosion node not to do so by specifying a mask, taken from the layout generator (I need to invert it as the mask from the generator will tell me where are the roads).

Another nice thing with the graph based interface is that World Machine will show you a preview of the output of a node (or the chain of nodes up to the selected one, to be more accurate). This makes iterations really easy, and we need to iterate a lot when playing with terrain.

To conclude, World Machine is my new favorite terrain generation software, and by far. It's not perfect (It's not easy to work on small and smooth terrain, I could have used a customizable grid and contour lines, etc.), but it does the job well, fast, and it's free!