Game Development Community

Terrain .ter files

by Kevin R. · in Torque X 2D · 11/30/2007 (2:54 pm) · 13 replies

What's the best software too lto use that creates .ter files? That support TorqueX (TGE Version 4) format.

#1
11/30/2007 (8:32 pm)
Id like to know this as well. I checked out the XTerrain class and it looks like it supports .ter, 16 bit .raw heightmaps, autogenerated terrains (not sure what this is yet), and a chunked LOD format (not sure what that is either, I am still learning). I have heard a lot about 3d world studio , but heard it makes .dif or something, which one of the employees said TorqueX wont support. Looking forward to some replies.
#2
12/01/2007 (12:27 am)
I've tried BundySoft: L3DT Professional and Terragen. None of them were able to export in the format required by TorqueX...
#3
12/01/2007 (12:53 am)
In my opinion, the easiest way to sculpt a terrain for Torque X is to use the the TGEA Editor that comes bundled with Torque X. The process is a little rough right now. You need to copy the TGEA.exe and TGEEditor folder from your install directory (for me its: C:\Program Files\GarageGames\Torque X Pro\v1.5.0.0\Tools\TGEA Editor) into your project directory Game... so that TGEA.exe and TGEEditor folder are side-by-side with Game.csproj, Game.cs, and the data folder.

Next, start the TGEA.exe file, select Window > Terrain Terraform Editor and set the brush properties as you like using Brush and Action menu items. Pan around with right-click drag and WASD to fly around. Basically, all the techniques you would use to sculpt and paint a TGE(A) terrain.

John K.
#4
12/01/2007 (10:51 am)
@John

They said in the L3DT document they could export to a 16 bit .RAW format, and the XTerrain object looks like it supports it. I think one of the GG employees also said you just needed to modify the level data to get it into a level loaded by sceneloader. Is there any advantage or disadvantage to going that route?
#5
12/01/2007 (11:25 am)
Dave, you're definitely right about that. L3DT creates really nice terrain, but I think there's more work involved... thinking back to TGEA. I'll try running through this process with Torque X. It should be a simple matter of creating the raw files in L3DT and then changing the .txscene file to specify RAWTerrainData instead of TGETerrainData. I'll take a few minutest to test it out.

John K.
#6
12/01/2007 (11:34 am)
Awesome john, looking forward to your results!
#7
12/01/2007 (12:27 pm)
Okay, here's a quick break down of bringing L3DT terrain into a Torque X scene. This doesn't create a 'great looking' terrain, but it walks you through the steps. I'm working with L3DT 2.5a.

www.envygames.com/share/torquex3d_l3dt_2.jpg
1. Create the terrain in L3DT using the Design/inflate steps
* X,Y = 16
* Heightfield Resolution = 10
* Do not use disk paging (mosiac)
* Be sure to enable Edge Wrapping
* Play with the rest of the settings and create your Terrain
* Be sure to create the texture map, but do do not use paging (mosiac)

2. When the terrain is completed, save the project
* Save the project in your data/terrains folder as l3dt_generated
* Save all maps

3. Export the Raw file
* Select File + Export + Export map...
* Select heightfield
* Select file format as Raw
* Save the file in the data/terrains folder as l3dt_generated.raw
* Do not resize the file by 1 or flip the heightmap as formerly done with TGEA

4. Update the .txscene file by removing the old terrain definition and adding this:
<Terrain type="GarageGames.Torque.T3D.XTerrain" name="Terrain">
  <HorizontalScale>8</HorizontalScale>
  <VerticalScale>1</VerticalScale>
  <LevelZeroError>0</LevelZeroError>
  <ViewError>2</ViewError>
  <LODLevels>4</LODLevels>
  <LODError>0.5</LODError>
  <Repeat>true</Repeat>
  <Data type="GarageGames.Torque.T3D.RAWTerrainData">
	  <TerrainFilename>data/terrains/l3dt_generated.raw</TerrainFilename>
	  <LightMapFilename>data/terrains/l3dt_generated_LM.jpg</LightMapFilename>
	  <UniqueTextureFilename>data/terrains/l3dt_generated_TX.jpg</UniqueTextureFilename>
  </Data>
  <Visible>true</Visible>
</Terrain>

5. Update your Game Studio Express project
* Add the raw/texture/lightmaps to the solution under the data/terrains folder
* Be sure to set properties to Copy Always

6. You might want to have a greater view distance, so try changing the camera properties from:
<CameraComponent type="GarageGames.Torque.T3D.FreeCameraComponent" name="CameraComponent"/>
to:
<CameraComponent type="GarageGames.Torque.T3D.FreeCameraComponent" name="CameraComponent">
	  <FarDistance>4096</FarDistance>
</CameraComponent>

That should do it, build and run.

John K.
#8
12/01/2007 (2:09 pm)
Thats pretty slick! I just purchased the L3DT Professional Indie, and will give it a try as soon as I get it! Do you know if there is an editor to place our objects on there, or is that something we have to do manually through code and/or XMl in the txscene? Thanks for the instructions above, I am looking forward to testing it out!
#9
12/01/2007 (3:43 pm)
As far as I know, L3DT does not have a mechanism to place objects, only to create the terrain. I would probably use the TGE(A) editor I described above to actually place the game objects into their approximate positions and then save as a .mis mission file. Then, use the ConvertTGEMis program to generate the .txscene XML file from the mission file. Finally, you can tweak the positions of each scene object directly within the .txscene XML.

As a long shot (untested) you can probably take the same L3DT RAW file and pull it through the Atlas Terrain Import process and add it to the TGEA mission editor. At least then, you can start positioning objects in more accurate positions, requiring less tweaking. I might give this process a try later tonight.

Good Luck,

John K.
#10
12/03/2007 (3:44 pm)
John,

Thanks
The onlything I might add would be

witha nice detail texture!
#11
03/15/2008 (6:47 am)
When I try the above steps I get the following error:

The operation was aborted. You may not modify a resource that has been set on a device, or after it has been used within a tiling bracket.

File: ClipMapUniqueImageCache.cs (default - unmodified)
Line: 160

public void DoRectUpdate(...)
{
...
..
.

// replace the specified rect of texture data on the texture
stackEntry.Texture.SetData<uint>(0, dstTextureRect, dstData, 0, elementCount, SetDataOptions.Discard);
}

I get the same error when I try to use the (GeneratedTerrainData) class... I must be missing something.

<Data type="GarageGames.Torque.T3D.GeneratedTerrainData">
    <LightMapFilename>data/levels/landscape_ht.jpg</LightMapFilename>
    <TexturePathSubstitution>data/levels/</TexturePathSubstitution>
    <CheckPropagation>true</CheckPropagation>
    <UseDebugImageCache>false</UseDebugImageCache>
    <GridSize>129</GridSize>
    <Size>129</Size>
    <UniqueTextureFilename>data/levels/landscape_tx.jpg</UniqueTextureFilename>
</Data>
#12
03/17/2008 (5:01 pm)
Okay, I there's a developer of the L3DT that is willing to make an export plugin, that will export the correct .ter file extension format of the maps for torquex. Where can I get format specifications for the version 4 ter format??

Quote:The TER files used by L3DT are the Terragen terrain file format, not the Torque terrain file format. If you can point me in the direction of the Torque TER file format specification, I can probably write an export plugin for it.

Best regards,
Aaron.
#13
04/13/2009 (3:12 pm)
Quote:I would probably use the TGE(A) editor I described above to actually place the game objects into their approximate positions and then save as a .mis mission file. Then, use the ConvertTGEMis program to generate the .txscene XML file from the mission file.

Where can we find this ConvertTGEMis program?