Revision History 2/14/07 Initial Draft
This tutorial presents a very simple scenery package that adds an overlay to San Berandino International Airport. It illustrates a number of topics:
A warning on performance: the overlay polygon system draws terrain in addition to the base terrain, not instead of the base terrain. So using very large polygons can cause framerate problems. Overlay polygons are placed only when the plane gets near the area, so they are not appropriate for very large (and thus very visible) features.
You can download the sample scenery package here:ground_overlay_demo.zip
The original text file used to create the DSF (via DSF2Text) is included, and all text files are heavily commented.
Please note that we are working on tools to alllow scenery to be built graphically. This tutorial is meant to illustrate how the scenery system works, but you may not want to attempt to build such packages by hand.
The short answer is: that's up to you. In the case of this tutorial, I downloaded an orthophoto for KSBD from the USGS using their seamless data server. The downloaded image came with text files with the coordinates of the corners of the orthophoto.
(Because the USGS is a government agency, their imagery is in the public domain.)
I used photoshop to add an alpha mask to the original image, creating a more natural looking border around the airport area. You can see the before-and-after in the scenery package; ksbd.png is the original, and ksbd_alpha.png has the alpha mask added.
DSF files describe the placement of orthophotos in scenery, but DSF files never reference the image files (PNG files) directly. Instead the DSF file refers to a .pol file and the .pol file refers to the PNG file.
The .pol is a artwork definition file, like an OBJ or .ter file. The .pol file gives us a place to put any extra information about the polygon as well as the name of the PNG file. For example, the .pol file has a line that defines the surface properties of our polygon - in this case, grass.
One important property in the .pol file is the LAYER_GROUP. This defines which scenery elements go above and below the .pol. This is how you can use polgons for the ground (which you'll want below runways) or special pavement markings (which you'll want above runways.
Generally you'll need one .pol file for every set of PNG files that make an orthophoto. (You might have a PNG for the terrain and a second PNG for the night lighting map.)
To use the polygon, you must first reference the .pol file in the DSF using the POLYGON_DEF command. This defines an index number within the DSF that will then be used to refer to it.
Note that the first POLYGON_DEF has index zero! Each time you want to place the orthophoto you'll use this index.
(Note that when working with orthophotos, you'll probably want to use each orthophoto only once. However, the DSF makes it possible to use a .pol many times. If your polygon contained a generic texture, like grass, it could be useful to use it many times.)
Polygon info in DSFs can be used for a number of kinds of artwork: facades of buildings, beaches, forests, strings of objects, pavement lines, or draped polygons. Each polygon placement in the DSF has a "parameter", a number between 0 and 65535. Normally the parameter for .pol files is a heading (in degrees) that the texture is rotated by. But in the case of orthophotos, we use the special parameter 65535 to indicate that we want to use texture coordinates in the DSF to place the orthophoto.
We then use four coordinates to place the orthophoto. The first two numbers are longitude/latitude pairs and the second pair are texture coordanates. This not only defines the boundary of the polygon that we will place the orthophoto within, but also which part of the texture is linked to each corner of the polygon.
You may want to look through the scenery package to get a better sense of how orthophotos are set up.