Procedural Landscape Generation for Game Environments

We’ve talked with Alexander Dracott about the new tools, which could offer some interesting alternatives to your standard World Machine workflow for environment design.

We’ve talked with Alexander Dracott about the new tools, which could offer some interesting alternatives to your standard World Machine workflow for environment design.

Using Houdini for Landscapes

The new heightfield tech in Houdini 16 is a new toolset that works on its own but still plays great with the rest of Houdini. The basic idea is you generate a 2d heighfield (at whatever size and resolution you want) then manipulate masks and layers of information (masks, height, splat maps) via various nodes. Some of them are common sense for terrain work such as adding noise, generating erosion. Others are more unique to Houdini and show were it’s strength lays (like converting geometry to masks and other fun things but more on that in a bit).

Once you have a heightfield and selection of masks you like you can take that data and export it out as various texture formats and use it in various engines, or different parts of Houdini. For my project I brought a height texture into Unreal Engine 4 for their landscape system, but also used much of the same data in a COP (image compositing) graph within Houdini to generate diffuse overlays and material splat maps which I also used in Unreal.

Houdini vs. World Machine

When it comes to working with Houdini I think there are some really neat things and advantages it has over World Machine. Besides the expected various noises and erosion, the speed and control that’s given you is really incredible. Besides simulating out a few frames of an erosion everything happens in your viewport for you to see which can be great for rapid early iteration.

There are also an incredibly strong set of other tools that come with the heightfield focused on manipulation. Simulating meteors landing? You can take that geometry and use it to generate quick and easy masks for further erosion or heightfield adjustment.  That, combined with patterns, hand drawing masks, scattering and distorting allow for what I like the most out of the toolset which is fast artistic control.  There are other tools, to be sure including some really fine control options like VOP and Wrangle nodes that work specifically with heightfield data for advanced users.

As for your question regarding the realistic look, reference was the key here! I have some relatives in South Africa and their photos were incredibly inspiring. I personally love PureRef for gathering, organizing, and storing tons of photos. Where Houdini comes in was the previously mentioned control. It didn’t take me very long at all to start matching the natural forms and shapes that I found in references of the Drakensberg mountain range. Once I had those forms, that same control allowed me to set up the composition and area I knew I wanted the piece to be focused on.

In the end, every software has its individual strengths. World Machine has been around for years and has the support of some incredibly strong plugins like Geo Glyph. Houdini is definitely a new player on that scene but a strong one and as I mentioned above to me, the true strength lies in the ease of terrain specific art direction. Control is the name of the game and it’s what let me constantly iterate and tweak and the speed that I wanted (and see those tweaks as fast as I was making them).

Applying Megascans 

Megascans ended up being incredibly useful for this project. I started with using them for a couple of the base textures for rocks, and foliage but wanting to keep that quality I opted to start using them on the ground, as well as some other photo-scanned (or near photo quality) textures from Substance Source.

In general I found it to be a matter of being aware of your use case. Tiling was a huge problem early on because I didn’t have enough materials on my base landscape. I also didn’t have enough natural height breakup with meshes, grass and the base heightmap of the terrain. After some iteration on the terrain I created more localized noise and after I started world building and placing more detail meshes that problem went away even further.

It’s also not worth underselling the use of Megascan Studio which is a simple to use but straightforward blending tool. I only grabbed a few 1-2 meter scans but with some blending and breakup I made most of my terrain textures at 4 meters to cover greater area without breaking up variation.

Size

The final landscape started incredibly large. I think probably around 8x8km but very quickly I shrunk it down to 2x2km preserve some resolution and to create a small area of focus (I could have easily switched to tiled heightfield sheets as well).   

The process once the texture was generated was more or less identical to any other terrain workflow. You have your splat maps, your Unreal landscape material and you can start the construction of the landscape off of an (ideally) 16-bit heightmap generated somewhere which is where I used mine from Houdini. I had very little trouble in setting everything up after figuring out the final size.

1 of 2

Manipulating the Landscape

The base heightfield was manipulated and generated in Houdini but after I exported it out, it because just a regular UE4 landscape with all of their traditional sculpting and texturing tools. I used splat maps that matched the heightfield to propagate my landscape materials but after those were applied even those are editable. If I had to, for example, make a small change to a 25 foot area near a large mesh, I could easily adjust the terrain in Unreal and repaint the material mask. This does however mean that if I re-exported and imported my original terrain height and splat maps it would not contain those edits so when you make said changes on the Unreal side really matters.

Vegetation

The vegetation is a mix of SpeedTree and hand modeling. For the large trees, I used Speedtree. I knew I needed high detail trees so I hand modeled some leaf cards which to me are one of the secrets to success with getting excellent trees. I was able to quickly generate a decent variety and quickly get them in game. Some tweaks to the default materials to use Unreal’s foliage lighting model came next to lock those in.

For the grass and bushes those were modeled by hand. I used Megascans’ foliage textures as bases and built out the individual meshes for the various grass types in Maya. The hardest part here is the shader. For the animation I created a relatively complicated vertex animation shader in Unreal and for the shading I tended to alternate between tangent space normals and world space normals to attempt to get the right style of lighting blend depending on what foliage I was making. For example. The bushes used tangent space normals lit with two sided lighting. The grass however was world space to get rid of some more darker shading that was appearing. It also allowed me to more easier blend the grass with the terrain near the LoD fade out distance.

One fun trick I did take advantage of was blending the base diffuse splat map of the terrain with the base color of the grass and some of the shrubs. This helped create more seamless transitions between where the grass stops and the terrain starts. It becomes especially important on the outer LoD bounds as the grass fades away creating a very natural transition.

Will this environment actually work for a game?

It absolutely would! In fact as part of the project I built an executable that runs the scene where you can fly around in ghost mode and check things out. From a performance standpoint, its a bit on the heavy side but not too bad at all. All the ground meshes are instanced and have Lods. The scene was built for production environments to be sure.  UE4’s scalability mixed with their draw distance tools for their foliage makes tweaking a few settings (like AA, foliage distance, shadows) super easy. Dropping that to around 85% of the quality in some of the images easily puts my fps over 60 easily at 1080p on a decent but not completely maxed out rig.

1 of 2

I also used a few other tricks to get the scene optimized correctly.  The distant mountains and other hills after that initial 2x2km patch were actually also generated in Houdini. I was able to take my original working file with the visual style that I liked and generate distant terrain variations, then convert them to geometry, export high and low resolution versions and bake appropriate normal maps. Then I placed those in the scene at various distances to build out the space. I even generated detail normals for them out of another Houdini file and use that to give them extra detail.

Lighting

Lighting was a fun challenge! I actually lit the entire scene with just a skylight and a directional light. I think the final shot was set up to be dynamic lighting only (no baked lighting) because I was tempted at one point to create a dynamic time of day cycle but later passed on it.  The use of distance field AO and SSAO really helped sell the subtleties of some of the shapes in the rocks which helped sell the scene as believable.

The size of the scene did cause some problems with shadows. Since I lit the scene dynamically I had only so many shadow cascades to use. I ended up using UE4’s distance shadow cascade option which is built for this kind of situation. All the distant terrain used those shadows since the fidelity needed there was not that high.

Advantages of going with Houdini 

I think the advantage is clearly artistic control of your terrain. Being able to influence your terrain slightly based on geometry or to hand paint masks to perfectly preserve a tiny detail your art director wants saved can be a really important aspect in production. It’s what let me capture the details I want fast, then manipulate them to get good final results, all while previewing it in Houdini’s viewport.

1 of 3
1 of 4

I think the workflow isn’t hard to pick up, even if you aren’t a Houdini user as some of the ideas do stem from other node based workflows (like World Machine). If you do spend some time though, the ability to mix the heightfields with other more technical features that Houdini supports (like Image compositing or simulations, for example) make it even more powerful, especially if your studio is already a Houdini friendly one.

Alexander Dracott, Realtime Lighting/Shader/VFX Artist

Interview conducted by Kirill Tokarev

Follow 80.lv on Facebook, Twitter and Instagram

Join discussion

Comments 0

    You might also like

    We need your consent

    We use cookies on this website to make your browsing experience better. By using the site you agree to our use of cookies.Learn more