Carving Out a Road/Track from Atlas
by John Kanalakis · in Torque Game Engine Advanced · 06/27/2006 (10:53 am) · 3 replies
In the absence of Atlas terrain painting and shaping tools, we've been pretty creative with Photoshop. Here is a method for creating roads or dirt paths, such as the one pictured below.

For starters, we created the source files in L3DT: a 512KB Greyscale Heightmap in .RAW format and a 2048 Color Texturemap in JPEG format. Our texture map is intentionally 4x larger than the heightmap in order to show greater texture resolution.
CREATING THE ROAD
1. Load the .RAW file into Photoshop.

2. Create a new Layer (Layer->New Layer) for the file, named Road
3. Select the Brush tool (or press B)
4. Set the brush size as you need it (start with 16 pixels for now) and 100% pressure - the higher the pixel size of the brush, the wider the road will be. Also, be sure to set the brush to solid Black
5. Select the Pen tool (or press P) and select 'Paths' from the options (not 'shape layers')
6. On the Road layer, start dropping points along your road path
7. After all the anchor points are plotted, right mouse click on the path
8. Select 'Stroke Path' from the popup window and choose the Brush tool

9. With the Road layer selected reduce it's layer opacity to 8% - the higher the opacity, the deeper the road will sink into the terrain.
10. Finally, save the .raw file back to disk and convert it to .chu (Dont close this file yet...)
My settings...
generateChunkFileFromRaw16("atlasconv/cool.raw", 512, 5.0, 1.0 / 256.0, "game/data/terrains/cool.chu", 2.0,5);
(NOTE) Instead of using the Pen tool, you can certainly use the Brush too and free-hand draw the road... you just need a steady hand on the mouse to avoid getting jagged roads.
PAINTING THE ROAD
At this point, the heightmap has a road or path embedded into it. When it loads on screen, it should look like the path was dug out of the existing terrain. By the way, you should be able to have a raised path too, if you prefer. Just set the brush to solid white instead of black. Anyway, the next step is to paint the texture on to the terrain.
1. From within the modified RAW file... Hide the Background base layer

2. Return the Road layer opacity back to 100%
3. Resize the .RAW image to match your texture map (in my case 2048x2048)
4. select the Road layer, right-click the mouse, and choose 'Duplicate Layer...'
5. In the Duplicate Layer dialog box, choose your open texture map as the Destination Document
For Textured Roads...
6. Now that the road appears overlapped within your texture map, select the Paint tool (or press G), select the Fill mode to 'Pattern' and choose a pattern from your pattern list... ideally a nice looking gravel texture or some sort of natural terrain texture.
For Dirt Paths...
6. Select the Paint tool (or press G) and choose the Foreground Fill mode. Set the foreground color to a strong yellow and reduce the Road opacity layer to about 10-15%
7. Finally, click the Paint Bucket Tool anywhere along the track to fill it in.

8. That's it. Save the texturemap file and you're ready to convert it to .tqt
My settings...
generateTQT("atlasconv/cool.jpg", "game/data/terrains/cool.tqt", 5, 128);
Keep in mind that the depth and width of your road will depend entirely upon the settings you use when performing the .raw to .chu conversion. If you find that the road is too deep or too wide, you can play with the bush thickness and layer opacity to correct it. Here's a look at the results of this tutorial.

For starters, we created the source files in L3DT: a 512KB Greyscale Heightmap in .RAW format and a 2048 Color Texturemap in JPEG format. Our texture map is intentionally 4x larger than the heightmap in order to show greater texture resolution.
CREATING THE ROAD
1. Load the .RAW file into Photoshop.

2. Create a new Layer (Layer->New Layer) for the file, named Road
3. Select the Brush tool (or press B)
4. Set the brush size as you need it (start with 16 pixels for now) and 100% pressure - the higher the pixel size of the brush, the wider the road will be. Also, be sure to set the brush to solid Black
5. Select the Pen tool (or press P) and select 'Paths' from the options (not 'shape layers')
6. On the Road layer, start dropping points along your road path
7. After all the anchor points are plotted, right mouse click on the path
8. Select 'Stroke Path' from the popup window and choose the Brush tool

9. With the Road layer selected reduce it's layer opacity to 8% - the higher the opacity, the deeper the road will sink into the terrain.
10. Finally, save the .raw file back to disk and convert it to .chu (Dont close this file yet...)
My settings...
generateChunkFileFromRaw16("atlasconv/cool.raw", 512, 5.0, 1.0 / 256.0, "game/data/terrains/cool.chu", 2.0,5);
(NOTE) Instead of using the Pen tool, you can certainly use the Brush too and free-hand draw the road... you just need a steady hand on the mouse to avoid getting jagged roads.
PAINTING THE ROAD
At this point, the heightmap has a road or path embedded into it. When it loads on screen, it should look like the path was dug out of the existing terrain. By the way, you should be able to have a raised path too, if you prefer. Just set the brush to solid white instead of black. Anyway, the next step is to paint the texture on to the terrain.
1. From within the modified RAW file... Hide the Background base layer

2. Return the Road layer opacity back to 100%
3. Resize the .RAW image to match your texture map (in my case 2048x2048)
4. select the Road layer, right-click the mouse, and choose 'Duplicate Layer...'
5. In the Duplicate Layer dialog box, choose your open texture map as the Destination Document
For Textured Roads...
6. Now that the road appears overlapped within your texture map, select the Paint tool (or press G), select the Fill mode to 'Pattern' and choose a pattern from your pattern list... ideally a nice looking gravel texture or some sort of natural terrain texture.
For Dirt Paths...
6. Select the Paint tool (or press G) and choose the Foreground Fill mode. Set the foreground color to a strong yellow and reduce the Road opacity layer to about 10-15%
7. Finally, click the Paint Bucket Tool anywhere along the track to fill it in.

8. That's it. Save the texturemap file and you're ready to convert it to .tqt
My settings...
generateTQT("atlasconv/cool.jpg", "game/data/terrains/cool.tqt", 5, 128);
Keep in mind that the depth and width of your road will depend entirely upon the settings you use when performing the .raw to .chu conversion. If you find that the road is too deep or too wide, you can play with the bush thickness and layer opacity to correct it. Here's a look at the results of this tutorial.
About the author
John Kanalakis is the owner of EnvyGames, an independent game development studio in Silicon Valley that produces games and tools for Xbox 360, Windows, and the Web.
#2
06/27/2006 (1:13 pm)
Anyone willing/interested in posting this up on TDN as a resource we would all be greatly appreciative...hell, I'll buy you a beer or two at IGC if you are coming :)
#3
John K.
06/27/2006 (3:10 pm)
I've just posted a quick write up about this on the TDN site... See you at IGC.John K.
Torque Owner Bryan Stroebel