Wednesday, February 14, 2007

Polygons Part 3 - Airport Grass Terrain

In my previous post I discussed airports using the apt.dat and polygons and when to use custom artwork in a DSF.

One problem with the X-Plane scenery system (and a topic for another blog) is that, because scenery is fully pre-processed*, introducing a new airport won't put grass underneath the airport surface area. (Only airports that existed at the time the global scenery was created have grass underneath them.)

To make an airport there are two types of processing you need to do to the underlying area:
  1. Flatten it, if it has bumps. Since our mesh comes from SRTM, which is "first return" (meaning whatever the radar bounces off of first, that's the height of the terrain, even if it's a tree top), it often is quite bumpy.
  2. Change the underlying texture to something appropriate for an airport.
With X-Plane 8.60 (in RC as of this writing) you can do both! I've blogged about airport flattening (and why it isn't very good) before; today I'll try to describe how you can fix the base terrain.

You can cover the base mesh with a draped polygon in a DSF overlay. All you need to do is:
  • Create a .pol file that references a PNG for the texture and describes the resolution it will be applied at (i.e. how many pixels per meter) and
  • Use that .pol file in a DSF with a polygon in the overlay to describe where to put that texture down.
In X-Plane 8.60 we provide .pol files for you for all of the basic airport terrain textures. If you open the file Resources/default scenery/820 world terrain/library.txt you will find the library listing for the global scenery terrain. Toward the bottom you will see a section like this:

EXPORT lib/g8/pol/apt_sdry_cold.pol pol/apt_sdry_cold.pol

What this means is: the library path lib/g8/pol/apt_sdry_cold.pol is apped to the file pol/apt_sdry_cold.pol in this scenery package. You will see a fairly large number of .pol files on the left. Basically these represent the basic "environments" that an airport can exist in.

So to make an overlay DSF that has wet cold grass underneath it, make an overlay DSF with a .pol file using the path "lib/g8/pol/apt_wet_cold.pol".

EDIT: Important -- there are actually four .pol files in this library that do not work!! They are:

apt_desert.pol
apt_dry.pol
apt_grass.pol
apt_sdesert.pol

You will know they don't work because your scenery will not load with them. Basically, they are accidental hold-overs from a previous naming scheme for airport terrain, but were never deleted. Note how they name only an amount of rainfall (except for apt_grass, which tells us nothing). The rest of the files are named things like apt_sdry_cool, which gives us both temperature and rainfall. This 2-dimensional climate grid (with rainfall and temperature) is how most of the X-Plane terrains are organized.

Why use the library system to do this? Three reasons: copywrite and VRAM, and compatibility.

One advantage of using our library is that it gives you a way to use our artwork without copying our artwork. Remember that you cannot copy the X-Plane PNG files into a custom package and then sell it - it's a violation of X-Plane's EULA. But you don't need to! You can simply use the .pol file and X-Plane will load up the appropriate PNG files.

This is also a win for VRAM. If the wet grass texture is being used in the base terrain (for an airport that has wet grass underneath it from the global scenery) and in your overlay DSF (via the library .pol file) X-Plane will only load one copy of the texture, saving VRAM, speeding up load time, etc. If you copied the PNG file, besides being a EULA violation under some circumstances, you'd also be wasting VRAM. So the library system is more efficient!

Finally, by using our polygons, you ensure that your base grass will match the rest of the scenery system. If we update the look of our grass, because the library .pol files reference our artwork, you will see the same thing in your airport that we have in the default ones.

(Of course my warning from last week applies: if you use a wet airport grass polygon for something other than wet airport grass, then in the future our improvements on the artwork may make your scenery look strange. With these airport polygons we are aiming for "as much like an airport as possible", not "as much like 850 used to look as possible"!!)

* By this I mean, all the decisions about how scenery will look are made ahead of time, so the look of scenery does not respond to the combining of multiple packages by changing the underlying packages - only by superimposing the new ones on top. Thus a new apt.dat layout does not change the underlying terrain from urban and forest to grass. This is a design trade-off; full pre-processing has both good and bad aspects.

1 comment:

Anonymous said...

There is something I am missing! Exactly what command lines should be used in the DSF in order to activate a draped poly?