Note: this document was originally and posted written 4/30/02 and reflects the X-Plane version 7 scenery system. It is provided here for completeness.
The mesh contains a series of vertices, or distinct points in the grid. Each vertex lies on a grid that contains 201 points north-south and 151 points east-west. Each set of four points forms a quad. Since all quads are c ontained, there are 200 quads north-south by 150 quads east-west. The vertices on the East edge of a scenery file touch the West edge of the next scenery. But these edge vertices do not have to have the same coordinates as the corresponding ones in the next file.
It is important to make a distinction between vertices and quads. Often properties of a quad are specified by the quads southwest vertex. But sometimes all four verticse contribute to a quad's properties. Since the rightmost and topmost vertices are not the southwest vertices of any quad in the scenery file, sometimes some of their characteristics are ignored.
Each vertex contains the following information:
Land uses and custom textures are rendered slightly differently. A custom texture is mapped directly to a quad whose southwest vertex contains the custom texture information. Custom textures are always square and if a custom texture is specified for the top and right edge vertices, it will never be seen. Land uses, however, are rendered centered around a vertex. Each vertex causes a "blob" of that land use to appear around the vertex, appropximately half as wide as a quad. If all four vertices of a quad have the same land use, the blobs effectively meet up covering the entire quad. But where different land uses exist, the blobs will tend to meet near the center of the quad. Since land uses are rendered around vertices, the land uses for the upper and right edges of the scenery file do matter.
Land uses are prioritized; when multipel land uses are present on the vertices of a single quad, they will overlap based on their priority. Water always has the lowset priority and thus appears "on the bottom". Other blobs are then superimposed over them. The ratio of different land uses in a single area does not matter; priority order is always followed.
If thin chains of a single land use appear that travel north-south or east-west, they will always form thin strips that connect. But if land use travels on a thin diagonal, they may or may not connect:
How does X-Plane know whether a diagonal set of vertices should form a strip or a set of islands? The answer is that each vertex specifies a join code. A join code tells X-Plane how to connect or not connect diagonal land uses of the same type. The join code is specified on the southwest corner of the quad upon which the diagonal will form. A join code will cause X-Plane to either draw a bridge between the two points or not.
The join codes are defined as follows: 1 means bridge land from the lower left to upper right; 2 means bridge from the lower right to upper left. 3 means do not bridge at all. Note that you cannot bridge in both directions; one bridge would by definition cut off the other.
The join code 0 is special and instructs X-Plane to do its best guess. X-Plane will look at the surrounding territory and try to determine whether a bridge is a good idea or not. For older .env files, all join codes will be 0, causing X-Plane to auto-generate bridges. The join code will also be 0 on quads that do not need bridges (because they do not have diagonal land use.
Join codes are important because they allow you to define very thin strips of land or water.
Land uses are centered around vertices while custom textures are located on quads. When a custom texture vertex is next to a land-use vertex, X-Plane will extend the land use as necessary to fill all space.
The fill bitmap contains a simple RGB image of the land use. A few rules apply to fill bitmaps:
Each alpha mask has a different role in rendering land use:
This picture illustrates how multiple bitmaps are overlayed when land uses meet.
The land under an airport will be turned to the airport "land use". Since the government data used to form the global scenery often did not specify the man-made islands that many modern airports sit on, many airports appear to sit directly in the water. X-Plane "fills in" a few quads to keep the airport dry. Note that sometimes this causes an island or peninsula to become too large. In this picture, Genoa airport (built entirely on fill) is under water since the man-made island was not included in government data. The airport is on land in X-plane though.
In this picture, Boston Logan sits on a peninsula. However, X-plane adds a little bit more land as "insurance" against a wet airport. The result is that waterway around the airport entirely becomes land.
Future versions of X-Plane and the GLoS scenery project will address this problem.
X-Plane also "flattens" water to some extent to keep it from appearing trough-like. The light blue water in this WorldMaker picture are quads where half of the water is higher than the other half. X-Plane will reduce the height of this water to keep the water from appearing to be diagonal. This is done to preserve the height of the banks of the river or water body so that future fjord rendring may be more accurate.
If a join code is zero but is needed (e.g. there is a diagonal land
use), X-Plane will guess whether the land should bridge based on the surrounding
water and land. This join-code guessing works a lot of the time and
is used for backward compatibility with older scenery.