Have you ever noticed how in some video games, the terrains look really… stretched?  That’s a result of the way that the 2D terrain texture gets painted onto the 3D terrain mesh.  When you make a 3D model in a modeling program like Maya or Blender, you can “unwrap” the mesh, lay it flat, and line it up perfectly with the texture that you want drawn on it.  But with terrain, which is usually made inside the game editor, and is a lot bigger than the other meshes in the game, the technical artist isn’t able to align the texture with every polygon.  Instead, most game engines will just automatically project the texture onto the mesh in one direction.  You can see an example of that here:

HS_TerrainBad

Notice how stretched and deformed the tiling texture gets as the mesh becomes more vertical?  Himeko Sutori doesn’t do that; Himeko Sutori uses 3D texture projection, which you see below.  It has a little bit of a rough transition area, but these are just examples, and you won’t see that in the game.

HS_TerrainGood

For game engines that don’t do 3D texture projection automatically, you have to set it up manually.  In the material that you see here, there are actually a few things going on, including the texture-swap based on the slope of the terrain and making sure that the normals are all facing the right direction.  But the magic of 3D projection gets done along the top right of this material:

HS_TerrainMaterial

 

The whole process is a little more detailed than I have time for in a dev blog post, but basically I’m telling UDK to look at the angle of the terrain:  Is it mostly flat?  Is it more sharply sloped in the ZY plane or the ZX plane?  And based on that, paint the grass straight down from above, or paint dirt on from the sides.

Now, some of you who have some game design experience might be saying, “What a waste of time.  You should just load up World Machine and be done with it!”  Well, I thought about using World Machine, and if I only wanted to consider the time savings versus the cost of getting the software, then I would say it’s a good deal.  But in the end I made a decision on the art direction of Himeko Sutori, and decided to do things by hand.  I’ll probably still use World Machine to make mountains in the distance, but for the camera angles I’m going to use, and the maps the player will explore, I’m going to have to model the terrain by hand in UDK.