Large Terrain LOD
by Emil Diego · in Torque Game Engine Advanced · 10/10/2006 (6:34 am) · 5 replies
I recent;y created a 8192.8192 terrain heightmap with a simple texture and imported it into the game. It works ok, except for one small part. Whenever I move around in the terrain I get some weird things happening to the terrain, which seems to be part of the Continous Level of Detail feature.
As I move close to certain parts of the terrain, some of the verts start to move around, and when I get closed they move back into their original positions.
I was wondering 2 things:
1. Are the different detail levels set when the heightmap is imported using the atlasOldGenerateChunkFileFromRaw16 function?
2. If so, what should I do to try and remedy the situation?
FYI.
Here are the parameters I used when creating my chunk file.
atlasOldGenerateChunkFileFromRaw16("heightmap.raw", 8192, 1.0, 1.0/256.0, "terrainGeom.chu", 5.0, 5);
I'll be the first to admit i don't really understand 100% what each parameters does here, so any information would be helpfull.
As I move close to certain parts of the terrain, some of the verts start to move around, and when I get closed they move back into their original positions.
I was wondering 2 things:
1. Are the different detail levels set when the heightmap is imported using the atlasOldGenerateChunkFileFromRaw16 function?
2. If so, what should I do to try and remedy the situation?
FYI.
Here are the parameters I used when creating my chunk file.
atlasOldGenerateChunkFileFromRaw16("heightmap.raw", 8192, 1.0, 1.0/256.0, "terrainGeom.chu", 5.0, 5);
I'll be the first to admit i don't really understand 100% what each parameters does here, so any information would be helpfull.
#2
Thanks for helping me clear up the issus a bit.
10/10/2006 (7:24 am)
Exactly. The vertices morph from one state to the next as i move closer to them. They don't pop, like you would expect in clod. Thanks for helping me clear up the issus a bit.
#3
1) I haven't been able to import an 8192pm terrain (with a 32k wide image), so I'm a little jealous. I haven't had time to try on my new work computer though.
2) Without knowing what your terrain looks like, I would ballpark guess that your error metric could be causing the issue (though I've never seen vertex morphing). The error metric is a description of how far off the true elevation the importer can place a vertex in an effort to reduce polygons. Essentially, you are telling the importer that it can move a point up to 5 meters if that will make a surface flat (and need less polygons).
When you run the importer, how many verts/chunk does it report? Ideally, we aim for 1000 to 5000, but I'm guessing yours is significantly lower. Something in the 0.5 to 1.0 range may be better for you, but you'll have to play around to see.
One of my import commands:
Also of note... is your heightmap 8192px wide, or 8193px? It should be a "power-of-two plus one."
10/10/2006 (8:04 am)
My thoughts:1) I haven't been able to import an 8192pm terrain (with a 32k wide image), so I'm a little jealous. I haven't had time to try on my new work computer though.
2) Without knowing what your terrain looks like, I would ballpark guess that your error metric could be causing the issue (though I've never seen vertex morphing). The error metric is a description of how far off the true elevation the importer can place a vertex in an effort to reduce polygons. Essentially, you are telling the importer that it can move a point up to 5 meters if that will make a surface flat (and need less polygons).
When you run the importer, how many verts/chunk does it report? Ideally, we aim for 1000 to 5000, but I'm guessing yours is significantly lower. Something in the 0.5 to 1.0 range may be better for you, but you'll have to play around to see.
One of my import commands:
atlasOldGenerateChunkFileFromRaw16("./elev_B11E14_4097.raw", 4096, 1.0, 1.0 / 100.0,"./elev_B11E14_4097.chu", 0.3, 4 );Also of note... is your heightmap 8192px wide, or 8193px? It should be a "power-of-two plus one."
#4
10/10/2006 (8:06 am)
The actual dimensions of the heightmap is 8193x8193. I'll try reducing the error metric and see if that resolves the issue. I'll also dump the log file when i recreate the terrain so you can all see the output that gets generated.
#5
==>atlasOldGenerateChunkFileFromRaw16("terrain_water_demo/data/terrains/heightmap_test_20.raw", 8192, 1.0, 1.0 / 256.0, "terrain_water_demo/data/terrains/heightmap_test_20.chu", 1.0, 5);
PlatformMemory: allocating new page, total bytes allocated so far: 44413548 (total bytes in all pages=201359432)
PlatformMemory: allocating new page, total bytes allocated so far: 178664048 (total bytes in all pages=268484752)
PlatformMemory: allocating new page, total bytes allocated so far: 245797536 (total bytes in all pages=402735320)
Generating chunked geometry (depth=5, baseMaxError=1.000000)
o Calculating activation levels...
- done.
o Propagating activation levels...
- done.
o Writing file header...
- done.
o Generating empty TOC...
- done.
o Generating meshes...
AtlasOldActivationHeightfield::generateNodeData - Min exceeded! May have paging issues!
- done.
=== Chunk Statistics ===\
\===== Level Count Avg. Size
0 256 520.136719
1 64 1998.359375
2 16 4688.000000
3 4 12960.250000
4 1 41318.000000
========================================
chunks: 341
input verts: 67108864
output verts: 39871
avg verts/chunk: 117
NOTE: verts/chunk is low; for higher poly throughput consider setting the tree depth to 4 and reprocessing.
output bytes: 12645
bytes/input vert: 0.00
bytes/output vert: 0.32
real triangles: 429217
10/10/2006 (9:17 am)
I think i got it fixed. I reduced the error parameter to 1 and generated the terrain. It looks like the morphing problem has dsapeared. Thanks for the help.==>atlasOldGenerateChunkFileFromRaw16("terrain_water_demo/data/terrains/heightmap_test_20.raw", 8192, 1.0, 1.0 / 256.0, "terrain_water_demo/data/terrains/heightmap_test_20.chu", 1.0, 5);
PlatformMemory: allocating new page, total bytes allocated so far: 44413548 (total bytes in all pages=201359432)
PlatformMemory: allocating new page, total bytes allocated so far: 178664048 (total bytes in all pages=268484752)
PlatformMemory: allocating new page, total bytes allocated so far: 245797536 (total bytes in all pages=402735320)
Generating chunked geometry (depth=5, baseMaxError=1.000000)
o Calculating activation levels...
- done.
o Propagating activation levels...
- done.
o Writing file header...
- done.
o Generating empty TOC...
- done.
o Generating meshes...
AtlasOldActivationHeightfield::generateNodeData - Min exceeded! May have paging issues!
- done.
=== Chunk Statistics ===\
\===== Level Count Avg. Size
0 256 520.136719
1 64 1998.359375
2 16 4688.000000
3 4 12960.250000
4 1 41318.000000
========================================
chunks: 341
input verts: 67108864
output verts: 39871
avg verts/chunk: 117
NOTE: verts/chunk is low; for higher poly throughput consider setting the tree depth to 4 and reprocessing.
output bytes: 12645
bytes/input vert: 0.00
bytes/output vert: 0.32
real triangles: 429217
Torque 3D Owner J.C. Smith