Game Development Community

Help Creating Atlas Terrain

by Thomas Shaw · in Torque Game Engine Advanced · 06/25/2005 (2:46 pm) · 1 replies

Okay, I have read the documentation. "Using Terragen with Atlas" & "Generating a chunk geometry (.chu) file"

As far as I know I am creating my .raw files the right way. I am using Terragen & I also tried to use Free world 3D.

I can't get this to work. I am almost positive this is user error, but I simply just can't follow the documentation. Every time I try to create a terrain block using something I have read it either cashes, or successfully creates the block but my terrain is all misshapen (stretched out vertically or just outright flat).

I get errors like:

"Atlasmesher::writeCollision - empty bin, crap!"

Or TSE just outright crashes upon complete the "chunking"

I have spent hours trying to figure this out. I tried my best to resolve this before posting here, but I just can't create terrain in TSE. As far as I can tell the numbers were explained here:

generateChunkFileFromRaw16(srcFile, size, squareSize, vertScale, destFile, error, treeDepth)

srcFile
Filename of the source raw 16 bit heightfield we wish to generate data for. Example: "demo/data/terrains/test_16_4097.raw".

size
Size of the heightfield, which is assumed to be square. The heightfield will be expected to be ONE MORE THAN THIS. Integer. Size must be a power of 2. Example: 4096.

squareSize
Spacing between sample points, in meters. The default in legacy was 8 meters. This is a floating point number. There are no limitations on this value, although high polygon density may result in reduced frame rates. Example: 2.0.

vertScale
Vertical scale factor. 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. Factors are commonly of the form 1.0 / 2.0n, n often being between 1 and 8. 1.0 / 256.0 gives you a workable range of about 25 meters in the vertical range.

destFile
File to which generated data is written. This file should end in .chu for TSE's resource manager to properly load it. Example: "demo/data/terrains/large.chu".

error
Floating point number indicating the acceptable amount of error for each LOD to possess compared to the previous. This directly and dramatically impacts the number of polygons that will be rendered. Example: 2.0.

treeDepth
Integer indicating how deep the quadtree of chunks is to be. Example: 6.

However, allot of this doesn't make sense to me. If somone could translate this and just give me a simple quick proscess to create a terraine block in TSE, starting the .raw file and ending the the .chu file, I would really aprecieate it. Here is the code that I have been using.

generateChunkFileFromRaw16(
"terrain_water_demo/data/terrains/terrain1.raw",
256, 2.0, 1.0 /400.0,
"terrain_water_demo/data/terrains/terrain1.chu", 1.8, 2);

I have had the best results with this thus far, but I am still having problems with the terrain being stretched out vertically.

Again I not posting here just to get some quick and easy answers, I really struggled to get this to work and it just wont.

Thanks

#1
06/27/2005 (11:15 am)
Thomas a couple of things that it might be.

Is your raw file actually 257 by 257 pixels? That is one common issue but it seems you might be getting some output so I doubt that is your problem.

The thing i think it is, which i have the same problem, is that you cant have anything over 256 in the 1.0/ 400.0. That 400 cant be that big. I have tried everything over 256 and it wont work but anything under 256 does. dont know why but it seems to be that way at the moment. So if you are trying to get accurate terrain you cant quite do it right now. try changing the 400 to 256 and see if that works. Change your error to 10 at min to start that way it wont take as long.