Calculating Exact Map Size

I have an enormous map that I’ve just imported in as a heightmap. How would I go about calculating the exact size of the map in miles[SUP]2[/SUP] or km[SUP]2[/SUP]?

If it helps, these are the settings I used when importing the height map (the 4033x4033 line):

2 Likes

AFAIK, with a scale of 100x100, a landscape that is 4033x4033 = 403,300 km[SUP]2[/SUP].

At least, this seems to be true with my 1-Meter block object that I imported. It appears to match up with 1/10th of a non-LOD poly.

I think it works differently. It’s a bit tricky. First of all you need to understand how to calculate landscape dimensions (Landscape Technical Guide | Unreal Engine Documentation is a good resource). UE4 uses 1 unit = 1cm scale proportion. Landscape is scaled to 100x100x100 (as Kjasi mentioned).

To calculate exact size you need to do a little math: (Overall Resolution - 1) * 100 (which is X scale) by (Overall Resolution - 1) * 100 (which is Y scale)

Let’s take a very small landscape as an example:
Section size: 7x7
Sections per component: 1x1
Number of Components: 2x2
so the Overall Resolution: 15x15

(15-1)*100 = 1400 cm
1400 cm * 1400 cm = 1960000 cm^2 = 196m^2

In your case the surface area is: 16257024 m^2 = ~16,26 km^2

Correct me if I’m wrong

1 Like

Can anyone back this math up?

First of all, yes, it should be in cm, (I forgot about that…), second, while his method works, (see my final result below) it feels a bit too complicated for my tastes. Plus I fail to see the correlation between his labels and the ones listed on the Landscape Sizes table.

My formula is to calculate the surface area, based on the edges: Overall Size (Verts) * Scale = Xcm = Ykm * Ykm = Zkm[sup]2[/sup]

Using my method:
4033 * 100 = 403300cm * 0.01 = 4033m * 0.001 = 4.033km
4.033 * 4.033 = 16.265089km[sup]2[/sup]

As you can see, my formula is simpler, but gets similar results as his formula. So while I can’t quite duplicate his equation for 4033, I can get similar results with another formula.

Landscape is 1 vertex per meter. This is 100 UE4 units per landscape vertex. So a landscape size of 4033 vertices is 4033 meters, or 4.033 km. Pretty basic.

…But, um, holy ****, 1024 components?! Please don’t do that. If my math is correct, you can use 4065 vertices: 127 quads/section, 4 sections per component (2x2), and 256 components (16x16). With a quarter of the components, this will drastically reduce your draw calls on CPU and run a lot smoother. You might have to render some more polygons on the GPU because it can’t handle LODs as efficiently and doesn’t cull out as well, but compared to the other option of wreaking havoc on the CPU with 4x the draw calls, it’s totally worth it. Too many components will totally screw with your system: it’s very unstable. Alternatively, I would reduce the section size to 63 quads to get the benefit of better LODs with smaller pieces that can also cull more easily. Ideally, 63 quads/section, 4 sections per component, and 64 components (8x8) for a total of 1009 vertices, or 1.009 km. This would be 4 times smaller (in width, it’s actually 16x less area), but 960 less components than the size you want, and it would totally run on mid-grade hardware to the utmost of efficiency.

Thing is, I need the map to be 4km x 4km. What can I do to make the performance better while keeping the same size? Are there any other techniques that you know of that would help run it smoother?

I think, your method is not working correctly. I did a practical test with small landscape (overall size: 57x57) so I could measure the edge in editor in top view.

Using your math:
57 * 100 = 5700cm * 0.01 = 57m
57 * 57 = 3249m[SUP]2[/SUP]

which is not exactly true:
Imgur

It should be 5600cm per edge, so the surface areas is 3136m[SUP]2[/SUP].

No one that can suggest what to do for me?
My landscape is now 1920 sections!
The heightmap has the resolution of 24.000x20.000. I want to keep the reolution and size, but it is set on 255255 qauds, sections size2x2, so I can only lower resolution and/or divide into more sections.
I went in the source and exposed a 510
510 quad size, but the editor can’t handle it so I couldn’t use it. I tried using the 510510 to clip to lower section number but for the editor to try to lower 1920 sections to 480, would take it reading in all the sections AND making calculations based on 510510 quad size on them on , and that is where my computer can’t take it anymore…

When I imported the heightmap it automatically set it to the largest amounts of quads and section size, what can I do to LOWER AMOUNT OF SECTIONS??

Please help, it has halted all developing for me.

this is totally confusing :confused:

4 Likes

Sometimes, even when the scaling is right, it looks/feels different against realworldfeeling/size.

+1

2 Likes

Okay guys so this is a lot more simple than the math stated above. You can calculate EXACT map size based on resolution size.

When you import a map or even make a map using the landscape tools it starts everything at X 100 Y 100 Z 100 and then offsets the landscape by half the size of the landscape(usually, sometimes the whole landscape) If you’re not sure if its the whole landscape add any object to the scene and position it at X 0 Y 0 Z 0 and if its right on the edge of the landscape, then the entire landscape is offset which then its easy and you just look at the X and Y position to figure out how large the landscape is.

Other than that, here is a simple breakdown that calculates the map size

Landscape Scaling = Resolution * 100 @ 100%. (Example: 8129 * 100 = 812900 @ 100%)

812900 uu = 812900 cm = 8129 Meters = 8.129 Kilometers @ 100%
For 200% its just 812900 * 2 and so on.

X= 100% Y = 100% @ 8129 Resolution - Landscape Size is X = 812900 Y = 812900

Z = 512 @ 100%

Z = 2048, Then Z must be 400%

Z = 512 * 4 = 2048

Z * 4 = 400%

So a Landscape with resolution at 8129 and a height of 2048 will be
X = 100 Y = 100 Z = 400

Final result in uu is
X = 812900 Y = 812900 Z = 204800

Everything is in Centimeters, so to have everything converted into Kilomters or Meters you need to do a little math.

1 Meter is 100 Centimeters
1 Kilomters is 1000 Meters

So 812900 Centimeters(uu) = 8129 Meters

8129 Meters = 8.129 Kilometers.

Simple.

As said in here, if I want a 15Km (9.32 miles) map, I make a Greyscale 15,000 pixels squere map in Photoshop? or whats the size of the document I should do in order to make a map of that size (15 Mk)?

Sorry to bring up this OLD post, just wanted to be sure.

I’m adding to this, OLD thread but its logical to place it here and sorry Extile Ihave no idea without more research how PS units compares ;l)

My question:

8129 Meters = 8.129 Kilometers.

^^ that as above, does not ‘match’ the ‘KM’ I see in left view of my terrain in viewport.

is that a known issue of the ‘viewport’ measurement, or am I missing something here ? ;))

Bumping for verification of inconsistency.

How do you get a 50 square mile map?

I actually still see this thread as an overall confusing/vague answer (talk about arithmetic overload), so let me attempt to fix it once and for all, for everyone else.

A little primer:

An Unreal terrain is made up of 2 measurements, quads and components (the third one, sections, are essentially the same as components, except they are made specifically for LOD calculation afaik). The quad is the very basic measurement at 4 bytes aka 4 vertices. The component is made up of some amount of quads, which you specify in the landscape creation menu. So you can have like 63x63, 127x127 quads… etc, but this will be 1 component. A different amount of quads means a different map size.

According to the unreal documentation, every component you create has it’s own “render thread processing cost”, and is going to cost 1 or 4 draw calls, depending on the amount of sections you have. So, the less components you have, the better the performance there will be. Also, it says that you get faster LOD transitions (meaning smaller map but better looking if your character is moving fast) and occlusion of more terrain (terrain will be more responsive/less “glitchy” i suppose) if you have smaller components, meaning smaller maps. Basically, smaller map = better response…

Measuring all of this:

Well, you have to take two other values when you want to measure your landscape. These are resolution and scale. Your scale, by default, is measured in centimeters (every distance is, unless you changed it in the project settings, which you should take note of here and adjust accordingly) and is by default set to 100(x) x 100(y). Also, the side length of 1 quad is the same as your scale (area of a quad = scale x scale, in cm). That means that 1 quad = 1x1 meter, or 100x100 centimeters.

Your resolution is the amount of quads in the entire landscape. This means that you can skip the quad multiplication and multiply the scale by the resolution to get the distance in cm of one dimension of the landscape. So if you make a map and the final resolution is 1009x1009 (keeping in mind what I said above about performance) and the scale is 100x100, that means that it is 100k x 100k cm, or 1k x 1k meters, which would be quite small for an open world game imo.

Heightmapping all of this:

When it comes to heightmapping, there is always a bit of trial and error when it comes to the application, but a standard rule is 1 pixel = 1 vertex. Now since, as I said above, a quad is 4 vertices, that means that the amount of vertices is the amount of quads in one dimension*4 + 1, squared. You add 1 because there is always another row of vertices that attach to the last set of quads. Note that if you changed the scale, you would also need to change the “scale” of your heightmap. So, if your scale is at 1000, aka 10 meters, you would want your heightmap to represent 10 meters^2 per pixel if you want an accurate representation…

tldr if you want to measure your map multiply your scale x by your resolution x, your scale y by your resolution y, then multiply those two products to get the area of your map in centimeters.

3 Likes

Hi guy’s,

Just recently switch a 3 years project to UE4 and darn i never expected that would have to spend the night just to understand such a basic thing as the terrain size of my game! Please can someone tell me in plain and simple terms what size should i made my terrain to avoid any problem along the way, i was aiming for a 5 km x 5 km map size that is going to be for a multiplayer pvp map?

Okay. A few things I want to clarify/stress since I feel they are rather important.

Vertex count is not the same as size. A map with a 1009 vertex per side scale to 1 m per vertex spacing is 1,008 meters to a side, NOT 1,009 meters. This is because the mesh needs to be closed and that final row of vertices is not an extension of the size. For example, a map with a 2 x 2 resolution is only 1 m to a side. You have the vertex at the 0 position and the second at the 1 position, thus it spans 1 meter. To solve this, all you need to do is subtract one from the vertex count to get a proper extent. It’s a small thing, but on smaller maps or larger scales it makes a big difference. It’s worth noting that when you make height maps to import into the World Composition editor tool, you will need to make sure they all have that extra row of vertices. These are supposed to be exactly the same as the previous tile since they will lay on top of neighboring

Don’t make huge maps. Make many smaller maps. A 1 m vertex spacing is pretty good for most games. To maintain this you need to keep the map sizes within reason. If you want a large open world map, you are better off tiling it and letting the engine stream it (and any resources specific to that map tile) in as needed. You won’t have the memory footprint of keeping 25 sq km of landscape in memory; instead you keep 9 or so depending on your view distance requirements. The other benefit of small 1 km by 1 km maps is you can keep that 1 m vertex spacing since you don’t need a huge vertex count or x/y scaling. As mentioned above, you can keep a lot of you actors on these streaming levels and they will load and unload with the levels dynamically. No reason to keep that castle loaded if the player can’t even see it. Why process the AI for that pack of wolves on the other side of the map if the level is never loaded. My current test map is 6 km by 6 km, or 36 tiled levels. If I wan’t using this feature there is no way I could keep the density of NPCs and building I currently have. Oh, and all the foliage as well. It’s worth noting that when you make height maps to import into the World Composition editor tool, you will need to make sure they all have that extra row of vertices. These are supposed to be exactly the same as the previous tile since they will lay on top of neighboring tiles. Otherwise you will have seams. This goes for both the X and Y directions. Example: A 10,000 by 1,000 map broken into 10 tiles would have ten height maps that are 1,001 by 1,001.

Optional: Origin Shifting. So you set your game up to have level streaming and you get crazy and make HUGE TRACTS OF LAND. You might want to enable World Origin Shifting. Basically this is a feature where the engine changes the coord system on the fly so it’s always a reasonable distance from the camera. This keeps distances and location data for actors on the far end of the world from becoming really large. You can even flag actors to ignore the shifting, which is good for things that you always want at 0,0,0 like a Skylight or Sun or other similar actors.

To the best of my knowledge, I think this is all correct as it has worked for me and matches with my knowledge of landscapes. If something is wrong, just let me know and I’ll correct it and be happy to learn something new.

D

3 Likes