Game Development Community

Limit in terrain height of 2048 ?

by Jeff Yaskus · in Torque 3D Professional · 01/12/2011 (9:36 pm) · 11 replies

I'm trying to import a height map for a large mountain into Torque 3D -- and it kept crashing the editor when I try to save the level after importing.

The height map is 2048x2048 pixels in size, with a max height of 14973 feet. I've been entering a height range of 15000 on the import height map screen - and it seems to load ok.

So I tried creating it in L3TD first, then exporting as a .TER (torque terrain file) -- but it prompts up an error message saying that "torque 3d has a limit of up to 2048 meters in height"!

Is it really true that T3D terrains can't handle a height over 2048 meters ??

That might explain why it crashes when trying to save after doing the import -- but seems extremely limiting for a new engine.

I noticed that L3TD lets you export the height map in mosiac "pieces" but haven't found any examples or directions on how to load such a map into Torque ... and doubt it would help with this issue.

#1
01/12/2011 (9:54 pm)
I quick look into this shows that the terrain may be able to be changed at a cost of 'smoothing' look into terrFile.h/cpp for details. Perhaps one of the terrain experts like Konrad can help you in more detail.
#2
01/12/2011 (10:22 pm)
what scale of terrain are you using, how many units/meters per pixel from the heightmap?

Having a height difference of 17km between the highest and lowest point on a 2km area seems a bit out of whack to me. Thats 7.3 meters up for each meter forward if its done as a gradient from one side of the zone to the other.

For example How does the map look when you have it importing with a heightrange of 1024 and 2 meters for the scaling?

The mosaics from l3dt are for old TGEa's Atlas terrains and mega terrains. T3D does not utilise this method anymore for terrains (as far as I know...) however you can create your own mosaics and create your own style megaterrain by just importing each piece as a separate terrain block (What a megaterrain was anyway) and use the terrain blocks positioning to place each one up against eachother seamlessly.
#3
01/12/2011 (10:38 pm)
Here is the height map I am using;
http://jyaskus.com/downloads/RAINIER_4096_6m.7z

It is in 4096x4096 pixel 24bp gray scale BMP file.

The map itself covers about a 15 x 15 mile area.
Using the map size of 4096^2, I came up with ~6 meters per pixel.

The height range is from 374 feet ... to 14973 feet at the summit of Mt Rainier.
So roughly 15000 feet elevation (feet - not yards or meters)

When I import the height map, I used the values of (6) Meters Per Pixel and (15000) Height Scale.

It takes a few minutes, but it does load ... and I can see around the level.
However, when I attempt to SAVE the level ... it crashes with no error code.

That is why I tried using LT3D, thinking exporting it as a .TER file might work better ... and saw the message that T3D can only handle terrains up to 2048 meters in height.

When I imported it with lower or default settings, the terrain looks very "squashed" and the mountain is just a little bump in the distance.

... I'm no expert with this, so maybe I'm making mistakes in my math or numbers somewhere ... but seems odd.
#4
01/13/2011 (9:22 pm)
Should the "Height Scale" be in meters or feet ? Is there a better way to be importing this ? It crashes on SAVE even with a height scale of 5000 (assuming its meters instead of feet?)
#5
01/14/2011 (11:10 pm)
Pulling down the heightmap now, will load it into mine to see whats happening.
#6
01/15/2011 (1:33 pm)
Hi Jeff,

Torque TER files store the height as 16-bit values representing a 11.5 fixed point format. The 16 bit values are converted to floating point elevations using the 'fixedToFloat' function declared in 'terrFile.h', which is:

/// Conversion from 11.5 fixed point to floating point.
inline F32 fixedToFloat( U16 val )
{
   return F32(val) * 0.03125f;
}

Which is to say that each step in the 16-bit values corresponds to a 1/32nd of a metre in floating point altitude.

With the 16 bit values having a possible range of 0...65535, the possible range of floating point altitudes permitted by the above function is 0...2047.96875 metres. Thus, the maximum altitude range (i.e. max - min) is ~2048 metres.

Best regards,
Aaron.
#7
01/15/2011 (5:57 pm)
The heightmap posted is also 8bit, which is why it has sharp contour steps allover it. You need to use a 16bit image for the heightmap to get it to import smoothly.
Also you have to bear in mind the scale of things relative to your player avatar instead of how it is scaled in an external program. Personally i use some 'odd' looking settings with geocontrol to make my heightmaps but i dont aim to use the same scaling within torque.
I might make a map in geocontrol that has say a distance of 30km width, but ill use it at 8km width in torque as it 'feels' better scaled... also a 8km square map is 64km/sq, more then most games have. Using a map that is 24kmx24km has a total area of ~576km/2. that is absolutely massive, and you wouldnt have much chance of fully populating that zone with objects all within one mission.
#8
01/19/2011 (1:23 am)
I croped the land west of the mtn and used it as a ht-map with mtn as a skybox. Not a bad compromise.

Here is what it looks like ...
jyaskus.com/downloads/mtn1.png
jyaskus.com/downloads/mtn2.png
jyaskus.com/downloads/mtn3.png
jyaskus.com/downloads/mtn4.png

Next step is to add rocks / trees / ground cover to the terrain ... as well as water (streams, rivers)

Is there any way to add them "programatically" based on height or slope ?

I've done it on level start (in TGE/RTS Kit) with objects but not sure how the new "ground cover" works ... assume its more efficient than adding thousands of "tree" or "rock" models to the level ??
#9
01/19/2011 (12:08 pm)
Jeff. While you are in the terrain editor, you can smooth out all of those contour steps from the terrain.
Press F2 to go to the terrain editor, open the terrain menu at the top and you should find the smooth heightmap option there. this effects the whole terrain btw.

#10
02/05/2012 (3:00 pm)
I found a possible new approach, but haven't fully tested it yet. Doesn't each terrain have its own height limits ? i.e. ~2048 meters per terrain.

So if I took a large area and broke it up into 9 (3x3) smaller pieces (or more) ... and create a separate terrain from each piece. Each has its own "height range", with a min & max value.

Then each terrain "Steps up" slowly, towards the map center where the mountain is.
....E
...D.D
..C...C
.B.....B
A.......A

This would work around the height range limit ... possibly.