====== Part 2: Making a rough template ====== | [[tutorials:l3dt:roads|Road tutorial home]] | When making roads, I find it useful to follow a plan or //template//. This is basically an overhead (topographic) image showing where you want the road to go. Having a plan such as this will make it much easier to work out where to place the road when you're doing the digging in the 3D editor. This section of the tutorial explains how to import the template image from another program ([[#making_the_template_in_another program|jump]]) or make it directly in L3DT ([[#making_the_template_in_l3dt|jump]]), and how to apply the template to the 3D view in Sapphire ([[#using_the_template_in_sapphire|jump]]). If you can't be bothered to plan-out your road, please feel free to [[tutorials:l3dt:roads:add_road_to_HF|jump]] to the next page. ===== Making the template in another program ===== If you'd prefer to make your template image in another program, you can import this into L3DT using the '//File->Import->Custom map layer//' menu item, as shown below:
{{:tutorials:l3dt:roads:importcustommenu.png|:tutorials:l3dt:roads:importcustommenu.png}}
This will open the 'import custom map layer' dialog box, where you select the file to load, set the layer name (I suggest 'Road template') and select the image type (must be 'RGB'):
{{:tutorials:l3dt:roads:importcustomdlg.png|:tutorials:l3dt:roads:importcustomdlg.png}}
Once the image is imported, you're ready to proceed to the next stage. ===== Making the template in L3DT ===== To plan the road, I suggest creating a template image in L3DT. To do this, select the '//Utilities->New map layer//' menu option in L3DT:
| {{:tutorials:l3dt:roads:newmaplayermenu.png|:tutorials:l3dt:roads:newmaplayermenu.png}} | ^ The 'new map layer' menu item. ^
In the //new map layer// window, shown below, set the name to 'Road template' and select a map type of '24bit'. The default size of this new image layer is the same as the heightfield (521x512, in my case), which should be just fine for this purpose.
| {{:tutorials:l3dt:roads:newmaplayerdlg.png|:tutorials:l3dt:roads:newmaplayerdlg.png}} | ^ The 'new map layer' window. ^
When you click OK, L3DT will create your new blank map layer, and display it as a black screen. I suggest at this point that it may help to apply a semi-transparent overlay of the heightfield display on top of the template image. To do this, select the '//View->Image drape//' menu option, as below:
| {{:tutorials:l3dt:roads:imagedrapemenu.png|:tutorials:l3dt:roads:imagedrapemenu.png}} | ^ The 'image drape' menu item. ^
This will open the //image drape settings// window, shown below. In this dialog box, select the 'use project map' check-box, and select the 'HF' (heightfield) map in the drop list.
| {{:tutorials:l3dt:roads:imagedrapedlg.png|:tutorials:l3dt:roads:imagedrapedlg.png}} | ^ The 'image drape settings' window. ^
When you click OK, L3DT will display the image template with a 50% overlay of the heightfield display, showing the contour lines (see below). This will help in deciding where to plan our road. The image template is a simple RGB image, which we can edit using L3DT's //really simple// RGB brush tool. To open this brush, select the 'Edit' toolbar button (with the pencil icon), or select the '//Mouse tools->Edit active map//' menu option. This will open the brush tool window, shown below:
| {{:tutorials:l3dt:roads:hf2.png?450|:tutorials:l3dt:roads:hf2.png}} |
Using the brush tool I've painted a road (marked in grey) that joins three sides of the map. It's a //very good idea// to follow the contour lines of the terrain as far as possible, as this means the road won't be bumping up and down too much.
{{:tutorials:l3dt:roads:hf3.png?450|:tutorials:l3dt:roads:hf3.png}}
Another thing to note is that I've painted the background of the template as green, and also painted the areas below sea-level (on the dark side of the read line) as blue. This is was largely for artistic purposes, but as you'll see later in //Sapphire//, it does help to have a template image with a non-black background. To show you exactly what's in my template, I went back to the image drape dialog box and pressed the 'clear overlay' button. After doing this, L3DT showed the basic template without the heightfield overlay (shown below).
{{:tutorials:l3dt:roads:roadtemplate.png?450|:tutorials:l3dt:roads:roadtemplate.png}}
You'll notice that my template is a pretty basic drawing. There's really not much point in making the template too pretty, since it's not used for texturing or anything like that. Rather, it's there only as a guide when you're placing the roads with the bulldozer tool. Quick-n-nasty is good enough. ===== Using the template in Sapphire ===== To open //Sapphire//, select the '3D' button on the toolbar, or else select the '//Extensions->Sapphire->Open 3D renderer//' menu option. The result should look something like that shown below:
{{:tutorials:l3dt:roads:3d1.png?450|:tutorials:l3dt:roads:3d1.png}}
To apply our template image to the terrain in the 3D view, select the '//Options->Select texture//' menu option in Sapphire, as show below:
{{:tutorials:l3dt:roads:selecttexture.png|:tutorials:l3dt:roads:selecttexture.png}}
In the pop-up dialog box (shown below), select the 'Road template' option (or whatever it is that you called your template image.)
{{:tutorials:l3dt:roads:selecttexturedlg.png|:tutorials:l3dt:roads:selecttexturedlg.png}}
Once you click OK, Sapphire should update to display your template image draped over the terrain, as below:
{{:tutorials:l3dt:roads:3d2.png?450|:tutorials:l3dt:roads:3d2.png}}
If your terrain appears black now, it's probably because the background in your template image was left as black. To fix this, go back to L3DT and paint the template background something brighter, like green or white or something. You'll notice in the above image that the terrain is unshaded. Normally when Sapphire is rendering textured terrain, the texture has been 'baked' with a light map generated by L3DT, and so Sapphire does not normally do any lighting of it's own in textured terrain mode. However, we don't have a light light map or texture yet (we'll get to that later), so we can turn back on Sapphires' basic lighting using the '//Options->Runtime light over texture//' menu option, as below:
{{:tutorials:l3dt:roads:runtimelightmenu.png|:tutorials:l3dt:roads:runtimelightmenu.png}}
The effect of this should be as shown below, where we can now see the general shape of the terrain:
{{:tutorials:l3dt:roads:3d3.png?450|:tutorials:l3dt:roads:3d3.png}}
Okie dokie, we're now ready to proceed to the 'making a road' part: ^ Next page | [[tutorials:l3dt:roads:add_road_to_HF|Adding the road to the heightmap]] |