Wednesday 21 July 2010

Waun Ddu: Experiments in Terrain Texturing in CryEngine

One of the things that I have found a niggling problem in CryEngine (and for that matter in every game engine I have tried) is creating natural looking texture-mapped landscapes.  CryEngine offers a number of ways to achieve this, including painting textures directly onto the landscape, automatic mask generation based on elevation and slope and use of custom texture masks.  Using automatically generated masks one is restricted to simple slope or elevation classifications, based on the in-game terrain model (with its degraded resolution).  This is rarely wholly satisfactory, but at least better than the carpet-like effect of a single texture.

While it seems that texture variations based on products derived from the terrain model might be desirable, and represent real-world landscape change, as vegetation and landcover usually do vary in such a way, I'm keen to keep the original higher resolution terrain model as a base for these.  I've experimented with a variety of derived products from a GIS-based digital terrain model, in this instance based on 0.5m resolution airborne lidar data for the Medieval motte and Roman fortlet at Waun Ddu near to Llandovery in the Brecon Beacons.

DTM derived layers, hillshade, slope severity and solar radiation
Using ArcGIS I generated slope, hillshade and solar radiation maps of the terrain model.  These were used to create texture masks for CryEgnine (for a 512 x 512 terrain model Sandbox requires texture masks of 4096x4096 pixels in windows bitmap format).

The results are interesting.  Individual DTM derived texture masks produce more subtle terrain texturing than using Sandbox's built in tools.  The solar radiation mask (based on the amount of sunlight received at each location in the terrain model) is particularly useful for showing vegetation variations, which are often based on such factors.

Terrain variation based on solar radiation map
Terrain variation based on slope severity

The masks also work well together, with a plain base texture using slope to add rocky outcrops and solar radiation to vary vegetation

Combined base, slope severity and solar radiation texture mapping

This looks like a good way of adding naturalistic variations in terrain texture based on real topographic data and I shall be experimenting more with this in future.