TSE/Atlas/Create a Terrain/HTC
From TDN
Introduction
The HTC demo can be downloaded from here. Unzip this file into a separate folder (i.e. not your example directory). The zip contains a TSE.exe and all files required for a standalone executable. Full documentation can be found here.
Contents |
Basic Terrain Creation
Creating a new Terrain
Launch HTC. Select Editor --> "New Map" and you should see this screen which will help you to size your terrain.
Select your map size, ranging from 2x2 to 64x64. Then choose your hex size, either 256,512 or 1024 then click "Apply Button".
Now you will see your map properties (4). Map properties show you in the first line the heightField size in pixel, and in the second line, it shows you the terrain size in metres (torque unit). Now, select another pixel scale (3) then click "Apply" to see the impact of the pixel scale.
Examples : 4x4 Hex, Hex Size = 256, Pixel Scale = 2 => HeightField Size : 1024x1024; Terrain Size = 2048x2048m 4x4 Hex, Hex Size = 256, Pixel Scale = 4 => HeightField Size : 1024x1024; Terrain Size = 4096x4096m 8x8 Hex, Hex Size = 512, Pixel Scale = 2 => HeightField Size : 2048x2048; Terrain Size = 4096x4096m 64x64 Hex, Hex Size = 1024, Pixel Scale = 8 => HeightField Size : 65536x65536; Terrain Size = 524288x524288m
Playing with these figures will show you the impact of different parameters. Just click the "Apply" button to see changes.
When you have decided on a good map size, click "OK" and the Hexmap screen will appear.
Map Editor
Now you're at the Hexmap screen. On the left is the Hex Selector, above this is the currently selected Hex, in the centre is your map (filled with sea by default), and at the top are the "Set Starting point" and "Hex editor" options.
To fill your map, you just need to select a terrain type and click on the map to place it.
To understand how things work. In height amplitude, you need to know that each HexTile has a HeightField and a Texture. This HeightField and Textures can be updated in the HexEditor. HeightField manage Height amplitude and positioning, but also global "shape" of your terrain. Textures manage colors frequency and placement on the terrain. Click "Hex Editor" Button.
This screen is divided into two parts. The left side is the HeightField selector the right is the Texture Selector. The HexTile is showed just above the "OK" button. You can select the HeightField and textures for the current HexTile in the appropriate list. *Note that just above the heightField List is the Height Range.
About Height Range. Its very important you understand the following points.
- Height Range,and Height field shown, are calculated on a 1024x1024 heightField.
- If you place Hexes with huge different Height ranges, Slopes between these two Hexes will be important.
- Hex Size property, set during Terrain Creation, will influence the slope between two Hexes.
- With HexEditor you can select your HeightField and Texture properties. Changing Hex settings will change all Hex settings (of this hexTile) on the map.
Now click the "Set Starting point" button, click on the map where you want your player to appear, and your player will be positioned in the centre of that Hex. Close all windows to go back to the main menu and click Generate.
Generation
This screen is divided in four parts:
Save and Load Parameters
Set your parameters fileName and click "Saveparameters" or "Loadparameters". Parameters files contains all data needed to compute your map (HexMap, HexTiles, HeightFields, Textures,etc...). These files are saved to the "client/scripts" directory as .cs files.
Map and light properties
LightFactor : this factor allow you to ajust shadows. more this setting is big more the sun light will be high. (Try these values to see impact : 1; 0.5; 1.5; 2). HexSize : You can change your hexSize just before generation. Scale facture : You can also change ScaleFactor just before generation.
FileNames
Terrain file Name : This file name will be used to generate .raw, .jpg, .chu, .tqt and .mis files. Mission file Name : This file name will be used in .mis file to set the mission title.
Generate buttons
Generate RAW and JPEG This button will generate .raw and .jpg files. These files are stored in the "data/terrains" directory. There is no progress indicator so the only way to know the generation status is by viewing to ".raw" file size in the "data/terrains" directory. To have an idea of your final file size.
512x512 HeightField : 513x513x2 bytes = 514 KB 1024x1024 HeightField : 1025x1025x2 bytes = 2052 KB 2048x2048 HeightField : 2049x2049x2 bytes = 8200 KB 4096x4096 HeightField : 4097x4097x2 bytes = 32784 KB ad infinitum...
To generate CHU and TQT files set the Min depth for CHU generation (see Atlas Documentation). I used the following parameters.
HeightField : 512 and 1024 : Min depth : 1 HeightField : 2048 : Min depth : 4 HeightField : 4096 : Min depth : 5 HeightField : 8192 : Min depth : 7
Setting lower Min depth may crash CHU generation.
Generate Mission File : Click this button to generate Mission File.
You can now leave HTC and click "start mission" button to play with your map.
Samples
Some samples are provided with HTC demo : htc_Dark_Mountains htc_Golden_Mountains htc_RockyPass htc_twin_isle To view these samples : go to generate, type one of these names into FileName, click the "Load parameters" button. Complete the generation process. (You can also see the Hexmap before generating).
Basic Heightfield Properties
Height fields are used in HexMap to set HexTile's global shape. To build your dream terrain, you'll have to adjust the HeightFields. Go to Editor=>HeightField properties. Select "Plains 1" and set window to fullscreen.
Height fields properties overview
HeightField properties are divided in 5 rows. Each row represent one fractal. The 3 first colunms (Act, Method, Op) are used by Fractal generator to combine different fractals. Parameters H,Lac,octave,Offset,Gain will adjust one fractal. Parameters AC and AF are used to adjust HeightRange and global Z positionning. X and Y parameters are used to set Fractal Scale.
The following sections explains more about these parameters.
Your first HeightField
Select Plains 1. Click "clear" Button. Set on the first row Method to 1, Op to 0, AC to 0 and AF to 300. Click "Apply" Button. This HeightField should appear :
This HeightField will show you a 1024x1024 height field. Notice Height range (-173 to 201). You can now create a 2x2Hex, filling the four Hexes with plains (Green HexTile without drawing), and Generate it. play with it and return to HeightFieldProperties to find correspondance with your terrain and HeightField. Notice that your terrain (2x2 Hexes should be a 512x512 HeightField) so the right bottom map should correspond with centre of the previewed heightField.
Adjusting X and Y Scale
Let's talk about X and Y Scale. Each fractal has a size. Each fractals will have similar feature along the map. You can Now Change X and Y to 256 and click apply. let change it to 64x64. You can now see this parameters influence. Remember that if you go smoothly from black to white, you'll have a small slope on terrain.
Another tips : Set X to 256 and Y to 512 and see what happens, playing with different X and Y values can be useful for dunes for example.
Adjusting HeightRange
Set X and Y to 1024. You should have a height range from -173 to 201. OK This means that your terrain is going to be between -173 to 201 meter (in a 1024x1024 HeightMap). Now Set AC to 173. What's happened? Height Range is now 0 to 374. You have adjusted your heightfield Z position.
Now Set AC to 0 and AF to 100. Your Height Range is now from -57 to 67. You have adjusted your Height Amplitude. Setting AC to 57 will give you a Height Range from 0 to 124.
HeightField Methods
HTC can build Height Fields with 5 Methods. Actual method is Basic (fBm) fractals. Set Method to 5 and click Apply. You now have a small mountain. Playing with X,Y,AC,AF as explained above will allow you to adjust your global HeightField properties.
1 : Basic (fBm) Meth = 1; Lac=3; Octave=4; Offset = 0.5; AC=0;AF=300; X=256; Y=256
2 : MultiFractal Meth = 2; Lac=1; Octave=2; Offset = 0.5; AC=0;AF=300; X=256; Y=256
3 : Hetero MultiFractal Meth = 3; Lac=2; Octave=2; Offset = 0.5; AC=0;AF=300; X=256; Y=256
4 : Hybrid MultiFractal Meth = 4; Lac=3; Octave=4; Offset = 0.5; AC=0;AF=300; X=256; Y=256
5 : Ridged MultiFractal Meth = 5; Lac=8; Octave=2; Offset = 0.5; Gain=0.9; AC=0;AF=300; X=512; Y=512
So now you can make very different Terrains, but there are more parameters.
Adjusting Fractal parameters
Lacunarity (Lac), Octave, Offset and Gain will allow you to change the shape of your terrain.
Let's go with some sample : 1) Using Basic fBm Let's start with Lac : 1 - Octave : 2 Offset : 0.5 (AC = 0, AF = 100, X=256, Y=256) Now Let's Try Lac Modifications, try this successive values : 1,2,3,5,8,16,0.5,0.1
Octave : Octave values must be integer values >= 1 Now Set Lacunarity to 2, and after, Try the following values : 1,4,6,8,16 Note : Octave will increase drastically compute time.
Basic fBm allow you to udjust only Lac and Octave (That's why it's Basic)
2) Multi Fractals Multi fractals, are very similars to Basic fBm, but their is another parameter : Offset give ranges from -10 to 10 to see what Happens. Values from 0 to 1 gives the best results in my opinion (0.5, 0.2,0.9,1). Offset is Octave dependant (multiplicative). So if you give a negative offset it will be the same result as positive offset if octave is paire.
3) Hetero Multi fractals Hetero Fractals is similar to Multi Fractals. It will use Lac and octave (of course) and Offset, in additive maner. Like Multi fractals you can change Offset Values to see what happens.
4) Hybrid Multifractals Hybrid multi fractals are similar to Hetero. It uses Lacunarity, Octave and Offset. They interested to create terrains with High Slope. (Pics, canyons, etc...)
5) Ridged Multifractal Ooohhh, Ridged Multi fractals! They help you to build mountains.They use Lacunarity, Octave, Offset, and Gain. Lacunarity >0 to 10 or more : Increase ravines in mountain side Octave : To increase if you have a High lacunarity Offset, and gain will adjust slope and Z amplitude.
Additional Notes
To test your heightFields, create a simple 2x2 map, Fill it with your terrain, make sure you are on a 256 HexSize, Generate It. So with this parameters, you can see quickly How Your terrain is shaped.
Finding good parameters is long. Testing and re-testing is the reason way.
Advanced Heightfield Properties
Let's start with a small sample
Select a terrain type (Hills 2 for example), click clear button. Let's create in the first Line a Basic fBm.
Method = 1; Op = 0; H=0.5; Lac = 2; Octave = 2; Offset = 0.5; AC = 81; AF = 100; X =300;Y=300.
Click Apply. You will see a nice Hill HeightField.
So, And that's why HTC is powerful, we can now add a Second Fractal.
On the second Line put an Hybrid Multi fractal with these parameters.
Method = 4; Op = 0; H = 0.5; Lac=1; Octave=8;Offset = 0.4; AC = 300; AF = 300; X =64; Y = 64.
Click Act on the first row to deactivate the first Hill fractal, Click Act On the second Row to Activate the Hybrid Multifractal. You can now Click Apply to see what is the global shape of the Hybrid Multifractal.
Then, Activate the two fractals. (Both Act CheckBoxes activated). And See What Happens! Generate It and it should give you a result similar to this :
In game screenShot :
Now We Have added Two Fractals, We substract them. Set 1 in Op of the Hybrid MultiFractal. and see What Happens. Peaks are transformed in holes. Powerfull, ain't it?
Now Let's go with a full sample
Click Clear To reset fractals settings. Let's enter the following Ridged Fractal:
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 5; AF = 10; X =1024; Y = 1024
Click Apply, Notice the Height Range (0 to 1)
Now We Add a basic fBm:
Method = 1; Op = 0; H = 0.5; Lac=5; Octave=3;Offset = 0.9; AC = 5; AF = 5; X =5; Y = 5
Leave Only Basic fBm active, and see the result (Height range from 0 to 9) and the terrain seems to be filled with small peaks (from 0 to 9 metres high).
Now Check the 2 fractals and in the second row (Basic fBm) set op to 2 : Multiplication. Click Apply. What happens? The terrain is now filled with small rocks on where Ridged fractal is High. The less High Ridged is, The less High basics rocks are. We have now a Height range from 0 to 13
Now Add a third row with the same fractal as in the first row except bold values.
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024
We have adjusted our Height field to have a mountain with rocks. Note that rocks are not visible on the height map. To view them you'll need to bypass High height ranges fractals. Now the final touch.
Method = 5; Op = 0; H = 0.5; Lac=8; Octave=1;Offset = 0.2; Gain = 0.3; AC = 100; AF = 200; X =150; Y = 150
This fractal make small ravines in the overall terrain.
Addition and substraction
You can add and substract every fractals in your fractal scheme. for example, you can put a ridged fractal on the first line and switch Op from 0 to 1.
The following settings add a Ridged fractal. Method = 5; Op = 0; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024 The Following settings substract the same Ridged fractal. Method = 5; Op = 1; H = 0.5; Lac=8; Octave=4;Offset = 0.5; Gain = 0.9; AC = 1500; AF = 2200; X =1024; Y = 1024
Check and generate these fractals, to understand how it works.
Multiplication
I used multiplications to create small rocks, but multifractals (Multifractal, Hetero and Hybrid) can have some sparse effects along the terrain.
Example : Method = 1; Op = 0; H = 0.5; Lac=2; Octave=3 ;Offset = 0.5; Gain = 0.9; AC = 240; AF = 75; X =256; Y = 256 Method = 4; Op = 2; H = 0.5; Lac=1; Octave=12;Offset = 0.8; Gain = 0.9; AC = 2; AF = 2; X =256; Y = 256 Updating the example above like this Method = 5; Op = 0; H = 0.5; Lac=8; Octave=3 ;Offset = 0.5; Gain = 0.9; AC = 150; AF = 300; X =128; Y = 128 Method = 4; Op = 2; H = 0.5; Lac=1; Octave=12;Offset = 0.8; Gain = 0.9; AC = 2; AF = 2; X =256; Y = 256
The rule of 3
To build realistic terrain I use the rule of 3. One detail level for global shape, One detail for giving global shape a smoothless appearance, and One detail level for details.
In the full example, The first 2 fractals are for detail level. The third fractal is for global shape. And finaly smoothless fractal is the fourth. Detail fractals must have low height range, or represents some original shapes (peaks in the first example of this article)
Smoothless fractal must have a medium height range (from 25 % to 50% of master shape) And Finaly Global Shape fractal must be Highest height range (depending on terrain of course) For the overall terrain, choose your heightfield HeightRange in "layers". I used 3 layer above and under water level (Plains ~7-100m; hills : ~120m-350m; mountains : ~300m-750m). You can easily change these stuff.
Now what?
Well, now you have all the details to create your own HexTiles. You can create, test, and have fun with the heightField Editor.
Texturing
Texture Basics
Go to Texture properties. Select a texture and click "Clear" button. In the first row, enter "24 60 16" in RGB value. Set Bump to 0 and Click "Apply" button. In preview you will see a full green square.
Then set Bump to 0.5, set Co to 1 click "Apply" you will see the bumped texture. Next you can play with X and Y feature size to see how you can play with this stuff. Next, in the second row enter "142 104 41" set the following parameters : bump = 0.5 ; Co = 1; X = 100 ; Y=100. Then click apply.
Bump limits: don't exceed 0.5 in Bump, or you might have some troubles with colors. What's Co? Co is Coverage. More this number is great, more the current color appear on the texture. You can adjust this parameter to give more importance to a color. What's X and Y : X and Y are feature size of Bump fractal (Basic fBm). Ajusting them Allow you to create more or less great lighted or shadowed area. (From terragen Multiply Feature size by 10).
Color sets
Managing colors is difficult, but this table will help you to choose appropriate colors : RGB Values 20 - 40 : Dark rocks, Grass 40 - 70 : Medium colors 70 - 90 : Light rock, sand 190 - 210 : Ice / Snow
Examples : Grass : 24 40 16 Light Grass : 64 56 32 Dark Grass : 16 24 8 Rocks : 64 64 64 Dark Rocks : 32 32 32 Light Rocks : 80 80 80 Ad Infinitum...
Combining colors
A HexTile can combine up to 8 colors. But in most case, their is Two main colors. For example : Grass and Rocks. For each of these materials, you should take 2 or 3 colors. Each of this colors should be a dark, a medium or a light color. For example a Grass and rock HexTile could have all the colors of the previous section.
Altitude and slope
Altitude is the min and max altitude where this color is placed. Slope : Min and max slope where this color is placed. Slope is equal to the height amplitude between two points. So if you a point(x=0; z=10) and the next point (x=1; z=11) your slope is equal to 1. (x=0;z=10) => (x=0;z=12) slope = 2. Using Altitude and slope give realism to your terrain. If you use Altitude make sure feature sizes are not too high if you don't want to have some color cutting.
The rule of 2 and 3
2 Main colors By textures. 3 Colors (dark, medium and light) per Main colors. You have 2 free slots for other colors.
Final words on Texture
Creating textures is long. You can also be inspired by textures from terragen. I have made some samples available in HTC.
Known Bugs
- Starting position when generating Mission file don't match (Keep 0,0)
- Limit your HeightField Size to 4096 (Otherwise it may crash during play time)
- H Factor seems to have no effect in HeightField Properties
- Noise seems to have no effect in Texture properties
Time Issue
Generating RAW and JPG can take time depending on the terrain size you have chosen, but also the fractals used. Remember that increasing Octaves increases compute time. 2048x2048 : ~5 min 4096x4096 : ~10-15 min
Categories: TGEA | Atlas | HTC

























