There is quite a bit of importing, exporting, saving, changing formats, etc required, so be forewarned!!
Step 1: Importing a VBS2 terrain into L3DT
a) Export the terrain that you wish to work on. It can be exported as ASC or XYZ (L3DT has the ability to import/export in these formats).
b) Import this heighfield into L3DT (File>Import > Heightfield (HF)
c) Generate Design Map (DM) : Operations > Design map > Generate from HF (relevant steps for these 2 steps are here: link . This step is neccesary due to the Calculations process that is needed to further modify the terrain (if you wish to create Attribute Maps, for example, to either create custom terrain textures, or perhaps if you wish to create a geotypical terrain from existing terrain, and don't want to spend a lot of time in PhotoShop mucking about with textures, brushes, etc.
d) It might be desirable (but not neccesary) to import your satellite imagery, to aid in viewing your terrain. I have had problems in the past with using full resolution sat imagery (4096+ pixels), and it is recommended to use 1024 x 1024, but I have successfully imported 2048 x 2048 imagery. You can use PS to accomplish this (Edit>Image Size), or V4 (File>export>Imagery and then select a Resolution (m/px) value that will bring you down to this range (2.0 m/px to bring a 4096 x 4096 image down to 2048 x 2048)or use GM (Export Raster/Image Format, select JPG/PNG/BMP/TGA (your choice), and select the Sample Spacing that will bring it to 1024 x 1024 (or 2048 x 2048). I have tried large values, and they appear on the screen, albeit tiled incorrectly, and the result is a soup-sandwich. Unless Aaron has improved the ability to go larger than 2048x2048, stick with these values. The texture is there to guide you with editing the terrain, and won't be part of your final VBS2 project.
At this point, you can get into Saphire (similar to Buldozer, as it is the 3D viewer/editor), by selecting the '3D' button in the menu bar, and start modifying the terrain. There is a user guide here, but I will highlight the basics below:
- Keyboard movement: A,S,D,W (standard keys for FPS games), and E and R to raise/lower viewpoint (can be remapped to fall in line with VBS2 keys, if desired)
Viewmodes: 'M' to toggle between Texture, Poly, and Wireframe mode
Edit Heightfield: 'H' to bring up editing menu. User Guide for heightfield editing tools [img=http://www.bundysoft.com/wiki/doku.php?id=plugins:sapphire:userguide:hf_edit]here[/img]
Teleport: 'T' to bring up teleport menu (it works off of bottom left/south west corner being 0,0, and uses x,y values to place avatar). You can create and save different teleport points, as it can be a little difficult to navigate around quickly. Similar to 'Bookmarks' in V4.
Transportation mode: 'Spacebar' toggles between Hover and Walk. Pick whichever method you want to move around the map (on foot, or as a helicopter).
Turbo mode: 'Tab' key. Similar to holding down Shift in VBS2. Speeds up lateral/vertical movement of camera/avatar.
Clip mode: You can select 'Clip -' or 'Clip +' from the menu bar at top. This will clip what distance the terrain is drawn at. If you are getting slow FPS (frames per second) while moving, select 'Clip -', and less terrain will be drawn. Keep in mind that L3DT draws the terrain very roughly at first, and then starts improving the view as you get closer to the point you wish as you slow down (or stop) the movement. This can be a little disconcerting at first, as it appears that your highly detailed terrain (if that is the case) is nothing but large chunky blocks. I would recommend moving around in Wireframe or Poly, not in Texture mode.
e) Once you have finished editting your terrain, you will want to export it so it can be brought back into VBS2. Select 'File>Export>Export Active Map Layer (or Ctrl+E), as long as your heighfield map is currently selected; or Export>Export Map Layer, and a window will pop open, with the different layers available to be exported. Select Heightfield. Then, in either event, select ASC or XYZ format, a new file name (don't want to overwrite your working VBS2 map data, right?!?) and then export. Note: I have had problems in the past, associated with exporting the wrong size of heightfield. I am not 100% convinced that I am still doing it correctly, as VBS2 and L3DT handle the sizes of heightfields differently. What VBS2 calls 1024x1024, L3DT calls 1023x1023 (due to the nature of starting at 0,0 instead of 1,1 for the bottom left X,Y values, I believe). This has caused me grief in the past (ending up with -32000m values on the bottom/right boundaries, which caused huge problems when I ran a smoothing pass over the whole map). Anyway, Aarron recommended adding 1 to each value (1025x1025 for a 1024x1024 map), which can be done by putting a check-mark in the box for 'Re-size for export' and then applying this corrected value. Your mileage may vary, so be forewarned, and ensure that archive your original files in case you run into problems in the future. Once you have exported your file, you can drag and drop it into V4, rebuild your terrain there, and try it out. I highly recommend keeping track, via archiving and using meaningful file names, of your modified terrains, in case things go awry. I have found that I threw caution into the wind one too many times, and overwrote previous files (in the interest of being able to use the "Refresh content from source" function in V4, rather than exporting as a unique name, importing and rebuilding). Learn from my mistake(s)!!!
Step 2: Using overlays to modify terrain
Note: The steps outlined here require the latest build of L3DT (v2.9 build 8 (31st of Jan, 2011), as the capabilities discussed aren't available prior to this build.
a) Create an overlay to modify your terrain. I tried to do this in GM only, as I know that many people/organizations don't have PS, and aren't permitted to use unauthorized software (GIMP, etc). It can be done, and may be desirable, particular if you wish to use existing data (SHAPEfiles, imagery, etc) that you received or created. The problems that I ran into are that there are many more steps required to accomplish something that can be done much faster in PS. I will go through the basics, using PS, and at some point I may include instructions to use GM to accomplish this (and it may be required to go into PS to clean up the imagery (add feathering to edges; add some noise (for randomness); stretch/twist/pinch/otherwise manipulate the shape(s); add gradient(s).... this one is a huge must-do, IMO, as it will allow for a gradual increase in values, rather than a drastic increase from max/minimal vertical values.
i) You can use your satellite imagery as a template
ii) Ensure that the image is kept in 2^2 format (it doesn't have to be the same size as your satellite imagery, as it can be stretched to fit, but it makes a certain amount of sense to keep things simple by using the same sat imagery size). If you don't do this, remember the scale change (i.e if you go from 4096 x 4096 to 1024 x 1024, you will need to remember this for step D below).
b) One thing to keep in mind when creating your overlay is to create a black background (which will have a value of 0m when we are done with it) and use white (or shades of grey) for your terrain modifying effects. The beauty of L3DT is that we will be able to change the min/max elevation quickly, so the overlays that are created can have different values whilst using the same image(s).
i) You can do this in PS easily, but if you use GM use these steps: using your project frame SHP file (exported from V4, and then imported into GM), select the frame, Edit the display properties for the shape (RMB on shape>Edit Area Feature>Feature Style, select 'Specify Style......' and select 'Customize....', Fill Pattern changed to 'Solid Fill' select pure black colour (RGB values of 0,0,0), Border Style to 'Null' (not critical when using black, but you will need to do this for any other colour, or you will have a black border), and unselect "Show Label for this Area").
ii) You must do this step if you are using GM to create your black background AND you wish to use GM to create your overlay: you must export your frame as an image, and then bring that image (PNG) back into GM. If, for example, you create an area shapefile in GM to use as your overlay (lets say you copy a contour from your map) and wish to colour this white (using the same method from step i above), the shapefile will not show up over the black frame shapefile, but will show up over the black PNG image that you exported.
Note: The biggest problem I can see with using GM (without PS involvement), is the lack of applying a gradient to the image that you create. It would be solid white, this creating an immediate step from 0m (the black) to whatever the maximum height you will set in step d below. This may be what you want: creating walls, ditches, etc, but if you are adding rolling hills, for example, you are going to want to use gradient effects to smooth the transistion.
iii) Once you have completed you overlay shape(s), have these shapes (coloured white by now) showing above the black background (i.e make sure that the black PNG file is at the bottom of the stack, or last drawn), and then use the process from step 1d above to export the imagery to be used as your overlay.
c) Optional: One other thing that you may wish to create, but it isn't neccesary for this tutorial, is a mask that will allow only certain areas to be modified. Not really neccesary in this case (as we will create black (0m) areas that won't effect the final heightfield), but you could use another method to achieve the results we will get, by combining a completely different heightfield (i.e of another area in the world completely) and then use a mask to only allow a portion of that to be applied to your initial heightfield. This is a more advanced technique, and I may touch on it later in this tutorial, or in the future. The key to creating a mask is this: black blocks, white allows the imagery to come through. You can use greyscale values to feather the mask (i.e use a gradient effect in PS), so that the effect isn't as drastic as it might be if you have a stark transition from a value of 0m (pure black) to 255m (pure white), which you would get if you don't modify the heightfield that is generated.
d) Import this new overlay as a Heightfield into L3DT. Note: You must close out (and save) your project, and start fresh here. Select 'File>Import>Heightfield.' Select your overlay (image) that you created. Select the file (PNG/BMP/JPG/TGA/etc) and then select 'Next' and set the horizontal scale to make this heightfield match your VBS2 heightfield. I normally use a 1:1 ratio here (i.e 4096m x 4096m satellite imagery and overlay size, so I use 1m for the horizontal scale), but if you chose a different value, enter that here (i.e if your chose to make it 1024x1024 vs 4096x4096, enter 4m).
e) Now for the min/max heights. If you wish for the maximum change to you heightfield to be 5m, and you used pure white (255,255,255) as part of your overlay, the highest point on that overlay (255,255,255) will be equal to 5m. If you want that point to be 50m, select 50m as your maximum elevation. This allows you to use a single overlay to try out different values, and then pop into L3DT to see if that value is correct. However, each overlay will have to be saved with a given maximum height value. It might be prudent to create a number of different overlays of the same shape, with a different set of maximum height values. This will save you a lot of time down the road if you discover that, for example, 5m just wasn't enough height on the terrain feature you are trying to create. To do this, first go with one value (say 10m), and finish off the step. Leave 'Wrap Edges' unchecked.
f) Once you have completed the import process, you will end up with a black heightfield, with your shape that you created. You can take a look at it now, if you wish, by going into Saphire (select '3D' from menu bar). You could edit this shape now, if you wish, and then export it, but for the sake of this tutorial, we will export it.
g) Go to File>Export>Export Active Map Layer (or hit Ctrl+E) and export this file as a HFZ (L3DT format) file. This file will now become a heightfield map that you can blend with your VBS2 terrain.
One point here: due to the way that the Merge Heighfields functionality works in L3DT, you don't need to create separate overlays if you want to subtract terrain (i.e create valleys, ditches, rivers, etc) using your overlay. You will be using whichever modifier that you want to apply (Add, Subtract) and if you select Subtract, it will remove Xm (your maximum height) from your terrain (with the maximum value being the pure white (255,255,255) value, and all the way down to 0m (pure black)). So, you wouldn't need to create inverse masks (which are needed in some application to carry out subtraction modifiers).
h) Optional: If you want to create a number of overlays, each with a different maximum height (e.g. 1m,5m,25m,50m), you can go into your heightfield parameters and change these and export them in turn. To do this, select 'Operations>Heightfield>Change Vertical Range' and then select a new maximum range. It would be prudent to append the maximum range to your overlay name on exporting them (i.e 'overlay10mMax', 'overlay25mMax') to keep track of these files.
j) Once you are ready to try out your new overlay, you will need to close out your L3DT session (where we created the overlay heightmap: you can save that file as a project, but it isn't neccesary, as we exported the heightfield), and then open up the L3DT project we created with our VBS2 terrain.
k) Once that is complete, you will do a MergeHeightfield action: Select File>Import>Merge Heightmaps'. You will first need to select the heightmap file that you want to overlay onto your existing VBS2 heightfield. After that you have the option of selecting a Mask Image (in this case we don't need to, as we will be applying the whole thing to our map (the black areas will add 0m.... in other words, no change to those areas). Again, this is a more advanced feature, and there may be occasions where you wish to use it.
m) Now the critical part: 'Blend Mode'. I will only discuss 'Add' and 'Subtract' for the purposes of this tutorial. Ensure that you select 'Add' or 'Sub', or you will end up with the default action of 'Replace' which would replace your VBS2 heightfield with your overlay. Likely not something you want to happen. Again, 'Add' will add your overlay to your heightfield, and 'Sub' will remove your overlay shape from your terrain. Use your imagination to think of the possibilities this has brought.
n) You can leave the 'Stretch to Fit' checked, or change the values in 'Reset Map' size in the Overlay Heightfield size. As for Position Offsets, X and Y are greyed out, and if you change the values for Z, it will effect your initial heightfield (i.e if you put 20m in the Z field, it will raise that heightfield by 20m.... not something that you likely want to occur).
p) Once that is done, L3DT will do it's magic, and you will end up with a modified Heightfield Map. Depending on the severity of your elevation change, it may or may not be apparent in the 2D window, so you will likely want to take a look in 3D. Start up Saphire, and look at your new changes. It help to get right down to ground level to see the changes, and toggle through Poly, Texture and Wireframe modes (using 'M' key) to see what it looks like. If you aren't satisfied, you can exit Saphire (hit 'Esc' key) and then select "Undo" from the menu bar. Note: it is wise to either save the project before going through major changes, or select "Bkup" (backup) from the menu bar, and then "Rest" (restore) to undo any changes. Resist the urge to do a lot of modifications in Saphire to your initial effort (there are only so many Undo steps available until you are satisfied. Again, if you aren't happy (let's say that 5m max height wasn't drastic enough), you can always Undo to remove your change, and then go through the steps (starting at 2k above) using the other heightfields that had the different values applied (for maximum elevation).
I think I will leave this tutorial at this stage. I will add more to it (perhaps the steps required in PS to apply gradients, but, to be honest, there are probably a million such tutorials out there, likely much better than I can create, so it may be worth your time to Google-fu your way to victory on that front). Once Aaron comes up with the ability to modify the Attributes map (so that you can use the MASK_LCO files created/exported out of V4 (or V3)) more easily (presently, it is very difficult to simply take the MASK_LCO.png file and bring it into L3DT so that you can create your own custom Attributes Map (and thereby create custom texture maps), I will document how one can import one of these maps directly into L3DT for use as an attribute map (with some editing of parameters, obviously, to tell L3DT what terrain type/texture that you want in the areas that are red, green, yellow or blue on your map) and if need be, how to modify the MASK_LCO.png file in either PS (changing colour values to become valid L3DT colours) or GM (using SHAPEfiles exported from V4, and making these shapes have valid colours, as per the standard GM method of creating imagery from SHAPEfiles).
Any additions to this workflow, or questions, feel free to post below.
Allan