Creating a Heightmap in the G.E.C.K.

Hardware Requirements: The heightmap editor is one of the most hardware-intensive components of the G.E.C.K. It is recommended that you have at least 2GB RAM installed on your system or you are likely to experience a lot of crashes. The G.E.C.K. may not even be able to complete certain operations with less memory. To free up as much memory as possible, close other applications while working on your heightmap if you don't need to have them open (like your browser while following this tutorial).

Theory

A heightmap is an image which stores information about the height of an object. Heightmaps can be used for a number of things (eg. bump maps) and are frequently in greyscale (a gradient going from black to white). In the case of the G.E.C.K., the heightmap determines the highs and lows of a world space's landscape. To make it easier to understand and manipulate the data in a heightmap, the G.E.C.K.'s heightmap editor represents the elevation data in color, allowing the map maker to set a number of color keys to represent the range of height they are working in. The easiest way to think of a heightmap is as a painting which uses color to represent height.

Do not confuse the heightmap with the landscape mesh, the actual 3d geometry of the landscape, which is a different thing entirely (although the two are obviously very closely related). Think of it this way: the real world, with its mountains and valleys, is represented in a video game by a landscape mesh. It is the actual 3d terrain that your avatar walks around on. The heightmap, on the other hand, is just an elevation map which represents the relative height of each point of land by using a color scale. In the real world, the heightmap (elevation map) always comes after the landscape mesh (real world geometry). In the virtual world you are creating in the G.E.C.K., it is the other way around: you create the heightmap first, then the G.E.C.K. does its best to try and make the landscape mesh match the heightmap. (And that's the beauty of virtual worlds.)

A lot of people seem to have difficulty grasping this concept and regularly blame the heightmap editor for creating errors in their landscape meshes. But the problem isn't really (entirely) with the editor: if, when painting the heightmap, you ask your landscape mesh to perform unreasonable changes in elevation, you will be creating errors in your heightmap that will then carry over to the landscape mesh. (These errors usually take the form of 'tears' in the landscape, or sudden drops in elevation where one cell has been detached from another and placed much lower in 3d space.)

A heightmap, because of its two-dimensional nature, simply cannot represent certain types of geometry. (Like overhanging cliffs or natural arches, though, of course, these kinds of objects can be represented by using static meshes.) That's because there is no way to represent two different levels of elevation for the same point on the landscape (like at the top of an overhanging cliff and on the ground beneath it) in a two-dimensional image. But heightmaps also have difficulty representing abrupt changes in elevation (like perfectly vertical cliff faces) even when the geometry does not overlap, and many of the errors that you run into when heightmapping arise from these sudden or abrupt changes in heightmap information. (These abrupt changes occur when two adjacent pixels in a heightmap are represented by colors that are widely separated on the color scale instead of by colors that flow in a natural gradient, and are frequently created by the improper use of certain heightmap tools.)

When painting your heightmap, then, pay attention to the flow of your color gradient. Smooth gradients tend to produce smooth, tear-free landscapes and harsh gradients tend to produce jagged, torn landscapes. Understanding how heightmaps work should help you produce good landscape meshes that do not suffer from a lot tears and dropped elevations. (That is not to say that the heightmap editor in the G.E.C.K. doesn't come with its share of problems (it does) but knowing what kinds of heightmap information cause errors and how to fix those errors can go a long way toward improving your experience using the editor.)

Importing Your Heightmap: I don't actually cover importing your heightmap in this tutorial (though I may add it at a later date) simply because it comes with its own set of problems that would require a good deal of additional work to write up and it isn't essential for creating a custom world space. It is a good idea to know how the built-in editor works in any case.
Fractal Terrain: I'm also not going to be covering fractal terrain in this tutorial. (Like the kind generated by Fractal World Explorer.) Personally, I prefer to create my own heightmaps because I find the end result to be a lot more playable and a lot less work. (Yes, you heard that right. Less work.) Again, I may add it later, but for now we'll just use the G.E.C.K.'s built-in editor.

Heightmap Editor Interface

Now that we have the theory out of the way, let's get down to some actual work. Open the heightmap editor by selecting it from the menu bar under World -> Heightmap Editing, or by clicking on the little globe icon on the main menu bar.
Globe icon

The heightmap editor is located under world, heightmap editing

Select your world space from the dialog window that pops up and click OK to open the editor. Depending on the size of the heightmap, it may take some time to load. (It will indicate its progress on the progress bar.)

Select your world space from the list that appears

When it's done loading, you should be looking at the much-maligned heightmap editor.

The heightmap editor

The heightmap editor essentially consists of three windows, two of which should open automatically. (We'll see how the other window works shortly.) The large window with the dark blue drawing area is where you will do all of your work. The smaller window (which is probably black right now) is the Overview window, which shows you a bird's eye view of your heightmap from a very high altitude. (This is used to move from one section of your heightmap to another, since the render window in the heightmap editor can only show you a limited number of cells at a time. We'll get into this more in a moment.)

Let's take a quick look at the heightmap window proper to get you oriented.

The heightmap window proper

The title bar at the top of the window shows you the current location of your brush cursor in cell coordinates, and the name of the cell if you have given it a name. The menu bar only has three options: File, View, and Edit, as most of the work you do is accomplished via the toolbar and tool box. A number of the options which are visible in the editor are no longer supported, but continue to exist as fossil relics of previous versions of the editor. I'll cover them briefly anyway so you're not wondering about them.

Menu Bar

The File menu contains the following options: Save, ReLoad, DeleteAllCells, Import, Export, GenerateLOD and Exit.

The file menu options

Saving your heightmap saves the image, or texture, currently loaded in the heightmap editor. Depending on the size of the heightmap, it may take a longer or shorter amount of time. (If you experience crashes when saving, make sure you save your plugin before starting work on your heightmap. This is the number one complaint with the heightmap editor and it is simple to fix, so don't post a thread in the forum about it!)

ReLoad allows you to load the last saved version of your heightmap, which is handy if you really screw something up and decide you want to go back to the previous version. This is the easiest method, in my opinion, for correcting large-scale problems with your heightmap. To get the most out of it, remember to save your heightmap regularly.

DeleteAllCells, which is new to the G.E.C.K., marks all of the cells in the current heightmap for deletion, but I haven't been able to get it to work properly without crashing on an .esp (plugin). When selecting it, it will prompt you to save an .esm file, which may indicate that it is only for use with master files, but this is merely speculation, and it isn't something I have had time to experiment with. (If you know how this function works, and have tested it yourself to verify that it is working, please feel free to send me an email detailing the steps involved so that I can update this tutorial.)

The Import and Export options allow you to import and export RAW images to use as heightmaps (allowing you to create and edit your heightmaps in image-editing applications that support the RAW format). I have not had the opportunity to test these options yet, so they will not be covered in this tutorial. For more information about importing and exporting RAW files, please see the Construction Set wiki.

The GenerateLOD option is no longer supported in the G.E.C.K., but in the previous version of the editor (the Construction Set for Oblivion) this was the option used to generate LOD land meshes. (The G.E.C.K. uses a heavily revised algorithm for generating landscape LOD which is located in World -> World LOD in the main menu bar.)

Exit, of course, closes the heightmap editor.

Warning! The heightmap editor will not prompt you to save your changes before exiting. If you have made any alterations to your heightmap, be sure to save it first before closing the editor.

The View menu's options are Show Overlay, Gridlines, Color Masking, Overview and Regenerate Overview.

The view menu options

The Show Overlay feature is no longer supported, and hasn't been since the Oblivion version of the editor (the Construction Set). In earlier versions of the editor, it was used to toggle on and off visibility for an overlay. Overlays are semi-transparent JPEG images that you place over your heightmap that contain information about the placement of roads, rivers, settlements, etc., so that the heightmap artist can transfer this information to the heightmap by painting over top of it. The transparency of the overlay was set by using the slider at the bottom of the tool box below the erosion settings. The loss of this feature doesn't really seem to be a big deal to me, since it is largely redundant: the same information could just as easily be created directly in the heightmap editor, or created in an external application that supports RAW files and imported directly without the need for further translation, making the use of an overlay unnecessary. (There is more information about overlays on the Construction Set wiki if you're curious.)

The Gridlines option allows you to turn on and off the cell grid display in the editor. When you display the gridlines, you can see the borders of the individual cells as you paint, which can help you stay organized and keep everything in perspective. I usually work with it on so I have a better idea how big each terrain feature is, but I sometimes find it distracting when I'm trying to create an interesting landscape. Leaving it on or off is really a matter of preference.

The Color Masking feature is a key component of designing good heightmaps, and a topic we will return to in depth in a few moments. In general, it allows you to set the colors used for representing different elevations and the amount of 'space' (elevation distance) between them.

The Overview is the small window that floats to the upper right of the main heightmap editor window. Think of the area currently loaded in the heightmap editor as a 'regional' map. This is the area that you're currently working on. The Overview window, in contrast, shows you a 'global' map which allows you to navigate between the regional maps. The Overview window shows you the last saved version of your heightmap editor, so if you have made any changes they won't show up here. The following option, Regenerate Overview, however, updates the image displayed in the Overview window with any of the changes you have made in the main heightmap editor window, bringing the two in line.

The Edit menu options are Undo, Copy and Invert Selection.

The edit menu options

The Undo option, which seems like an essential tool for any complex piece of software, doesn't quite work properly in my experience. It seems to undo changes made by certain tools, but not by others. Undoing changes made by the Raise or Lower tools, for example, seems to work fine, whereas changes made with the paintbrush tool don't seem to undo at all. Using undo on a change made by the noise brush seems to have only limited effect. I haven't really tested it thoroughly, since I don't find it reliable enough to use as a tool, so your experience may vary. I tend to just repaint things if they look off or reload the previous version of the heightmap if things get really out of hand.

The Copy option allows you to copy the raw pixels currently selected by any marquee or lasso selection you have made in the editor to memory and paste it somewhere else in the heightmap. This could be useful if, for example, you have spent a lot of time developing the heightmap in one area only to realize that it should really be located somewhere else, but I find that it tends to create as much work as it eliminates. When using this tool, it will copy the pixels exactly, so pasting the copied pixels to another area of the heightmap inevitably creates tears in the landscape mesh where the smooth color gradient has been broken. These tears have to be laboriously smoothed out, and have a tendency to reappear later when raising or lowering the land. If you decide you like using the tool, you can use the Ctrl+C shortcut to access it. Left-click to paste a selection, or right-click to escape (clear the saved pixels).

The Invert Selection option, in theory, allows you to select the inverse of the pixels currently selected with the marquee or lasso selection. (Or does it invert the color of the pixels selected?) I've never been able to get this tool to work, so I suspect it is no longer supported. Then again, I've never found a good use for it, either, so no big deal.

Toolbar

The heightmap editor toolbar

Some of the icons on the toolbar duplicate options in the menu bar, so refer to the notes above for additional info about these icons. The other ones will be explained here. Note that the brushes (from flatten to smudge) have shortcuts that use the A,S,D,F,G,H keys in order. From left to right, the icons are:

Flatten
This brush is used to flatten land, making the value of pixels within its radius the same as the pixel directly under its crosshair. This is good for quickly setting a base level to work from or for quickly erasing errors. Real terrain isn't perfectly flat, of course, so you will want to at least provide a bit of noise to break up the monotony of flat terrain. Shortcut: A
Raise
This brush is used to raise land, increasing the elevation of pixels within its radius. You can use it to lower land by pressing the right mouse button. Shortcut: S
Lower
This brush is used to lower land, decreasing the elevation of pixels within its radius. You can use it to raise land by pressing the right mouse button. Shortcut: D
Smooth
This brush is used to smooth land, averaging the elevation difference between pixels within its radius. This is good for getting rid of jagged peaks and 'pyramid' bumps but it is not that powerful. Use the smudge tool if you need something a little more powerful and don't need a lot of accuracy. Shortcut: F
Noise
This brush is used to add 'noise' to your heightmap, randomly raising and lowering the elevation values of pixels within its radius. This might seem like an odd brush at first, but it is sometimes necessary to give the landscape a more natural, less processed feel. Real landscapes are rarely smooth. The parameters for this brush are set in the noise tool interface in the tool box. Shortcut: G
Smudge
This brush is used to 'smear' colors in your heightmap. Like the smooth brush, it averages the elevation difference between pixels in its radius, but it is much more powerful and works much faster. The smooth brush seems to average the values between neighboring pixels, whereas the smudge brush seems to average the values betwen the highest and lowest pixels in its radius. Smooth and smudge work differently and are used to achieve different effects although the end results are sometimes similar. Good for quickly blending colors, but use carefully. Shortcut: H
Paint
This brush is used to paint the pixels within its radius the currently selected color, which shows up in the color swatch at the end of the toolbar. This works a bit like the flatten brush, but is more flexible. To select a new color for the paintbrush, use the eyedropper. Note that painted areas are very flat and require additional work (raise/lower, noise, etc.) to give them a realistic look in-game. Shortcut: B
Eyedropper
This tool allows you to select a color from your heightmap for use with the paintbrush. To select a color, position the crosshair over the pixel you would like to copy and left-click. The selected color shows up in the color swatch at the end of the toolbar.
Color swatch
Shows you the currently selected color. This is the color that will be painted to the heightmap when using the paintbrush. To change the color, use the eyedropper tool.

Tool Box

The tool box down the left side of the editor allows your to set parameters for the brushes, and also provides you with a couple of additional tools that are useful for making global changes to your heightmap.

More to come!

Back: Setting Up Your Worldspace Data

See also: G.E.C.K. Editor Warnings and Solutions

Last updated July 22, 2011

© 2009-2011 Dave Finch