An Author's Guide to the new X-Plane default scenery system


The X-Plane scenery system has undergone some significant changes with the release of X-Plane 6.10 and the subsequent maintenance releases.  The "default" scenery system has been completed revised to provide a much more powerful and flexible rendering system.  This document describes the concepts behind the new rendering system for authors who will be revising and editing scenery.


The basic form of a scenery file have not changed; a scenery file contains information about a 1x1 degree rectangle of land.  Scenery files are always named for their southwest most corner, e.g. the file -42+071 contains all points from latitude 42S to 41S and 71E to 72E inclusive.  The scenery file contains a mesh describing the shape of terrain in that 1x1 degree rectangle.

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:

  1. Its position in the scenery file, specified by latitude and longitude.  While vertices form a grid, that grid does not have to be regular.  However, each quad must not overlap with any other quad.
  2. Its elevation above sea level.  This allows the mesh to form mountains, valleys, etc.
  3. A number of properties describing the land or other scenery to be painted on and aroun this vertex.
We will pay extra attention to this last bit of information.

Land uses vs. custom textures

There are two categories of images that may appear on land in X-Plane: land uses and custom textures.  A custom texture is the same as it's always been; a bitmap by the author that covers that quad.  A land use is a description of the kind of land or water that this vertex is near.  These codes are mapped to textures, but they tend to specify geological information, rather than imagine information.  For example, you can specify "stony desert" for a point, but what color the stones are is up to X-Plane.

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.

Textures and rendering

X-Plane uses two sets of picture information to draw land uses as well as a map.  The map is a text file associating bitmap files with specific land uses.  A bitmap file can be used for multiple land uses; typically X-Plane ships with about three dozen sets of bitmaps for about sixty defined land uses.  Several more land uses are not yet defined and remain reserved for further development.  Each terrain is defined by a fill bitmap that specifies the image the land use will take, and alpha bitmaps that define how these bitmaps are overlayed on top of each other.

The fill bitmap contains a simple RGB image of the land use.  A few rules apply to fill bitmaps:

Fill bitmaps are always treated as square.  If the fill bitmap is wide, each "square" is treated as a separate version of the bitmap and will be used to vary scenery.
The alpha bitmaps contain a black and white mask describing how this texture will be overlayed onto other textures.  White means the land use will be drawn, black means it will not.  Gray scales blend the land use.  The land use must have the following properties: For each fill bitmap, four alpha bitmaps are defined, and named with the extensions C1, C2, C3, and C4.  (We will use these suffixes to refer to them.)  Each alpha mask contains four rotations of the same type of shape, shown below, except for the C4, which contains only two rotations.
The reason that four variations of each corner are provided are twofold: this provides more variety in coastal shapes, and the land use textures cannot be rotated; they often contain shadows which look inconsistent when some but not all are rotated by 90 degree increments.

Each alpha mask has a different role in rendering land use:

  1. When all four corners of a quad contain the same land use, no alpha is necessary, and the fill is drawn over the whole quad.
  2. When three corners of the quad contain the same land use, the C1 bitmap is used to paint fill in all but one corner.
  3. When two corners along the same side of a quad contain the same land use, the C3 bitmap is used to paint fill in half the quad.
  4. When one corner of a quad contains a land use, the C3 bitmap is used to fill that one corner of the quad.
  5. When two diagonal opposite corners of a quad contain the same land use, the C4 is used to fill that diagonal if the bridge.
  6. When two  diagonal opposite corners of a quad contain the same land use and they do not bridge, the C2 is used to fill in the two separate corners.
The example below illustrates how a complex coastline is built out of a series of alpha masks.

This picture illustrates how multiple bitmaps are overlayed when land uses meet.

Two properties of alphas must be observed:

Other X-Plane behaviors

X-Plane also takes a few steps to process an .env file that can change what you specify:

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.