GRHMEdit - GeneRally Height Map Editor v2.02

(a)JMC, http://mlynki.wz.cz (Slovak Republic)
Last updated: 30.9.2013





What is GRHMEdit?

GRHMEdit is a height map editor. It is a tool for editing height maps and viewing track files for a game called GeneRally (Copyright (c) 2001-2003 Hannu Räbinä, Jukka Räbinä). The game includes a complete track editor, which works in 2D. It is a good editor, but it is quite difficult to create an accurate height map using the 2D view. This program is an attempt to make the task easier using editing in full 3D.

Over time the editor was extended with additional features, such as global track manipulation and object editing.

What's new?

See overview of versions.

Abbreviations

LMB
left mouse button
RMB
right mouse button
drag
move the mouse pointer (with mouse button(s) pressed down)
shift, ctrl, alt
keyboard keys used for alternate operations

Introduction

Start the program and create a new track. The left side of the main program window shows a top view of the current height map and right side is a 3D view of it. Height map can be edited in both the top view and the 3D view - whichever is more comfortable. Vertical splitter bar in the middle can be moved to adjust balance between top and 3D view window sizes (if you only see one view, look for a vertical bar on the far left or far right and drag it).

Controlling the view

Viewing

The hand tool (button 1 on the edit toolbar) is used to change view (position, zoom, angle) in either of the two views. Use the mouse and keyboard as follows:

LMB+drag
scroll the view horizontally and/or vertically
RMB+drag up/down
zoom in/out
LMB+RMB+drag
LMB+shift
rotate the view (not valid in top view when using any "classic" rendering)
mouse wheel
zoom in/out
ctrl
hold down ctrl to temporarily "escape" from any selected editing tool to the hand tool. This is useful for fast switching between editing and changing the view without having to go to the toolbar to change tool. In some cases, this escape is vital.

Visibility options

There is a 3d view toolbar, which toggles some visual options in 3D view. It looks like this:

  1. toggle visibility of land surface and land image (texture)
  2. toggle visibility of surface grid lines

These as well as additional visual options are available in menu->view->show/hide.

Center mark

A "center mark" is a small partially transparent white box in 3D view. It marks the place around which the 3D view is rotated.


It is useful to place the center mark at a position around which editing takes place, especially in hmap corners. The center mark may optionally be hidden, but it is functionally active at all times.
alt+LMB
in 3D view place center mark

Walk mode

Height map may be alternatively viewed from a first-person perspective by enabling walk mode. Walk mode toolbar looks like this:

  1. enable walk mode
  2. enable automatic vertical angle adjustment (look upwards when going uphill, downwards when going downhill)
  3. increase walking speed
  4. decrease walking speed

When in walk mode, camera position is controlled using the keyboard:

up/down
go forward/backward
left/right
turn left/right, may be used together with up/down
shift+up/down
look up/down
shift+left/right
walk sideways
Editing is possible also in walk mode.

Height map editing

Edit toolbar looks like this:


All editing tools can be applied using LMB or RMB in both the top view and 3D view. RMB usually performs the opposite action to LMB.
  1. hand tool
    use this to change view (see viewing)
  2. editing restrictions
    This button displays a small menu where you can
  3. marker for selecting mask area
    LMB = select area into mask
    RMB = remove area from mask
  4. basic editing tool for increasing or decreasing the ground
    LMB = heighten hmap
    RMB = lower hmap
  5. smoothing tool for smoothing or sharpening the ground
    LMB = smooth out hmap (flatten altitude differences)
    RMB = sharpen hmap (exaggerate altitude differences)
  6. levelling tool for flattening the ground
    LMB = set hmap height (chosen using RMB)
    RMB = 'pick' height from hmap
  7. pulling tool for increasing or decreasing the ground in a single location
    LMB+drag = pull the terrain height up or down
  8. gradient tool
    this is an advanced tool for creating smooth height transitions in hmap such as banking curves (more)
  9. tool size
    a click here to set size to numerical value entered in b
    b current tool size
    c slider for changing tool size
  10. tool strength
    a click here to set strength to numerical value entered in b
    b current tool strength
    c slider for changing tool strength
  11. undo last hmap edit
  12. redo last hmap edit
A tool is applied to a certain area size and is applied with a certain strength. These two parameters can be set on the edit toolbar using controls 9a-c for size and 10a-c for strength. These parameters as well as tool rotation angle (which can be set in pen shapes dialog) can also be changed using keyboard shortcuts:
Q,A
increase,decrease tool size
W,S
increase,decrease tool strength
E,D
rotate tool right,left
R,F
change tool aspect ratio

Pen shapes

For some editing tools GRHMEdit supports custom pen shapes. When you select any of these tools, a dialog will be displayed showing available pen shapes.

Select the shape you want to use and optionally modify its aspect ratio and/or rotation. As mentioned above, rotation can also be modified using shortcut keys.

To define your custom pen shape, create a grayscale bitmap (BMP,PCX or JPG format, I suggest BMP) and copy it to the 'tools' subdirectory within GRHMEdit folder. Use white color for areas where the tool should be strongest (corresponds to tool strength selected in the toolbar), gray for areas where it should be weaker and black for areas where the tool does not effect the landscape.

Note that tool size is taken into account - size of the image which defines tool shape does not have any effect on area the tool edits. However, for better quality, I recommend you use bigger image sizes (~60x60) if you want to use big tool sizes.

By default, GRHMEdit loads all pen images stored in the 'tools' subdirectory (in unspecified order). If you like, you can specify your own order or store image files in subfolders. To do this, create a file 'tools_list.cfg' in the 'tools' directory and type in filenames of images which you want to load. Use one filename per line and relative paths if you want to use subdirectories. Images in the selection dialog will appear in the same order in which they are listed in this file. You can temporarily comment out a file (or add any comment into the cfg file) by starting a line with two slashes like so:

  //file1.bmp   - commented out, won't load

Generating your own pen shapes

GRHMEdit now has a '-pen' command line argument which can be used to generate various circular-shaped pen bitmaps. Many of the default bitmaps supplied with GRHMEdit were generated using this method (see the tools\CreatePenBitmaps.bat file).

The command line argument has to be followed by multiple values:
GRHMEdit.exe -pen filename type startAngle endAngle rampInAngle rampOutAngle inRadius outRadius surfaceCurvature contrast
Meaning of most of the arguments is shown below (purple areas denote the cursor shape):

The red parameters are given directly as numbers in degrees or pixels as appropriate.

The green parameters are all either 0 (for minimum, i.e. black) or 1 (for maximum, i.e. white) and they are all embeded in the single number 'type'. Type is constructed by adding the codes for those parameters, which should be set to 1, where the codes are:


For example, to create a pen shape with a white center and fade outwards towards black, the inside color is white (+1), inside fade starts at white (+2), outside fade ends at black (+0) and outside is black (+0). There are no ramps (+0). Therefore type is 1+2=3.

Surface curvature is a floating point value, either 1.0 for linear fade or any other value >0 for a curved fade (values <1 give curvature one way and values >1 the other way).

Contrast should normally be set to 1.0, values <1 will result in gray cursor and values >1 will create fades "brighter than" white which get clipped to flat white. This can be used for creating a flat area in the pen center or on the outside of banking.

Advanced height map editing

You can access several advanced editing options from menu->edit landscape.

HMap height range is a tool for global height map modification. You can set the overall height of the hmap data and control the used height range (emphasize or flatten global height differences).

HMap shift is a tool for global height map shift. This tool is useful if you made wrong placement assumptions and need to move the whole track a little in some direction to make more room near some edge. You should be warned though, that all data including the AI line and objects wrap to the opposite edge when they are shifted out of track area. With AI line this may produce really wild results, so I recommend that you check the AI line in GR track editor if you use this tool.

Hmap gradient tool is a flexible tool for creating smooth gradients and slopes.

Object editing

Object edit toolbar looks like this:

  1. object visibility
    toggle all objects between shown, hidden or in 'ghost view' (semi-transparent)
  2. advanced object visibility
    here you can choose which objects should be visible when objects are displayed
    The button displays a menu showing object types together with how many objects of each type there are in the track. Object types which don't exist in the track are left out.
  3. object editing tool
    displays the tool dialog with all required editing modes & tools

Object editing tool

While object editing tool is active, objects can be

Most functions operate on selected objects (orange) and may require a reference object (red).

The 'menu->straighten along line' will snap object positions to a line passing through the reference object and a selected object furthest from the reference object.

File operations

NOTICE
Always save your work if you do not want to lose it. The editor does not ask you to save last changes.

I strongly suggest that you BACK UP any important files before making modifications and overwriting them.
Don't hold me responsible for losing your favorite tracks because of an error in the editor.
I tried to avoid errors, but I can not guarantee anything. You are on your own.

Main toolbar looks like this:

  1. Creates new height map. All previous data is lost if not saved!
  2. Open TRK file. All previous data is lost if not saved!
  3. Save TRK file. If a TRK file was open and then saved, track statistics are preserved.
  4. Open height map from a BMP file.
    If you already have a track open, you will have the option to import height map into the current track or start from scratch.
    If you choose to start from scratch, all previous data is lost if not saved!
  5. Save height map as BMP file. The file can be imported into the original track editor.
  6. Open land image from BMP file. Height map and objects are preserved, only land image is replaced.
  7. Set water level
    a click here to set level to numerical value entered in b
    b current water level
    c slider for changing water level
  8. Set world size
    a click here to set world size to numerical value entered in b
    b current world size
gray +/-
change water level
Some other track parameters such as author name and comment can be modified in "track information" dialog.

Program settings

Other view refresh when editing controls how often the other view is being redrawn while hmap editing takes place in one view. The "all the time" option is more user-friendly, but it is more processor-time expensive and will probably slow down editing.

Top view rendering lets you choose between 3 different top-view types. Classic views are not rotated. Fine-rotated raw view is rotated together with 3D view and is probably the most user-friendly choice, but it consumes more screen space.

Screenshots save dir is the directory where screen shots will be saved.

3D view bk col lets you select background color for 3D view.

Light src fixation selects whether light source comes from a direction which is fixed or moves with the hmap as it is rotated.

Objects

And finally...

Not all available functions are listed above. Feel free to experiment with the program (but make a copy of files for experiment purposes or back up important files!). Any suggestions, comments, bug reports, etc. are welcome: send me an e-mail or visit the GeneRally forum.

Have fun creating tracks and have fun playing GeneRally.

Mlynki