L3DT documentation Large 3D terrain generator

# Differences

This shows you the differences between two versions of the page.

l3dt:userguide:newmap:horizscale [2017/08/31 05:32] (current)
Line 1: Line 1:
+====== Choosing the right horizontal scale ======

+One of the most important factors to consider when making a new terrain map is what horizontal scale to use. If your horizontal scale is too large, your terrain map will look very bland and undetailed, but if your horizontal scale is too small, your map will cover only a tiny area. On this page, I hope to provide some useful guidance on how to choose the right horizontal scale.
+
+===== Horizontal scale and feature size =====
+
+The horizontal scale of your heightmap determines the detail level of the terrain geometry. Basically, the smallest feature you can represent in your terrain geometry must be larger than the horizontal scale. For example, if you choose a horizontal scale of 1m, your heightmap geometry cannot represent any feature smaller than 1m (such as, for instance, a pot-hole in the road.)
+
+As a general rule of thumb, I would recommend you use a horizontal scale about four times smaller than the dimensions of the smallest object you wish to represent in your terrain geometry.
+
+
+
+===== What about world size? =====
+
+Another factor to consider is what world size you want. If you choose a small horizontal scale, you will either have a very small world size (by this I mean square kilometres of area), or else have to make a very map (in terms of pixels) to produce a reasonable world size. For example:
+
+  * A 1024x1024 pixel heightmap with a horizontal scale of 10m/pixel covers an area of 10km<html>&times;</html>10km.
+  * The same 1024x1024 pixel heightmap with a more detailed horizontal scale of 0.5m/pixel would only cover an area of 0.5km x 0.5km.
+
+The terrain with 0.5m/pixel will be much more detailed, but covers a total area //400x smaller// than the 10m/pixel terrain. For the map with a horizontal scale of 0.5m to cover the same area as the 10m scaled map, it would need to be 20,480 x 20,480 pixels in size, which would make it ~400 times larger on disk.
+
+===== What about size on disk?! =====
+
+This brings me nicely to the problem of horizontal scale and disk size. If you choose a highly detailed horizontal scale, and want to cover a large geographic area, you will need a heightmap with a gigantic number of pixels. As an example of this, a correspondant (who shall remain nameless) wanted to make a map at FPS resolution (i.e. 0.5m horizontal scale), and wanted it to cover 350<html>&times;</html>350 //miles//. If you do the math, this means the heightmap would need to be approximately 1 million <html>&times;</html> 1 million pixels in size. Such a map would be larger than a terabyte on disk, and would not render in any currently available game engine.
+
+===== The balancing act =====
+
+The point of this discussion is to highlight the three-way battle between geometric detail, world size, and size on disk. Basically, you can choose __**any two**__ of the three options below:
+  - A map with highly detailed geometry.
+  - A map that covers a large area.
+  - A map that is small on disk and quick/easy to render in 3D.
+If you want all three options, you will need to invent new algorithms for terrain generation, representation, compression and display.
+
+===== So, how do I choose the right horizontal scale?! =====
+
+Different game genres require different levels of geometric detail. If you are making a first-person style of game, you will need highly detailed terrain geometry, because the camera will always be pretty close to the surface of the terrain. Conversely, a flight simulator can use much less detailed terrain geometry, because the camera will not spend much time close to the terrain.
+
+The table below gives a simplistic guide to what sort of horizontal scales are required for different genres.
+
+^ Game type ^ Horiz. scale (metres) ^
+| First person shooter/role-player |  0.2 - 2  |
+| Real-time strategy |  5 - 50  |
+| Flight simulator |  20 - 500  |
+
+Note that I've given a range of values for each genre above. This is where your choice comes in. If you want more detailed geometry, you can use a smaller horizontal scale. However, please be aware that this will decrease your map's geographic area.
+
+===== Comparison of scales =====
+
+For some pictorial relief to an otherwise wordy tutorial, I present below some images of terrain generated with a range of horizontal scales, ranging from 0.1m per pixel up to 100m per pixel. In each image I have included a reference object of an 'army man', who in each image stands about 2 metres tall, or around 6ft 7in for those who prefer to imperial units.
+
+Whist the map in each set of images is different, I have in each case used a 512x512 pixel heightfield with a 2048x2048 pixel texture. Aside from the difference in horizontal scale, the map generation parameters are otherwise identical for each of the four maps shown.
+
+==== 0.1m / pixel: extreme FPS territory ====
+
+The images below were rendered from a heightfield with a horizontal scale of 0.1m per pixel (about 4 inches per pixel). Note that the terrain mesh is extremely detailed relative to the size of the character. This is much finer than you would normally need for any game genre.
+
+| {{:l3dt:userguide:newmap:horizscale:100cm_tx.jpg?450}} | {{:l3dt:userguide:newmap:horizscale:100cm_wire.jpg?450}} |
+^  0.1m / pixel (textured)  ^  0.1m / pixel (wireframe)  ^
+
+Here, the 512x512 pixel heightfield covered an area of 51 x 51 metres (56 x 56 yards).
+
+==== 1m / pixel: typical FPS territory ====
+
+The images below were rendered from a heightfield with a horizontal scale of 1m per pixel (about 1 yard per pixel). Note that now the terrain detail now appears to be reasonable for a first-person perspective. Generally I would recommend for an FPS that the horizontal scale is between 0.2m and 2m.
+
+| {{:l3dt:userguide:newmap:horizscale:1m_tx.jpg?450}} | {{:l3dt:userguide:newmap:horizscale:1m_wire.jpg?450}} |
+^  1m / pixel (textured)  ^  1m / pixel (wireframe)  ^
+
+Here, the 512x512 pixel heightfield covered an area of 512 x 512 metres (560 x 560 yards).
+
+==== 10m / pixel: typical RTS territory ====
+
+The images below were rendered from a heightfield with a horizontal scale of 10m per pixel (11 yard per pixel). The army man now appears a little small relative to the terrain triangle size. This level of detail would not be sufficient for first-person games, but is probably just fine for real-time strategy games.
+
+| {{:l3dt:userguide:newmap:horizscale:10m_tx.jpg?450}} | {{:l3dt:userguide:newmap:horizscale:10m_wire.jpg?450}} |
+^  10m / pixel (textured)  ^  10m / pixel (wireframe)  ^
+
+Here, the 512x512 pixel heightfield covered an area of 5.12 x 5.12 kilometres (3.18 x 3.18 miles).
+
+
+==== 100m / pixel: flight simulators and not much else ====
+
+The images below were rendered from a heightfield with a horizontal scale of 100m per pixel (110 yards per pixel). Whist this map now covers quite a reasonable area (51.2 x 51.2 kilometres, or 31.8 x 31.8 miles), the army man is now only a tiny speck. This sort of horizontal scale is only suitable for flight-simulators or other games where you don't get too close to the ground.
+
+| {{:l3dt:userguide:newmap:horizscale:100m_tx.jpg?450}} | {{:l3dt:userguide:newmap:horizscale:100m_wire.jpg?450}} |
+^  100m / pixel (textured)  ^  100m / pixel (wireframe)  ^
+
+Here, the 512x512 pixel heightfield covered an area of 51.2 x 51.2 kilometres (31.8 x 31.8 miles).
+
+===== Questions or objections? =====
+