I’m working on a planet-scale project for a D&D game and realized I can achieve much of what I need by creating a set of heightmaps in L3DT and then loading them into TG2 as the basis for my terrain. TG2’s ability to add fractal detail and perform photorealistic rendering will provide all I need for the game.
L3DT lets you generate very large heightmaps by working on one part at a time in memory and writing the other parts out to disk as a tile set. These individual tiles can then be mapped in to TG2 with one Heightfield Shader per tile.
The trouble is, if you have a significant number of tiles, it’s pretty tedious to setup the TG2 nodes correctly. Since I don’t like tedium and I can program, I went ahead and wrote a quick-and-dirty utility to create a TDG appropriate for the L3DT tile set in question. This post walks through how to use that utility.
TiledTG2 Utility Program
The program is available here. There’s no setup. Just unzip the folder containing the program and the file World.ttgd somewhere convenient (e.g. your desktop) and run TiledTG2.exe. You can also download the C# source code.
I will be updating this program from time-to-time as my project moves along. One option I’ll most likely add early on is the ability to specify one tile to be loaded in TG2 at full resolution, with the other tiles are loaded at a lower resolution. That would be useful if you’re doing an animation that begins high up and moves down to a close-up scene in a specific tile.
Creating Tiled Heightmap in L3DT
Start with a new project
Accept the default:
In this example, I’m creating a heightmap with a total size of 4096×4096, consisting of a 2×2 tile matrix with each tile 2048×2048. L3DT can create a tile set as large as 131,072×131,072. From what I have seen, such a large tile set will take a very long time to calculate. NOTE: The PRO version is needed to create a tile set. There’s a 90 day trial (which I’m using 🙂 )
Accept the defaults on the next screen
Feel free to tweak parameters on this screen, or just accept defaults:
Next generate the Design Map:
Save the project when prompted.
The resulting Design Map can then be edited. This is one of the main features that make L3DT great for my purposes… I can easily tweak the map at a very high level to resemble the game world my group has been adventuring in for years. Your map may look something like this:
Next kick off the Heightfield and Texture Map using the Calculation Wizard
You must select the Attribute Map in order to also select the Texture Map
The TiledTG2 utility will overlay the Texture Map on the Heightfield to give you a head start with terrain coloration.
The defaults for the Attribute Map screen are fine
Uncheck Use Light Map on the following screen to save some calculation time
Enjoy the nicely animated progress screen while the heightmap is generated
You will eventually end up with a heightmap something like this:
And a texture map as well:
There’s a ton of flexibility in L3DT to both modify how the maps are generated and to edit them after the fact. I won’t go into the details here, but there’s plenty of information on their website.
Now to export the files to a tile set that can be used in TG2.
Select the Heightfield tab and press Ctrl-E (Export the current tab). Select the checkbox Split map into tiles (mosaic map). Pick a filename to save under.
If necessary change the export format to TER files (I changed it permanently for me in the L3DT options menu)
Rinse and repeat for the Texture map (switch to the Texture map tab then press Ctrl-E)
The default settings on the next tab work fine
Just unzip the TiledTG2 folder somewhere convenient (e.g. your desktop) and run TiledTG2.exe.
I keep all of my TG2 stuff on a Q: drive. You probably have your files elsewhere, so you’ll have to edit those paths. I do plan to have the program remember the last settings in an upcoming version.
World.ttgd serves as a template for generating the TGD file (the extra “t” stands for template). There’s nothing magical about that file… I just started with a simple TGD that works for my purposes and added a placeholder node called <L3DT />. My template has an extra planet that serves as the ocean, with a radius 1000 meters larger than the actual planet. You can edit it with a standard text editor if you’re reasonably fluent with XML.
The Heightmap Prefix and Texture map Prefix refer to how you named the tile files when exporting from L3DT. In the walkthrough above, the Heightmap Prefix needs to be Q:\Terragen 2\Tutorial\Heightfield since that’s how I named the tiles when exporting. Texture map Prefix would need to be Q:\Terragen 2\Tutorial\Texture (again, because that’s how I happened to name the files when exporting from L3DT).
Viewing the Result in TG2
Just open up Gen.tgd in TG2 to see the result. In this example I edited both the terrain and the texture to indicate the tile number.
Here’s a shot a bit closer up: