Wednesday, November 22, 2006

Scenery Polygons - Part 1

X-Plane 850 introduced some new polygon features that are worth looking at. Polygons are always legal in overlays, which makes them particularly flexible.

A polygon is any DSF entity described by one or more rings of points. A polygon's look is defined by its artwork file, which also constrains its properties. Polygons may:

- Be draped, meaning the polygon in the DSF does not have altitude information, but instead takes its height from the underlying mesh. A non-draped polygon has altitude information. (Only draped polygons should be used in overlays because a non-draped polygon might not match the base mesh correctly. You can't know whether a user has the 7-DVD DSF scenery, or old ENV scenery, or the older US DSFs.)

- Be curved (via bezier curves). This is only legal in some polygons.

- Have holes: some polygons can have additional interior polygons cutting "holes" in them.

X-Plane 8 shipped with one original type of polygon: facades. Facades are draped polygons with no holes or curves. X-Plane builds a building along the perimeter of the polygon. Facades were used heavily in the original US DSF scenery, and are useful for airport terminals, and even possibly fences.

X-Plane 820 added two new types of polygons: beaches and forests. Beaches are non-draped, non-curved, no-holes polygons that add a strip of beach texture between land and water. As mentioned above, I don't recommend using them in overlays because they are not draped. (They are legally allowed in overlays but the chance for ugly results is large.)

Forests may have holes and are draped, but cannot be curved; they fill in their interior with 1-4 polygon trees. We do not have any forest polygons in the current global scenery, but some users have built their own overlays to add trees to X-Plane using these polygons.

X-Plane 850 introduced the new apt.dat format with a number of new features. Rather than make the apt.dat file customizable (which would make the file format complex and change its fundamental purpose), we added new polygon types that let authors use the same facilities as apt.dat files have, but with a lot more control and flexibility. Three new polygon types implement some of the new X-Plane 8.50 apt.dat features:

1. Object chain polygons. You can make a polygon and X-Plane will string a series of objects along the polygon. The polygon is draped and may be curved, but may not have holes. X-Plane 850 uses this for taxiway lights, but this could also be used to plant trees along the edges of fields. (You could also use this to put streetlights along roads, but the road file format can do that already without adding extra polygons to the DSF.)

2. Painted line polygons. You can make a polygon and X-plane will drape a painted line along the ground. These polygons are draped and may be curved, but may not have holes. X-Plane 850 uses this for taxiway lines.

3. Draped polygons. You can make a polygon and X-Plane will fill it in with some kind of texture along the ground. These polygons are draped, may be curved, and can have holes. X-Plane uses these to make curved taxiways, but they have a lot of other possibilities since they provide a way to change the terrain.

I will comment more on draped polygons in a future blog posting, but one immediate note: before X-Plane 850 if you added an airport it was impossible to convert the terrain underneath to grass (from whatever terrain might have been present). With X-Plane 850 you can now make a draped polygon using a grass texture and a DSF overlay with the perimeter of the airport and thus "patch" the texture of the mesh to look like grass.

This technique is not as good as the grass in the native airports for four reasons:
- Draped polygon performance is slower than the mesh itself - I'll comment about that later.
- Our DSF creation program flattens airport areas - a draped polygon doesn't so there can be SRTM DEM noise that makes the airport area too bumpy to use.
- The DSF terrain grass can have a soft border, but right now draped polygons always have a very sharp border.

Draped polygons still represent a better option than putting the runways over the existing terrain though.


Daniel_L said...

Hi Ben,

Can I use Object chain polygons to add the missing power lines in France ? A short example would be a nice start for me.

Thanks, Daniel

Benjamin Supnik said...

Hi Daniel,

I'm sorry, but you cannot - powerlines are a form of road/transportation network. You could use the polygons to place the powerline tower objects, but the polygons can't generate the wires.

Daniel_L said...

Hi Ben,

I don't need the wires. From the air is difficult to see them, unless you are really too close, or too low. I just want to add the powerlines pylones.
With Object chain polygons, how is the object orientation ? Native (the value entered) or relatively to the line ?


Benjamin Supnik said...

Hi Daniel,

Ah - then you can use the polygons. :-) Orientation is relative to the line I believe...the two numbers in the .str file are the minimum and maximum offset to add to the object heading (positive numbers are clockwise)...a random value between them is picked. In our airport lights you'll see 0 0 so that no offset is added and the lights go along the line.

The object is faced so the north side of the object is facing out along the line.