Game Development Community

Newbie Altas questions

by Doug Coward · in Torque Game Engine Advanced · 04/18/2006 (5:04 pm) · 8 replies

Hi everyone,
I have been playing with the Torque Shader Engine for a couple of months now and I thought I would ask some questions. I have been concentrating on displaying terrain in the Torque Shader Engine and I'm only interested in displaying real world/GIS type topography and bathymetry data.

1) The only software I have found so far that will allow me to import a RAW 16-bit height map image, do selective cut and paste operations, and then export a new RAW 16-bit height map image is Photoshop CS.
What other image/terrain editors should I be using to edit 16-bit images?

2) Has anyone documented the TSE Chunk LOD file format? And does anyone know the difference between the TSE Chunk LOD format and the VTBuilder Chunk LOD format?

3) Is there a TSE resource/example that involves the dynamically reloading of terrain?

4) Has anyone successfully 'chunked' an 8193 x 8193 height map image?

5) For the really stupid question of the day, has anyone tried displaying a terrain mesh as an fxRenderObject?

6) And first, I have to say a really big thank you to Neo Binedell for his Atlas terrain import GUI, it has saved me a lot of time. But has anyone come up with an effective progress indication for the chunk generation function?

I would be very interested to talk with others trying to display GIS type terrain.

I'm currently playing with the SRTM30 Plus dataset (30 arc-seconds, same as DTED 0) which I cut into a square and interpolate up 10 times in resolution to DTED 1. I use this square to backfill an equal square of DTED 1 data.

Thanks for taking the time,
--Doug Coward

#1
04/27/2006 (6:27 pm)
Since no one can answer these questions I guess I'll just post the answers here as I find them.

Question 6 - And first, I have to say a really big thank you to Neo Binedell for his
Atlas terrain import GUI, it has saved me a lot of time. But has anyone come up
with an effective progress indication for the chunk generation function?

This is my attempt at a progress messgage for the CHU generation function. I wanted
something that would work with or without Neo's Terrain Import GUI, so I print the
messages to the CLI shell. If the engine is running windowed then the messages are easy
to see.
The changes are made to two files, AtlasGen.cpp and AtlasGen.h

Changes to AtlasGen.h
Find
   U32 outputSize;
Change to
   U32 outputSize;
   U32 total_chunks; //added
   U32 spin_count;   //added
   U32 progress;     //added

Find
      outputSize = 0;
Change to
      outputSize = 0;
      total_chunks = 0;  //added
      spin_count = 0;	 //added
      progress = 0;	 // added


Changes to AtlasGen.cpp
Find
   Con::printf("Generating chunked geometry (depth=%d, baseMaxError=%f)", treeDepth, baseMaxError);
Change to
   Con::printf("Generating chunked geometry (depth=%d, baseMaxError=%f)", treeDepth, baseMaxError);
   // Print to the CLI shell as a progress message
   dPrintf("\n\nGenerating chunked geometry (depth=%d, baseMaxError=%f)", treeDepth, baseMaxError); //added

Find
   gChunkGenStats.inputVertices = size() * size();
Change to
   gChunkGenStats.inputVertices = size() * size();
   // Calculate total number of chunks for progress message
   gChunkGenStats.total_chunks = 0x55555555 & ((1 << (treeDepth*2)) - 1); //added

Find
   Con::printf("   o Calculating activation levels...");
Change to
   Con::printf("   o Calculating activation levels...");
   // Print to the CLI shell as a progress message
   dPrintf("\n   o Calculating activation levels...");   //added

Find
   Con::printf("   o Propagating activation levels...");
Change to
   Con::printf("   o Propagating activation levels...");
   // Print to the CLI shell as a progress message
   dPrintf("\n   o Propagating activation levels...");   //added

Find
   Con::printf("   o Writing file header...");
Change to
   Con::printf("   o Writing file header...");
   // Print to the CLI shell as a progress message
   dPrintf("\n   o Writing file header...");    //added

Find
   Con::printf("   o Generating empty TOC...");
Change to
   Con::printf("   o Generating empty TOC...");
   // Print to the CLI shell as a progress message
   dPrintf("\n   o Generating empty TOC...");  //added

Find
   Con::printf("   o Generating meshes...");
Change to
   Con::printf("   o Generating meshes...");
   // Print to the CLI shell as a progress message
   dPrintf("\n   o Generating meshes...\n");   //added

Find
   Con::printf("       avg verts/chunk: %10.0f", vertsPerChunk);
Change to
   Con::printf("       avg verts/chunk: %10.0f", vertsPerChunk);
   // Print a few stats to the CLI shell 
   dPrintf("\n                chunks: %10d", gChunkGenStats.outputChunks);  //added
   dPrintf("\n       avg verts/chunk: %10.0f\n", vertsPerChunk);  //added

Find
      Con::printf("NOTE: verts/chunk is low; for higher poly throughput consider setting the tree depth to %d and reprocessing.", treeDepth - 1);
Change to
      Con::printf("NOTE: verts/chunk is low; for higher poly throughput consider setting the tree depth to %d and reprocessing.", treeDepth - 1);
	  // Print a warning to the CLI shell 
	  dPrintf("\nNOTE: verts/chunk is less than 1000; for higher poly throughput consider setting the tree depth to %d and reprocessing.\n", treeDepth - 1);  //added

Find
      Con::printf("NOTE: verts/chunk is high; for smoother framerate consider setting the tree depth to %d and reprocessing.", treeDepth + 1);
Change to
      Con::printf("NOTE: verts/chunk is high; for smoother framerate consider setting the tree depth to %d and reprocessing.", treeDepth + 1);
	// Print a warning to the CLI shell 
      dPrintf("\nNOTE: verts/chunk is greater than 5000; for smoother framerate consider setting the tree depth to %d and reprocessing.\n", treeDepth + 1); //added

Find
   gChunkGenStats.outputChunks++;
Change to
   gChunkGenStats.outputChunks++;
   // The progress message is just the percentage of total chunks to be processed. The size of chunks
   // can very wildly so the progress message will sometimes stall. Thats why there is also a spinner 
   // that is displayed next to the message. 
   // To cut down on the printing overhead, just print progress if it has changed
   if(((gChunkGenStats.outputChunks * 100)/gChunkGenStats.total_chunks) > gChunkGenStats.progress)
   {
      gChunkGenStats.progress = ((gChunkGenStats.outputChunks * 100)/gChunkGenStats.total_chunks); // New progress  
      dPrintf("\r %3d%% Complete ....", gChunkGenStats.progress);  // Print progress
   }

Find
   if (recursionLevel <= 0) return;
Change to
   char spinner[4] = {'/','-','\','|'};  //added Spinner characters
	
   if (recursionLevel <= 0) return;

   // Because there is no easy way to determine the number of times that
   // generateQuadrant will be called for any chunk, this spinner will
   // satisfy the user that the function is still running.
   // Because generateQuadrant can be called hundreds of thousands of times,
   // I am attempting here to just have it print during the top two levels of 
   // recursion.
   if( recursionLevel > (mRootChunkLevel*2)-2)   //added generateQuadrant is called with mRootChunkLevel*2
		dPrintf("\b%c", spinner[(gChunkGenStats.spin_count++)&3]); //added Print the spinner
#2
04/28/2006 (2:23 am)
Oooppsss... I missed this post.

1) I know some people are working to do this with Gimp. I'm also working on this for HTC.
2) I Don't know
3) HTC+ (Coming soon)
4) Yes... You have to increase your error metrics (I set it to 6). But I can't process bigger terrains due to JPEG Library bug. (I didn't try with MS3)
5) I Don't know
6) Really cool, I'm going to try this. Thank you.
#3
04/28/2006 (11:50 am)
Vincent, thank you for your reply, I really appreciate it.

1) I read somewhere that Gimp does not load 16-bit RAW images so I have not spent
any time look at it, but I
#4
04/28/2006 (12:01 pm)
1) cool, but very long process.. RAW reading for Gimp is not yet implemented. I read somewhere (don't remember where) that someone is working on. I'm trying to do be able to adjust heightField with mouse in HTC (Dev is very hard for this)

4) I think it's JPG Library bug. When I try to write a JPG file larger that 8192x8192, TSE crash. (I didn't try to read such filesize). but you can create chunk file larger than 8193x8193... You just have to increase Error metrics parameters.

6) Of course, you'll be the first informed ;)

Thanks again for the code.
#5
05/11/2006 (6:03 am)
Paint Shop Pro reads raw files OK
#6
06/02/2006 (10:50 am)
Im constantly surprised at how such a simple tool can be so effective and I'm glad
the GUI is a great help.

I planned on doing a lot more on the Atlas side of things like adding progress indicators to
the GUI, etc but have been focusing on the isometric stuff im writing for TGB and have not had time to poke around more with Atlas.

I will take a look at it once I get a chance.

~neo
#7
06/09/2006 (1:15 pm)
Neo, Have you considered changing the your GUI so that someone could select a number of terrain or texture files and batch process them using the same parameters?
#8
06/09/2006 (7:54 pm)
@doug:
I sure have thought of it ;p

Basic idea was to be able to save settings as profiles and then being able to select a profile
from a drop down which would auto fill the settings.

I also thought of having projects or batches which you could save to rerun later
(as it gets pretty tedious putting in everything over and over).

As I've been busy with other things I just haven't needed it yet, although I'm sure others do.

Hmm... its 4am here (I start early;), so maybe I'll play with it now before starting my day on the other
stuff I'm working on.

~neo