Game Development Community

Terrain Block Variables?

by Ken Searle · in Torque Game Engine · 10/20/2004 (3:22 pm) · 13 replies

I have a map that is about 1.5 to 2 miles square (based upon real topography). I have been able to load it into the terrain editor but it is scaled to about 1 mile square. If I can scale the terrain to the real size then my objects will fit nicely in it.

I see there are several variables under Terrain Block that might expand the terrain scale but I am not certain of the difference between them.

Scale 1 1 1
squareSize 8
position -1024 -1024 0

I thought that changing the scale to 2 2 2 would double the terrain but did not notice any change. I then changed the sqaureSize up to 16 and that seemed to increase the terrain scale but I am not sure what this variable is really used for. I also suspect that changing the scale might require changing the position? If I can double the scale, I can adjust my map to fit in that area

Anyone know what these variables above are really meant for?

If anyone knows where there is a specific document explaning what each of the editor variable does please let me know as that will save me from bothering anyone else.

#1
10/20/2004 (5:01 pm)
Position and scale are just that, they don't enable you to get an image size larger than 256 into the terrain block. Square size doesn't either, and as far as I know, it's sort of like another kind of scaling factor.

If you want bigger than 256x256, then you have to modify code, but it's a monster to do. There were already tries with the Terrain Manager(do a search, you'll find plenty of threads), though that didn't get completed, but the TSE will have a much improved terrain system in it(allowing for larger terrains, and some other features as well). Hope that helps.
#2
10/20/2004 (5:20 pm)
Thanks Ted but I think you misunderstood my issue a little. I am not looking to change the map image from 256x256 pixels, but rather the distance it represents inside the engine.

Changing the scale from 1 1 1 to 2 2 2 did not appear to do anything unless I have to exit and re-load the mission or the whole program?

Increasing the squareSize from 8 to 16 does immediately "Apply" changes to the terrain, but this did sound like the best method to use.
#3
10/20/2004 (6:09 pm)
Yes square size to 16 will double your terrain size, but however there is a considerable drop in detail (the space between verts is now double).
#4
10/20/2004 (8:36 pm)
Thanks Westy. That is the only approach I have found at the moment. Given the constraint of using the same 256x256 map image, I expect the vertexes will stretch to the new size.

If the squareSize increases the scale of the map then what does the Scale 1 1 1 command actually do?

That is what does not make sense to me.
#5
10/21/2004 (3:02 am)
Hey Ken, quick rundown here (4am and I need to sleep) of the terrain system:

Changing the squareSize isn't a bad way to go. By default, Torque uses a 256x256 heightfield map, as you know. With a square size of 8, and assuming that one world unit = 1 meter, that means you get 256 * 8 meters, or roughly 2 kilometers on each side of your terrain, for a total of 4 square kilometers. Now, that's just over 1.5 square miles, so it sounds like default TGE has what you need. :)

If that's not enough, you can tweak the squareSize, and yes, it does adjust the size of the terrain. If you raise the squareSize to 16 (and still keep your scale at 1 unit = 1 meter) then you get 256 * 16 meters, or about 4 kilometers for each side of the map, resulting in 16 square kilometers (over 6 square miles). Which is pretty big. The downside, as Westy points out and you already know, is that you are spreading the same number of data points over an apparently larger area, so you end up with less detailed-seeming terrain, at least when you're up close to it.

There used to be a problem when you mucked with the terrain squareSize and also had water in the level, but I think Rob may have fixed that (haven't checked recently). Anyway, if not, then the water relies on the terrain squareSize being 8, so you'd either have to fix that (probably nasty), or go a different route.

And a different route might be to just forget about the assumption where supposedly one world unit = 1 meter. You could, say, make 1 world unit be .5 meters instead. You'd then have to adjust your game objects (players, trees, buildings, etc) and your physics settings to compensate, but this would have just about the same effect as using a terrain squareSize of 16 instead of 8.

As for the terrain block's Scale property, I'm not sure exactly what it does, off the top of my head. Don't have time to test right now. :) You said you tried "2 2 2" for values there, did you by chance try "0.5 0.5 0.5" or something < 1 for each value? It might be clamped at 0 to 1.

For more detail on all this, Ben and Rob are the most knowledgable people on this system that I know of. I'm sure there are lots of community members who know tons about it too. I might be able to help more when I'm more awake too. :)
#6
10/21/2004 (4:40 am)
I can confirm that changing the SquareSize to either 12 or 4 doesn't break any water anywhere. Although changing to 4 will impact your performance by a few hundred percent, that's not what you wanted to do anyway.

I've fiddled with the scaling a few times but haven't noticed it changes anything.
#7
10/21/2004 (10:22 am)
Thanks Josh and everyone else for the explanations. A SquareSize of 16 seems to fit my exact size models the best at the moment so perhaps my actual terrain size is larger than I thought.

I had thought about scaling everything else down, but will ask about that in a different thread.

I think I have my answer. Change SquareSize 8 to scale the terrain and ignore Scale 1 1 1.
#8
10/21/2004 (10:26 am)
If you scale down the players too much you will get collision problems. Good luck with the terrain.
#9
10/21/2004 (11:09 am)
Thanks Stefan. It's good to know that if I decrease object scales I might run into other complexities and problems down the road. Translating everything to smaller scales seems tedious and counter-intuitive.

I think I will be better off in the long run keeping all my objects at the scale of 1 meter.

I have read that the new Torque Shader Engine allows arbitrary (larger?) maps so I will also look into that.
#10
10/21/2004 (11:16 am)
TSE terrain is a ways off from full-release, but yeah it's looking awesome already. Much larger terrains are possible.
#11
10/21/2004 (12:11 pm)
I just looked at the TSE Demo on my Brother's machine (I need a better video card). Interiors and Characters definititely look much better on TSE. The Demo was very short on showing exteriors, but overall it looks like it will be a good upgrade when it is completed.
#12
10/21/2004 (10:30 pm)
The TSE demo currently on the site doesn't show-off the new terrain system. :) There will be some that do so in the future though.
#13
10/22/2004 (12:16 am)
Thanks Josh. I look forward to seeing the new terrain system.