Atlas: trouble generating CHU file, terrain not rendered
by Shayne Gelo · in Torque Game Engine Advanced · 01/12/2006 (10:08 am) · 0 replies
I'm trying to use Atlas to generate terrain for some real world terrain data. The raw data is 90 meter resolution represented as signed two bytes integers in big-endian order. The integer values represent the actual elevation in meters. I've converted the data to little-endian and shifted up, so all data sould be positive.
For example, I'm trying to process the N30W090 geo cell whose actual elevation ranges from -40 to +128. I've converted to little-endian and scaled up by 40 so the range is 0 to 168. I've also cropped out a region so it is 1025 pixels square.
Now, the problem comes in when I actually try to generate the .chu file for the terrain. Here is the call I'm using.
No matter how I play around with the vertScale, error and treeDepth, I seem to get at least a few (and sometimes very many) of the "AtlasActivationHeightfield::generateNodeData - {Min,Max} exceeded! May have paging issues!" errors. When I try to render my terrain using the included smallTexture.tqt (I know it doesn't match, I'm just trying to see something for now) nothing renders. The included terrain_water_demo data render fine, so it's not some global problem. Furthermore, I don't see any console errors as I do if I put in a bogus chunkFile parameter, so it's not that the file's failing to load.
One of the main things I'm not sure about is the vert scale parameter. the docs say:
Which would lead me to believe that I should use 1.0, since my raw data is already in 1 meter scale. However in this thread, Jacob mentions that
I tried that, and it results in many more of the min/max exceeded errors as well as complaining that verts/chunk is low. I've read all the documentation and forum threads I can find, but I still don't really understand the vert scale parameter. Incoming (unsigned) raw data has a domain of 0 to 65535 and is multiplied by the vert scale, but what range should that be mapping it to? Furthermore, if the engine itself uses signed data, why are we importing unsigned? Do we just adjust the z value of the placement to get negative values? And while I'm asking, why must the height data be a power of 2 plus one on a side?
I'm still pretty new to Torque, so any advice would be much appreciated.
For example, I'm trying to process the N30W090 geo cell whose actual elevation ranges from -40 to +128. I've converted to little-endian and scaled up by 40 so the range is 0 to 168. I've also cropped out a region so it is 1025 pixels square.
Now, the problem comes in when I actually try to generate the .chu file for the terrain. Here is the call I'm using.
generateChunkFileFromRaw16( "terrain_water_demo/data/terrains/N30W090_unsigned_le_16_1025.hgt", 1024, 90.0, // square size 1.0, // vert scale "terrain_water_demo/data/terrains/N30W090_2.chu", 5.0, // error 4); // tree depth
No matter how I play around with the vertScale, error and treeDepth, I seem to get at least a few (and sometimes very many) of the "AtlasActivationHeightfield::generateNodeData - {Min,Max} exceeded! May have paging issues!" errors. When I try to render my terrain using the included smallTexture.tqt (I know it doesn't match, I'm just trying to see something for now) nothing renders. The included terrain_water_demo data render fine, so it's not some global problem. Furthermore, I don't see any console errors as I do if I put in a bogus chunkFile parameter, so it's not that the file's failing to load.
One of the main things I'm not sure about is the vert scale parameter. the docs say:
Quote:Incoming raw data comes in as a whole number between -32,765 and +32,765, and is scaled by this factor to convert to meters.
Which would lead me to believe that I should use 1.0, since my raw data is already in 1 meter scale. However in this thread, Jacob mentions that
Quote:To calculate your height scale, take your highest altitude and divide by 65535.
I tried that, and it results in many more of the min/max exceeded errors as well as complaining that verts/chunk is low. I've read all the documentation and forum threads I can find, but I still don't really understand the vert scale parameter. Incoming (unsigned) raw data has a domain of 0 to 65535 and is multiplied by the vert scale, but what range should that be mapping it to? Furthermore, if the engine itself uses signed data, why are we importing unsigned? Do we just adjust the z value of the placement to get negative values? And while I'm asking, why must the height data be a power of 2 plus one on a side?
I'm still pretty new to Torque, so any advice would be much appreciated.