Advanced Terrain Modding
From AgeofWiki
by Lord Zorinthrox
This article is intended to be used by modders who have already experimented heavily with the article Terrain Modding Basics. It describes some advanced techniques and effects reguarding terrain modding.
| Table of contents |
Description of the Environment
Understanding the Topographic Geometry
AOM TT topography is made up of hundreds of small, 3D triangles. Each one is defined by the three verteces at its corners. When you manipulate the height of the veteces, you change the elevation of the map. Each vertex is also assigned a terrain value, saying what texture file should be displayed there. Now, the triangles are set up in pairs, so that a grid of squares covers the entire map. The triangle pairs are all oriented the same way throughout the map. This is why, when you make extreme changes in the topography of a map, some corners of the elevation are square and some are nipped off.
Lighting
You should also be aware that the default sun inclination is to the right of the map (when you start up the game, with the northern corner pointing “up”)
"Why was that important?"
Good question. It can be important it two ways:
- Knowing where the light will usually be coming from when the terrain is in-game will allow you to place lighting highlights on your maps so they work with the topography.
- Understanding geometry will allow you to create some interesting effects with tiles.
Lighting Effects
Explanation
Since you know generally how global lighting in-game will hit your texture, you can come up with some great effects. See diagram 1.
Terrainmodding01.png
This diagram shows two things. Right now, we will deal with the isometric grid at the top. This is a generalization of the map grid, with the triangles oriented as they are in-game. To the right, the sun is positioned, lighting the terrain.
Now, observe the second part, the square with diagonal at the lower left-hand corner. This square is linked to the grid with lines just as a terrain texture will map onto the topography of the map. Following that, it is easy to see that the lighting will come from the bottom right hand corner of a terrain texture.
Implementation
With this knowledge, you can create more believable textures. All you have to consider is what the topography of texture would be. Take cobblestone. Cobblestone is made up of a bunch of square-ish stones, all of which protrude from the road surface. Therefore, to help a cobblestone texture in-game look more real, you should put highlights on the lower and right hand sides of the stone protrusions. See diagram 2.
Terrainmodding02.png
This is a quickly thrown together texture (doesn’t tile). As you can see, the square-ish stones are highlighted on the bottom and right hand sides. Although this makes them look like divots, in-game, the lighting will make them “pop out.”
For High-end Users
This is hard to do in Microsoft Paint, but for the readers who are using or are planning to use a higher-end editor, you have an easier way out. Simply create a texture base that is solely the color of the terrain you want to create. Then, create a new layer (object for Corel) and paint over your original, painting black for where you want the deep crevasses and lighter to white in higher points. Export the object as a new document, and save it in a simple format. Use this file as a bumpmap (high-end programs should have a bumpmap function) on the original, and adjust the lighting to stem from the lower right hand corner.
Notes
The example used in this section (diagram 2), was created with heavily emphasized and exaggerated highlights. It is generally a bad idea to create a texture with that much 3D depth; if the lighting changes, the terrain will look silly. Make your highlights subtle, just enough to show that the terrain has dimension, and the shape they show should be abiguious enough so that the texture will not be affected when the lighting changes. For instance, if the lighting is changed to come from the opposite direction, the texture should look just as 3D and make as much sense as it did when the light was coming from the default direction.
Also, as a side note, AOMTT default terrains do not take this into consideration. For instance, citytiles are lit from the top of the file.
Geometric Effects
The bulk of this section will deal with tiles, as this technique is best used on tile terrains.
Remember that terrain geometry of the map’s topography, all the little triangles? Well, here is were it comes in handy. See diagram 3.
Terrainmodding03.png
Here is a section of the terrain grid. Each small square is labeled as measuring 32 pixels by 32 pixels. This means that if you made a 32 X 32 terrain, it would lie exactly inside one of those little squares (the submerged citytiles borders are like this).
If you follow the math, then it is easy to surmise that a 64 X 64 terrain would lay over four squares, a 128 X 128 would lay over 16, and a 256 X 256 over 64.
Using the Map Geometry to your Advantage
Okay, now we are going to use this. Basically, all that was about one thing: specialized terrains. That is, terrains that have a very specific purpose in-game. The best example of this is a crater. Imagine a 256 X 256 terrain that was just a crater. In the editor, just place the crater terrain so it does not tile, and take the elevation down in middle to create an instant (although permanent) crater. Also, a specialized texture can do wonders for tiles. You can create a perfectly aligned tile texture, and then create several small versions that have the same size tiles in pixels on them. In the editor, you can make a city paved in perfect tiling, then have a few spots where the tiles have jimmied loose or sunken. See diagram 4.
Terrainmodding04.png
Combine loose tiles with depressed craters, and you have a war torn city.
"Why?"
In the end, all those specialized textures can add to the depth of a map by increasing randomness. Instead of having one tile terrain that repeats the same defects over and over, you can have several terrains that are randomly dispersed.
Notes
If you combine specialized crater terrains with crumbling tile terrains, be sure to put the crater terrain higher on the blending order in blends.txt (which is lower on the blend order list in the file). Also, flag the crater to blend over other textures with a sandy blend, that way it will more realistically appear as the tiles are crumbling.
Also, for the scenario designers who might be thinking about using this idea, please remember that excessive use of this may increase file size, as scattered textures surely affect compression ratios.
Tiling
This is, of course, the hardest part of terrain modding. Microsoft Paint users are pretty inhibited, and high-end users still have some work to do.
Paint
For paint, you will have to create a file the size of the terrain you want to come up with. Fill it in with a color that has high contrast with the colors you intend to use and isn’t close to any colors you will use. This blocks off an area for you to follow while painting.
Then, resize the file to some fifty to sixty pixels more than the size you want. Select the square of color left over, and move it to the center. Paint your texture over the colored area, very carefully, and make sure you only bring you texture out to two adjacent edges (thus leaving a still colored band on the opposite two edges of the colored region).
When you have finished that, select and copy one of the edges you have painted over, making a good-size block. Paste it, and move it to the opposite edge, so that the copied edge lies right next to the un-painted edge. Now, carefully complete the un-painted edge, taking care to make it line-up with the copied edge. Repeat with other painted and un-painted edge.
High-end
High-end users have an easier time. The easiest way is to paint your texture in a file the size you want the terrain to be. Avoid 3D treatments at this stage. Then, use the effect Offset to shift the whole image so that the edges become the middle and the middle becomes the edges. Then, very carefully paint over the seams of the middle. Bumpmaps should be generated after painting over the seams, and when in their own file, made to tile. Don’t forget to re-offset them so that they line up to where you wanted ( if that is an issue).
