BMP (bitmap) data format. TESAnnwyn - Working with a height map Add MAP files to Photo Converter

18.01.2017 18.01.2017

The third part of the lesson on creating your own map for ARMA 3. In this part we will look at how to create a map of a real area from Google Maps and what programs to use for this.

This method is very complex, it requires a lot of time and skills in working with graphic editors, but the result is worth it. Of course, in this lesson we will not teach you how to work with Photoshop, and the example given here is a map made in haste.

  • How to create your own map for ARMA 3. Part 3

Required Tools

You need to download several tools:

  • GIMP (https://www.gimp.org/) \\ You can use any graph. editor.
  • Google Earth Pro\\ It’s the PRO version, it’s free
  • L3DT Pro \\ It’s the PRO version, it’s paid, but we’ll tell you how to get it for free

L3DT Pro is a necessary thing for a map maker, in our case it is needed for a height map. To download something PRO version follow this link. On this page you can buy or get a trial PRO version of L3DT for 90 days (that's enough). To activate the trial version, click on register for a free 90-day trial.

We fill in all the fields and indicate a valid mailbox, activation keys and a download link will be sent there. When you first start the program, enter all the keys that were given to you.

Creating a real Height Map

The height map is one of the most important problems in this matter. If you do real map heights, be prepared to spend a lot of time.

In our case, you must first make a height map; later, when you make your chosen terrain, you will understand why. For the lesson in Google Maps, we chose Block Island (New Shoreham) which is located in the USA. Why the USA and not our native Russia? Unfortunately, Google Maps displays the USA and Europe more clearly.

Now you need to download the elevation map of this island:

  1. Follow the link Open Topography
  2. Find our island
  3. Click the Select A Region button
  4. Circle our island

Below, uncheck Generate hillshade images from DEMs and enter any mailbox. Next, press the SUMBIT button

Now we can download the height map in tag.gz format

All that remains is to make the “.bmp” format from “tag.gz”. L3DT Pro will help us with this, but first unpack tag.gz into tif. Even winrar will do, unpack the texture and run L3DT Pro.

In L3DT Pro go to File >> Import >> Heightfiled >> tif texture

The resulting height map is very small, to increase it in L3DT Pro go to: Operations >> Heightfiled >> Resize Heightfiled.

In the window that appears, set the size you need by Width. In our case we set Width: 8192 Height: 6168

The size is set, save the height map in bmp format. To do this, in L3DT Pro, click on the texture Right click mouse and select Export. In the Exporta window, select the BMP format and the path with the name.

We create a high-quality SAT for the island

To create a high quality SAT we will need Google Earth Pro. The method that will be described in the lesson will allow you to create a high quality texture, but you can make the quality even higher or lower.

Our satka will be 8192 x 8192 in size, weighing about 200MB. Google Earth Pro allows you to take a picture in 4K quality with a size of 4800 x 2757. Therefore, you need to take 6 pictures and divide the island into 6 parts. Then these 6 parts will come together into one heavy texture.

We launch the Google Earth Pro program and find our island in it. We divide the island into 6 conventional parts: 2 horizontally and 3 vertically 2757

We take a photo for each part. To do this, we zoom in to an approximate piece of part of our island and take a picture. In Google Earth Pro, click the “Save Image” button, uncheck all the options, set the resolution to Maximum and save the image in “.jpg” format.

We do the same with the rest of the island. The result should be an island of 6 images. For example, in Paint we carefully merge our island. As a result, we set the texture size to 8192 x 8192 and save it in BMP format.

In this difficult way, our satka is ready!

Making a Mask for the Island

For the creation in our lesson we will use GIMP. As a result, your mask will differ from the example, but you will understand the essence of its creation. It is also divided into more or less detailed masks and depends on your scope of the project. Our mask will only have a few colors.

We throw our ready-made Satka and mapLegend.png into GIMP 2 times

Go to COLOR >> Posterization. We change the value - the higher the value, the more colors and the more accurate the mask will be.

Set the value for serialization, for example 4. Now you can replace or remove colors with the necessary ones, for example through mapLegend. To do this, in the “Selection” >> “By Color” section, select the necessary colors and fill in the necessary ones.

I hope you understand the point. Export the result to BMP format.

Creating a map in Terrain Builder

*About the height map. For example, you need to adjust the height map to the satka in the same GIMP. Unfortunately, we cannot describe this process; for this you will have to learn a little how to work in a graphics editor.

Let's say that your SATKA, ELEVATION MAP and MASK are ready, let's create a map using them in Terrain Builder! You can also download our example [Ya.DISK]

How to create a map in Terrain Builder is described in e. The parameters for the map will be described here.

Texture options:

In today's lesson we will look at the first file format on our path. Different file formats are designed to store different information. Each format specifies a way to organize data in a file.

We will get to know many different file formats: images, 3D models, audio files, video files. Let's start with one of the simplest graphic formats - BMP.

BMP - bitmap - bitmap. The concept of "mapping" is taken from mathematics. In mathematics, a mapping is very close to the concept of a function. For simplicity, consider the word bitmap to be a picture (even though it is not).

BMP file information

Each bitmap file has a header of 14 bytes. Fields for this header:

2 bytes. BM string (on Windows).
4 bytes. File size in bytes.

2 bytes. Reserved field. Must be initialized to zero.
4 bytes. The address from which the image itself begins. Or in other words - an offset to the beginning of the image.

Let's create a 100x100 pixel image. Each pixel takes up 32 bits. The file header will look like this:

B.M.
14+40+100*100*4
0
0
14+40

Important note: these numbers are actually stored as a sequence of bytes. I hope this is clear. Here (and in the next example) I have arranged them in a column for ease of perception.

Let's deal with the second field. 14 - file header size. 40 is the size of the image title (more about it below), 100*100 is the number of pixels. And besides, since we agreed that each pixel will occupy 32 bits (4 bytes), we need to multiply the number of pixels by four.

Last field: The image itself begins immediately after the file header (14 bytes) and the image header (40 bytes).

BMP Image Information (Image Header)

There are several versions of BMP. You can determine the version by the size of the image title. We will use the Windows V3 version, which takes up 40 bytes. Other versions take 12, 64, 108, 124 bytes.

In WinAPI, the BITMAPINFOHEADER structure is used to store the bmp version of Windows V3.

Windows V3 header fields:

4 bytes. Header size. Always set to 40 bytes.
4 bytes. The width of the image in pixels.
4 bytes. The height of the image in pixels.
2 bytes. This field always contains one.
2 bytes. Color depth is the number of bits in a pixel.
4 bytes. Compression method.
4 bytes. Image size. The size of the image itself is indicated here - without taking into account the size of the headers.
4 bytes. Horizontal resolution in pixels per meter (the number of pixels in one meter).
4 bytes. Vertical resolution in pixels per meter (the number of pixels in one meter).
4 bytes. Number of colors in the palette.
4 bytes. The number of important colors in the palette.

Now let's see what the image title will look like in our case:

40
100
100
1
32
0
100*100*4
2795
2795
0
0

For the compression method, we chose 0 - no compression. Other values ​​are possible. Among the interesting ones: BI_JPEG (value - 4) - compression used in jpeg images and BI_PNG (value - 5) - compression used in png images.

We set the horizontal and vertical resolution to 2795. In most graphics editors, when creating an image, the resolution is set to 71 pixels per inch (ppi - pixel per inch)). So, 71ppi is 2795 pixels per meter. Resolution is used to give the image physical length (for output to a printer, for example).

After the headings there is a color palette. If it is not there, then the image immediately begins after the headings. We will not consider images with palettes for now.

BMP image data

An image is made up of pixels. The pixel format is determined by the color depth (see above). In our example we used 32 bits per pixel. 32-bit color usually consists of four channels: alpha (transparency), red, green, blue: ARGB (Alpha, Red, Green, Blue). Sometimes the alpha channel is not used, in which case the image can still occupy 32 bits, they just do not pay attention to the values ​​​​of one channel when calculating. In this case, the channel names are written as follows: XRGB.

Each channel occupies 8 bits (1 byte) and can take 256 values: from zero to 255 (0x00 to 0xff).

In bmp, the image is stored line by line from bottom to top, i.e. The bottom lines are written first, then the top ones. Make sure of this: load one of the images from the first exercise and save only half the lines of that image to another file.

At 32-bit color depth, channels in bmp are written as follows: BGRA. In this order: blue, green, red, alpha.

The size of the data line in the bmp image must be a multiple of four (in bytes). If this is not the case, then the string is padded with zeros. This happens if 1,2,4,8,16,24 bits per channel are used. For example, we have an image that is 3 pixels wide and we are using 16-bit color. Line width: 16*3 = 48 (6 bytes). But the length of the line must be a multiple of four, so two more bytes are added and the length of the line in this example will be eight bytes. Although the last two bytes of each line will not store useful information. It is necessary to take into account the condition that the line size is a multiple of four when working with non-32-bit images.

Now let's continue with our example and use the code to create an image. Each pixel will be initialized with a random color:

Std::ofstream os("temp.bmp", std::ios::binary); unsigned char signature = ("B", "M"); unsigned int fileSize = 14 + 40 + 100*100*4; unsigned int reserved = 0; unsigned int offset = 14 + 40; unsigned int headerSize = 40; unsigned int dimensions = ( 100, 100 ); unsigned short colorPlanes = 1; unsigned short bpp = 32; unsigned int compression = 0; unsigned int imgSize = 100*100*4; unsigned int resolution = ( 2795, 2795 ); unsigned int pltColors = 0; unsigned int impColors = 0; os.write(reinterpret_cast (signature), sizeof(signature)); os.write(reinterpret_cast (&fileSize), sizeof(fileSize)); os.write(reinterpret_cast (&reserved), sizeof(reserved)); os.write(reinterpret_cast (&offset), sizeof(offset)); os.write(reinterpret_cast (&headerSize), sizeof(headerSize)); os.write(reinterpret_cast (dimensions), sizeof(dimensions)); os.write(reinterpret_cast (&colorPlanes), sizeof(colorPlanes)); os.write(reinterpret_cast (&bpp), sizeof(bpp)); os.write(reinterpret_cast (&compression), sizeof(compression)); os.write(reinterpret_cast (&imgSize), sizeof(imgSize)); os.write(reinterpret_cast (resolution), sizeof(resolution)); os.write(reinterpret_cast (&pltColors), sizeof(pltColors)); os.write(reinterpret_cast (&impColors), sizeof(impColors)); unsigned char x,r,g,b; for (int i=0; i< dimensions; ++i) { for (int j=0; j < dimensions; ++j) { x = 0; r = rand() % 256; g = rand() % 256; b = rand() % 256; os.write(reinterpret_cast(&b),sizeof(b)); os.write(reinterpret_cast (&g),sizeof(g)); os.write(reinterpret_cast (&r),sizeof(r)); os.write(reinterpret_cast (&x),sizeof(x)); ) ) os.close();

As a result of executing this code, a temp.bmp file will be created in the folder with your project (if you ran the program through the debugger (F5)) or in the Debug folder of the solution (if you ran the executable file.exe), which can be opened in any image viewer. The image consists of colored dots.

So, the Creation Kit came out, and despite the extra development time and promises from Bethesda, the editor turned out to be frankly unfinished.
A big omission among the entire list was the broken functionality for working with a height map, which crashes whenever you try to launch it.

Creating a height map.

What is a height map?
A height map is a raw 2D image that stores terrain data. Black areas on the elevation map are lowlands; accordingly, the whiter the area, the higher it is.
For example, height maps could look like this:

You can create a height map using Photoshop or using special programs such as TerraGen, GeoControl2 etc.

Let's look at an example of creating a height map:

  1. Let's launch Photoshop and create a new file of 1024x1024 size.
  1. Next, go to Image -> Mode -> check the box next to Grayscale.
  1. Next, make a layer of clouds: Filter (Filter)> Render (Render)> Clouds (Clouds).
You should end up with something like this:
  1. Ready! Now let's save the resulting map in Raw format with 8 bits.

Attention! The image must have a size of 1024x1024 and 8 bits in order to correctly display the height map in the game.

Let's correct the situation.

  1. After downloading and unpacking the archive, open the “01 MP GUI” folder and run the setup.exe installation file from there. When the installer asks you to install the settings in the game folder, agree.
Install templates in these game directories - the checkbox must be checked.
  1. Open the "02 Update tesannwyn" folder from the archive and copy its contents, replace all files in the Skyrim/Data/ini/mpgui directory.
  1. Place the contents of the "03 TESAnnwyn" folder in the Skyrim/Data folder, this will help the program immediately configure itself for Skyrim upon startup.
  1. Now go to Skyrim/Data/ini/mpgui and run the tesannwyn.

We immediately go to the last tab and see:

First field- selecting a height map file.
Second field- choosing a name for your world and a unique ID.
Third field- selection of two possible height map extensions - Raw format and bmp format.
Fourth field- selecting the size of the height map. For Raw format only.
Fifth field: Scaling- choice of height scaling per unit.
The default is one. I recommend setting the value to 3

BMP or Bitmap is a raster graphics format compatible with a wide range of software for viewing and processing images. BMP files store all the pixels of an image without applying any compression. The format is valuable for its ability to preserve pristine image quality. However, due to the lack of a compression mechanism, BMP files are often huge in size, making them difficult to store and transfer.

How to convert MAP to BMP?

The easiest way is to download good program conversions, for example Photo Converter. It works quickly and efficiently, allowing you to convert any number of MAP files at once. You will be able to quickly appreciate that Photo Converter can save a lot of time that you will spend when working manually.

Download and install Photo Converter

The photo converter is easy to download, install and use - you don't need to be a computer expert to understand how it works.

Add MAP files to Photo Converter

Launch Photo Converter and load the .map files you want to convert to .bmp

You can select MAP files through the menu Files → Add files or simply transfer them to the Photo Converter window.

Select a location to save the received BMP files


Select BMP as the save format

To select BMP as the save format, click on the icon BMP at the bottom of the screen, or the button + to add the ability to write to this format.


Now just press the button Start and the conversion will begin instantly, and the BMP files will be saved to the specified location with the necessary parameters and effects.

Try the free demo

Video instruction

Command Line Interface

Professional users can convert MAP to BMP using command line in manual or automatic mode. For additional advice on using the cmd interface, please contact



Burkozel