TSE: Atlas terrain import GUI
by Neo Binedell · 07/12/2005 (11:35 pm) · 52 comments
Download Code File
Playing around with generating atlas terrain from L3DT heightfields and textures I got fed up with having
to type in everything everytime so I created a quick little GUI for it. I also added a new file
load dialog gui as the stock dialog does not allow for directory selection, etc.
Unzip the file into your "tse/examples" directory.
The files sit in a seperate dir in "examples/common/ui/nx" so it wont overwrite anything.
All you need to do then is to add the following lines to "examples/common/client/canvas.cs"
right after the "Common Gui's" execs and it will be part of your default setup and can be used just
like any other default guis:
Then to access it just press CTRL + F12 and it will pop up the gui to ease the pain of
terrain generation ;p
I'll add progress display etc, in the future
Hopefully this will help the multitude I've seen in the forums who have trouble with this...
[update - 2006-03-07]
Added button to calculate leaf size for textures automatically.
[/update]
~ neo
Playing around with generating atlas terrain from L3DT heightfields and textures I got fed up with having
to type in everything everytime so I created a quick little GUI for it. I also added a new file
load dialog gui as the stock dialog does not allow for directory selection, etc.
Unzip the file into your "tse/examples" directory.
The files sit in a seperate dir in "examples/common/ui/nx" so it wont overwrite anything.
All you need to do then is to add the following lines to "examples/common/client/canvas.cs"
right after the "Common Gui's" execs and it will be part of your default setup and can be used just
like any other default guis:
...
//
// NX extensions
//
exec("~/ui/nx/NXInit.cs");
...Then to access it just press CTRL + F12 and it will pop up the gui to ease the pain of
terrain generation ;p
I'll add progress display etc, in the future
Hopefully this will help the multitude I've seen in the forums who have trouble with this...
[update - 2006-03-07]
Added button to calculate leaf size for textures automatically.
[/update]
~ neo
#3
08/06/2005 (12:23 am)
Great resource, thanks :)
#4
TSE goes to "not responding" every time I try to generate a chunk file from a L3DT .raw file whether I'm typing it in to the command prompt or the GUI above.
This is what I'm seeing in the log:
It stops at the same place when I type in
generateChunkFileFromRaw16("fps/data/terrains/mini.raw", 256, 10.0, 1.0 / 1.0, "fps/data/terrains/mini.chu", 4.0, 4);
NX::AtlasCreateDlg: running terrain import
Generating chunked geometry (depth=4, baseMaxError=4.000000)
o Calculating activation levels...
- done.
o Propagating activation levels...
- done.
o Writing file header...
- done.
o Generating empty TOC...
- done.
Am I just being impatient, or are my numbers off. I've noticed that the heightmaps generated by L3DT are sized in even numbers while terragen uses numbers like 257, 513, etc. But I have no idea where I might be going wrong.
Give me a gentle push down the right flight of stairs, please.
08/23/2005 (6:56 pm)
I love the GUI but I'm still having problems.TSE goes to "not responding" every time I try to generate a chunk file from a L3DT .raw file whether I'm typing it in to the command prompt or the GUI above.
This is what I'm seeing in the log:
It stops at the same place when I type in
generateChunkFileFromRaw16("fps/data/terrains/mini.raw", 256, 10.0, 1.0 / 1.0, "fps/data/terrains/mini.chu", 4.0, 4);
NX::AtlasCreateDlg: running terrain import
Generating chunked geometry (depth=4, baseMaxError=4.000000)
o Calculating activation levels...
- done.
o Propagating activation levels...
- done.
o Writing file header...
- done.
o Generating empty TOC...
- done.
Am I just being impatient, or are my numbers off. I've noticed that the heightmaps generated by L3DT are sized in even numbers while terragen uses numbers like 257, 513, etc. But I have no idea where I might be going wrong.
Give me a gentle push down the right flight of stairs, please.
#5
Check my posts lower down as you can now use the range directly, no need for this anymore!
[/EDIT]
damn it it just swallowed me post ;f
again:
First some tips for L3DT:
1) To get 257 (or whatever custom sizes) first generate your heightfield as usual then on your heightfield menu select "resample map" and enter the size you want.
2) To get the vertical scale open up the L3DT viewer, load up your map and then select "view/Map Group Tree View". Select "height field" in the tree list on the left and note the scale used.
As for your chunk gen stuff:
1) 1.0 / 1.0 == 1.0 so you basically have no scale and will be working with the full -32K to +32K range. For a 256 x 256 map this is TALL! ;p
When I changed this to a vertical scale of 0.0068 (from the L3DT viewer) it worked fine and took about 7 seconds to finish.
Hope that answers your questions.
~neo
08/24/2005 (7:55 am)
[EDIT] Check my posts lower down as you can now use the range directly, no need for this anymore!
[/EDIT]
damn it it just swallowed me post ;f
again:
First some tips for L3DT:
1) To get 257 (or whatever custom sizes) first generate your heightfield as usual then on your heightfield menu select "resample map" and enter the size you want.
2) To get the vertical scale open up the L3DT viewer, load up your map and then select "view/Map Group Tree View". Select "height field" in the tree list on the left and note the scale used.
As for your chunk gen stuff:
1) 1.0 / 1.0 == 1.0 so you basically have no scale and will be working with the full -32K to +32K range. For a 256 x 256 map this is TALL! ;p
When I changed this to a vertical scale of 0.0068 (from the L3DT viewer) it worked fine and took about 7 seconds to finish.
Hope that answers your questions.
~neo
#6
09/09/2005 (7:51 pm)
Nice resource!
#7
I am having trouble getting my sizet right in the import interface. I am trying to import a L3DT terr and info is:
X 16 Y 16
heithfield resolution is (m) 20
20x20 lilometres
TX map at 4096
square size is 2 and I was going to use hightscale of 0.0326 (I think is right) taken from L3DT viewer virtical scale.
Tree depth of 6
Error inetric of 2
dateset of 64
But for some reason I dont have a clue as to what my size is? I thought it would be 1024x1024 but is gives me a error message saying:
size must be a integer of >0 and a power of 2. So what am I doing wrong may I ask? I am missing something I know.
Also I am having trouble getting my leaf depth when trying to bring in the texture for the terrain.
I brought the TX in at 4096 with a (size of 2) and a (tree depth of 6), but I can't seem to figure out how to get my leaf depth.
How do I get that number? I have read a number of Tutorials on this and none talk about the leafe depth at all that I could find except here. I downloaded the new importer but it doesn't seem to automatically generate my leaf depth like the posts suggest it would. Did I do something wrong? My artist is having a tizzy since he can't get his terrain into TSE.
Shon
02/12/2006 (7:18 am)
Hi ,I am having trouble getting my sizet right in the import interface. I am trying to import a L3DT terr and info is:
X 16 Y 16
heithfield resolution is (m) 20
20x20 lilometres
TX map at 4096
square size is 2 and I was going to use hightscale of 0.0326 (I think is right) taken from L3DT viewer virtical scale.
Tree depth of 6
Error inetric of 2
dateset of 64
But for some reason I dont have a clue as to what my size is? I thought it would be 1024x1024 but is gives me a error message saying:
size must be a integer of >0 and a power of 2. So what am I doing wrong may I ask? I am missing something I know.
Also I am having trouble getting my leaf depth when trying to bring in the texture for the terrain.
I brought the TX in at 4096 with a (size of 2) and a (tree depth of 6), but I can't seem to figure out how to get my leaf depth.
How do I get that number? I have read a number of Tutorials on this and none talk about the leafe depth at all that I could find except here. I downloaded the new importer but it doesn't seem to automatically generate my leaf depth like the posts suggest it would. Did I do something wrong? My artist is having a tizzy since he can't get his terrain into TSE.
Shon
#8
Shon
02/12/2006 (7:25 am)
I am looking at the download and I have noticed that the download does not seem to reflect the new post with the new importer for L3DT terrains. Is it possible to get the new link to the new nsatlasqui? Because from the post at L3DT the other day, we got the impression that there was a newer build somewhare with the fixes with auto leaf generator.Shon
#9
I will have a look at it tomorrow sometime and perhaps even add some new features, etc.
edit: calc leafsize added, see above
~neo
03/07/2006 (8:14 am)
Hmmm... that's weird...I will have a look at it tomorrow sometime and perhaps even add some new features, etc.
edit: calc leafsize added, see above
~neo
#10
%scale = %range / 65536;
So this was taking my range number of 0.003... and dividing it more, all my terrains were coming out pretty flat, and giving me like 1 vert/chunk. When I noticed this and used a number like 10 in the Height Range, I can finally see terrain and get more than 1 vert/chunk.
How is the height range field *supposed* to be used, to get some WYSIWYG terrain?
03/17/2006 (12:08 pm)
neo, I tried using this gui several times, then noticed this:%scale = %range / 65536;
So this was taking my range number of 0.003... and dividing it more, all my terrains were coming out pretty flat, and giving me like 1 vert/chunk. When I noticed this and used a number like 10 in the Height Range, I can finally see terrain and get more than 1 vert/chunk.
How is the height range field *supposed* to be used, to get some WYSIWYG terrain?
#11
It is the range in meters that your terrain uses, i.e. distance between the lowest
and highest point, which you can find in your heightfield settings (i.e. vertical scale).
I think it is a lot more intuitive and natural to use that way and you don't even
have to think about all the floating point nonsense.
Sorry if it was confusing.
~neo
03/17/2006 (5:09 pm)
@Dave: I changed it to use the height range to make things easier.It is the range in meters that your terrain uses, i.e. distance between the lowest
and highest point, which you can find in your heightfield settings (i.e. vertical scale).
I think it is a lot more intuitive and natural to use that way and you don't even
have to think about all the floating point nonsense.
Sorry if it was confusing.
~neo
#12
This really helps the process tremendously!
03/18/2006 (4:47 am)
So if, in range, it goes from -200m to +400m, the range is 600? I tried something close and it seems to work OK. It is more intuitive!This really helps the process tremendously!
#13
Happy you are getting along ;p
~neo
03/18/2006 (6:09 am)
Yup you are correct, the range is 600. You can see it on the height map menu in L3DT.Happy you are getting along ;p
~neo
#14
Thanx!
05/25/2006 (6:42 am)
Help!!! Downloaded the file linked at the top of the page and the file NXAtlasCreateDlg.gui is totally gugged. It is not complete and I don't know where to get the right one. I downloaded this yesterday.Thanx!
#15
What exactly is the problem, perhaps I can help you sort it out?
~neo
05/25/2006 (7:04 am)
@Shon: I just downloaded it from here and it worked fine, no problemo...What exactly is the problem, perhaps I can help you sort it out?
~neo
#16
I'll try the download again and see if that is the problem. You know slomodem to wherever.
//==============================================================================
//
// Atlas terrain import GUI
//
// Author: Neo Binedell
// Version: 1.0
// Date: 2005-07-12
// Description: Quick and simple GUI to ease the pain of importing atlas
// terrain files and textures.
//
// Todo:
// * add progress update to generateChunk() and generateTQT()
// * add profile saving of settings
// * add widgets to simplify relationships (e.g. ErrorMetric and TreeDepth,etc)
// * add preview statistics
//
//==============================================================================
//--- OBJECT WRITE BEGIN ---
new GuiControl(NXAtlasCreateDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "319 332";
minExtent = "8 2";
visible = "1";
text = "TSE - Atlas Terrain Import";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "0";
minSize = "50 50";
closeCommand = "NXAtlasCreateDlg.close();";
new GuiWindowCtrl(nxATCDMeshPane) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 52";
extent = "293 237";
minExtent = "8 2";
visible = "1";
text = "Import terrain mesh";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "0";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
locked = "false";
new GuiTextEditCtrl(nxATMIInputFile) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 54";
extent = "243 18";
minExtent = "8 2";
visible = "1";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
};
new GuiButtonCtrl(nxATMIInputFileBtn) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "262 53";
extent = "21 21";
minExtent = "8 2";
visible = "1";
command = "NXAtlasCreateDlg.getInputFile();";
text = "...";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiTextEditCtrl(nxATMIOutputFile) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 94";
extent = "241
05/25/2006 (8:09 am)
I'm sorry neo I should have been more specific. All I get in the .zip is this for the NXAtlasCreateDlg.gui file.I'll try the download again and see if that is the problem. You know slomodem to wherever.
//==============================================================================
//
// Atlas terrain import GUI
//
// Author: Neo Binedell
// Version: 1.0
// Date: 2005-07-12
// Description: Quick and simple GUI to ease the pain of importing atlas
// terrain files and textures.
//
// Todo:
// * add progress update to generateChunk() and generateTQT()
// * add profile saving of settings
// * add widgets to simplify relationships (e.g. ErrorMetric and TreeDepth,etc)
// * add preview statistics
//
//==============================================================================
//--- OBJECT WRITE BEGIN ---
new GuiControl(NXAtlasCreateDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "319 332";
minExtent = "8 2";
visible = "1";
text = "TSE - Atlas Terrain Import";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "1";
canMaximize = "0";
minSize = "50 50";
closeCommand = "NXAtlasCreateDlg.close();";
new GuiWindowCtrl(nxATCDMeshPane) {
profile = "GuiWindowProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "10 52";
extent = "293 237";
minExtent = "8 2";
visible = "1";
text = "Import terrain mesh";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "0";
canClose = "0";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
locked = "false";
new GuiTextEditCtrl(nxATMIInputFile) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 54";
extent = "243 18";
minExtent = "8 2";
visible = "1";
maxLength = "255";
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
};
new GuiButtonCtrl(nxATMIInputFileBtn) {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "262 53";
extent = "21 21";
minExtent = "8 2";
visible = "1";
command = "NXAtlasCreateDlg.getInputFile();";
text = "...";
groupNum = "-1";
buttonType = "PushButton";
};
new GuiTextEditCtrl(nxATMIOutputFile) {
profile = "GuiTextEditProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "13 94";
extent = "241
#17
Shon
05/25/2006 (8:12 am)
Hoooo just re-downloaded it and it came across fine. slomodem to the clouds it seems. Thanks for the quick response as our artist Maylock has been working feverishly on terrains using L3DT and we want to get them easily into TSE. So thanks for your awesome work. Greatly appreciated.Shon
#18
Thanks again
05/25/2006 (8:19 am)
Nope checked it out again and it uncompressed exactly the same. I thought the file was good because it was 17K in size, but I have 13K of garbage at the end of the extent = "241 as shown above above. So I don't know what it is.Thanks again
#19
Are you on a Mac or Linux?
Perhaps I can mail it to you and we can see if it is simply a download issue?
~neo
05/25/2006 (8:41 am)
That is weird.Are you on a Mac or Linux?
Perhaps I can mail it to you and we can see if it is simply a download issue?
~neo

Torque Owner Chris E.
Default Studio Name