You are on page 1of 17

How to create a PAPI-4 Approach Lighting System

Tutorial : How to Create a PAPI-4 Approach Lighting System


This tutorial is written with my understanding of the proper steps to create a working PAPI approach lighting system. As I am very new to scenery design, I make no guarantees that this is the best way to make these lights, especially in regards to the Gmax modeling, exporting and tweaking of the file, and final placement for use in Flight Simulator. Andy Reichenbach To create a working PAPI light system, there are several steps to follow. Number of light boxes in the system You need to know how many PAPI light boxes are to be created. There are PAPI systems with 2, 3 or 4 light boxes in them. Determine the number you need and prepare to create the model in Gmax. Creating a model of a PAPI light box is at the discretion and artistic license of the developer. The level of detail and actual model of PAPI light used are factors that the developer must consider in the creation of working PAPI lights. The example below will be using a 4-PAPI system, which will have four identical light boxes modeled in Gmax, for tweaking further in the tutorial. Below is an example of my PAPI light box, modeled per real-life manufacturer details, found online. The key to the model is the two lights that are placed in the front of the light box. They are simply small boxes placed to represent the position of the intended PAPI lights as seen in Flight Simulator. Create the main portion of the light box and place two small boxes in the front of the light box. Create two new materials, named LIGHT_NAV_RED and LIGHT_NAV_WHITE for the lights. For each material, go into the Diffuse color box and choose the RED you wish to represent the color of the light; do the same for the WHITE light. Note: The LIGHT_NAV portion of the name is VERY important as this tells the exporter function to encode BGL lights into the model. Place one of the materials on each box, as shown in the image below. Before exporting, your light box model should look similar to the image.

How to create a PAPI-4 Approach Lighting System

After creating the first light box, copy the light box over to represent the other boxes in the series, depending on the number you are going to use. The example will use four light boxes. At this stage, it should be ready to export. Select the four light boxes and export them into one model file, Keeping the Files so that you will end up with a MDL files as well as a *.asm and *_0.asm file. If all works well, you should generate

How to create a PAPI-4 Approach Lighting System

these files. Name the model whatever you want but make the name something that will make sense to you. I named mine PAPI05.mdl, thus a PAPI05.mdl, PAPI05_0.asm and PAPI05.asm file were created. Note: From this point forward, the name of files used will be labeled with a * as I am not recommending a specific file name for your objects. Use your best judgment in naming files. Now, Open up the *_0.asm file you just generated and scroll to the bottom of the list. When I open my file and scroll to the bottom I see these lines:
papi05_MasterScale_2 label BGLCODE IFMSK nolgt_1, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, 0.000, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 1593 nolgt_1 label BGLCODE IFMSK nolgt_2, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, 0.000, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 1594 nolgt_2 label BGLCODE IFMSK nolgt_3, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -9.144, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 4163 nolgt_3 label BGLCODE IFMSK nolgt_4, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -9.144, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 4164 nolgt_4 label BGLCODE IFMSK nolgt_5, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -18.288, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 6733 nolgt_5 label BGLCODE IFMSK nolgt_6, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -18.288, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 6734 nolgt_6 label BGLCODE

How to create a PAPI-4 Approach Lighting System

IFMSK nolgt_7, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -27.432, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 9303 nolgt_7 label BGLCODE IFMSK nolgt_8, dict_0_g_lightStates, LIGHT_NAV_MASK BGL_LIGHT LIGHT_NAV, -27.432, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 9304 nolgt_8 label BGLCODE BGL_RETURN

bgl_riff_end_papi05

label

BGLCODE

The first step is to remove the lines starting with IFMSK and its end tag lines. These are the lines just above and just below each BGL_LIGHT reference. These are not needed for the final compiling of the model. I bolded the lines to be removed. You are left with:
papi05_MasterScale_2 label BGLCODE BGL_LIGHT LIGHT_NAV, 0.000, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 1593 BGL_LIGHT LIGHT_NAV, 0.000, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 1594 BGL_LIGHT LIGHT_NAV, -9.144, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 4163 BGL_LIGHT LIGHT_NAV, -9.144, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 4164 BGL_LIGHT LIGHT_NAV, -18.288, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 6733 BGL_LIGHT LIGHT_NAV, -18.288, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 6734 BGL_LIGHT LIGHT_NAV, -27.432, 1.078, -0.001, 20, 0.60, 0.40, 0FFFFF5F5h, 0.000000, 0.000000, 1.000000 ; source poly num = 9303 BGL_LIGHT LIGHT_NAV, -27.432, 1.078, -0.001, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 9304 BGL_RETURN bgl_riff_end_papi05

label

BGLCODE

How to create a PAPI-4 Approach Lighting System

Note the eight BGL style lights are coded there. This represents 4 light boxes with two lights each. Also note that every OTHER BGL light is a different color. How do you tell it's different? Look at the piece of text 0FFFFF5F5h and 0FFFF0000h. These represent the two colors I picked to show my lights on each box; there are four pairs of the lights. At this point, you can change the color that is shown in the final FS model by changing these color codes. I choose to leave them as is tweak them later to my liking. After the IFMSK coding is removed, you are ready to calculate and place the separation planes for the light boxes. Save the *_0.asm file for now. Well come back to it after doing some calculations.

SEPARATION PLANES Because you will have four light boxes, there will be a total of FIVE separation planes required to make the light boxes function; one to determine the approach direction of the light system (matches the runway) and FOUR to represent the glideslope angles used to determine level of the approaching aircraft in relation to the runway glideslope.

How to create a PAPI-4 Approach Lighting System

In the example, we will use a runway with designations of 08 and 26 as shown. We will focus on the approach end of runway 8 for this tutorial. Note the PAPI light system on the left of the runway. The runway heading for this example will be 78 degrees, as shown in Figure 2.

Figure 1: Direction of Approach

The FIRST separation plane (hereafter Separation Plane A) will be parallel to the runway heading but be facing directly opposite as shown by the dashed line with arrows, pointing toward the approaching aircraft. The basic understanding of separation plan A is this: If an aircraft is approaching from the direction indicated by the series of arrows, the PAPI lights will be visible and be lit, either RED or WHITE, depending on the height above the light system and the glideslope of the runway. If the aircraft is anywhere on the OPPOSITE side of the arrows, the lights will not be visible. To calculate the required Separation Plane A, reference Figure 2.

How to create a PAPI-4 Approach Lighting System

Figure 2: Direction of Approach and Separation Plane A Note the runway heading of 78 degrees is the same as the opposite angle in the lower left corner, which references the direction that the separation plane will face, 258 degrees. (78 degrees + 180 = 258 degrees). To determine the code required for the separation plan A, review the following figure, Figure 3. The each separation plane requires four components to define the limits of the plane, an X, Y, Z and vector length, entered in the following format:

How to create a PAPI-4 Approach Lighting System

SEPARATION_PLANE nolgt_2, <X component>, <Z component>, <Y component>, <vector> Note the locations of each of the components. The nolght portion of the code is an example name which references the then portion of an if-then check in the code. If the X, Z, Y components are NOT met, the nolght label is called in the code, otherwise, the code immediately following this definition line is executed. The vector portion is a number usually set to 32768. Note the calculations and the fact that the X and Y components become negative. This is due to the heading of the separation plane puts the tip of the vector in the lower left quadrant, making both X and Y negative. Also note that there is no Z component to be calculated. In the first separation plane in a PAPI light system, the plane points directly parallel to the ground surface, thus no rise in the Z coordinate, so Z will equal 0. The Separation Plane A will read as above, with the <WrongDirection> label changed to suit the developer.

Figure 3: Separation plane A calculations

How to create a PAPI-4 Approach Lighting System

The next steps are to develop the separation planes for the glideslope angles. A typical 4-lightbox PAPI system has four planes to configure the system, one for each light box. Each box, therefore, represents one angle plane that must be crossed for the light in the box to change from Red to White or vice versa. Note the figure below, Figure 4. This shows the typical angles used for a 3-degree approach, 4-PAPI system. The 3 degree approach line is the CENTER of the vertical path that defines the upper and lower planes of the glideslope. Because the 3-degree line is in the middle, and there are 4 planes that make up the glideslope system, there will be (2) planes above and 2 planes below the 3-degree plane. Mathematically, these planes will fall at 3.5 degrees, 3.1667 degrees, 2.8333 degrees and 2.5 degrees, spread at an even 0.5 degrees apart. For reference, I will label the planes Separation Plane B, C, D and E.

Figure 4: Glideslope angles and planes

How to create a PAPI-4 Approach Lighting System

Each of the slopes needs to have a plane configured. See the following figure for a reference to calculate the parameters needed. Note the angled slope of the plane at the XZ axis and the vector which is also tilted to reflect the particular glideslope angle. Each uses the angle of the glideslope and the common vector (32768) to figure the X and Z components. The Z component found in the level of calculation is considered the final number used in the separation plane coding. The X component found here is only temporary and is used in the next level of calculations, Figure 6 below.

Figure 5: Glide slope calculations Part I

How to create a PAPI-4 Approach Lighting System

Following is a summary of the FOUR sets of calculations, one each for each angle listed above, using Figure 5.

How to create a PAPI-4 Approach Lighting System

After finding the Final Z component and the temporary X component, the next level of calculations will allow you to complete the separation plane parameters.

Figure 6: Glide slope calculations Part II

How to create a PAPI-4 Approach Lighting System

Using the temporary X component from the FIRST level of glideslope calculations and referencing the calculations below, you can determine the FINAL X and FINAL Y components for the Separation Planes B, C, D and E.

How to create a PAPI-4 Approach Lighting System

Given the last calculations the separation plane components for B thru E are as follows: Plane B: 1398, 32737, 297, 32768 Plane C: 1584, 32728, 337, 32768 Plane D: 1770, 32718, 376, 32768 Plane E: 1956, 32707, 416, 32768 Plane A from the first level of calculation has components of, -32052, 0, -6813, 32768. The last step is to put these components into logical order and nest them to execute as needed, depending on the aircraft position on the approach path. Open the *_0.asm file you modified above and go to the section referencing the BGL_LIGHT code. Several lines of coding need to be added in order to allow the PAPI lighting to function properly. A. The first is the line BGL_ZBIAS 1. This will force the BGL lights to be of a higher drawing order and be seen better. B. Next, adding the SEPARATION_PLANE LINES.The first plane is the plane that decides if the aircraft is on the correct side of the lights to see them lit. I am using the figures as calculated above. For the code to create the If-Not-Then step, I am calling it WrongSide which will cause the code to end cleanly, and to NOT display the lights of the PAPI to the FS user note the ending of the code closes out with WrongSide C. The FOUR separation planes (B, C, D, E) need to be put in next. Add the lines shown BOLD. I left the original BGL_LIGHT coding un-bolded as it should be left untouched. The text shown in various colors illustrates the use of jump

How to create a PAPI-4 Approach Lighting System

points. When the separation plane code is read and tested, if the aircraft position does not meet the X, Z, Y components, the jump point link is used. Follow the link to the next location of that name and the code continues. The BGL_JUMP_32 command does essentially the same, jumping code that does not apply; because the code above it was just called and executed so the code immediately below it does not need to be used. PAPI05a_MasterScale_2 label BGLCODE BGL_ZBIAS 1 SEPARATION_PLANE WrongSide, -32052, 0, -6813, 32768 SEPARATION_PLANE below1, 1398, 32737, 297, 32768 BGL_LIGHT LIGHT_NAV, -10.393, 0.837, 8.926, 20, 0.60, 0.40, 0FFFFFFFFh, 0.000000, 0.000000, 1.000000 ; source poly num = 1313 BGL_JUMP_32 above1 below1 label BGLCODE BGL_LIGHT LIGHT_NAV, -10.251, 0.837, 8.799, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 1314 above1 label BGLCODE SEPARATION_PLANE below2, 1584, 32728, 337, 32768 BGL_LIGHT LIGHT_NAV, -3.516, 0.837, 2.899, 20, 0.60, 0.40, 0FFFFFFFFh, 0.000000, 0.000000, 1.000000 ; source poly num = 2627 BGL_JUMP_32 above2 below2 label BGLCODE BGL_LIGHT LIGHT_NAV, -3.374, 0.837, 2.772, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 2628 above2 label BGLCODE SEPARATION_PLANE below3, 1770, 32718, 376, 32768 BGL_LIGHT LIGHT_NAV, 3.361, 0.837, -3.128, 20, 0.60, 0.40, 0FFFFFFFFh, 0.000000, 0.000000, 1.000000 ; source poly num = 3941 BGL_JUMP_32 above3

How to create a PAPI-4 Approach Lighting System

below3 label BGLCODE BGL_LIGHT LIGHT_NAV, 3.503, 0.837, -3.255, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 3942 above3 label BGLCODE SEPARATION_PLANE below4, 1956, 32707, 416, 32768 BGL_LIGHT LIGHT_NAV, 10.238, 0.837, -9.155, 20, 0.60, 0.40, 0FFFFFFFFh, 0.000000, 0.000000, 1.000000 ; source poly num = 5255 BGL_JUMP_32 above4 below4 label BGLCODE BGL_LIGHT LIGHT_NAV, 10.380, 0.837, -9.282, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 5256 above4 label BGLCODE WrongSide label BGLCODE BGL_RETURN bgl_riff_end_PAPI05a label BGLCODE

Another change that can be made at this point is the color choice for the lights themselves. The developer can choose the actual colors to be used, by referencing standard hexadecimal color charts found online in various places. The hexadecimal colors are denoted as an 11 digit alpha-numeric code, such as 0FFFFF5F5h. The bolded portion of the coding can be changed to modify the actual color to be used. The bolded portion is a shade of RED but this could easily be changed to a shade of green or blue, by substituting the appropriate 6-digit portion of the code in place of the bold portion. I recommend searching the FSDeveloper forum for more information about color changes and the hexadecimal color format in general. After editing the *_0.asm file, save it and then run the *.asm file with the same name thru the BGL9.exe to recompile the *.mdl file. After you run it through the BGL9.exe, a *.bgl file is created. Delete the original *.mdl file and then rename the *.bgl extension to mdl.

How to create a PAPI-4 Approach Lighting System

The mdl file is now ready to be placed by manually editing the XML file or other methods, such as ObjPlacer. Keep in mind that the separation plane is created based on ANGLES. In the case of PAPI lights, the angles are for runway heading as well as vertical glideslope angles. Once the separation plane is coded correctly in the _0.asm file, the angles are set. This means that no matter how many times you try to adjust the heading of the mdl file using XML or other placement tools, the lights themselves will always be visible from the angles the separation planes were designed for. The object models themselves may rotate their position but the light will not change, as this is a code issue, not an object placement issue. It is recommended, as always, that any object created in Gmax be tested in its raw untweaked form to check for possible errors. Finding errors or corrupted files, etc. at the Modeling level may save time in correcting any issued before tweaking begins.

This ends the tutorial for Creating a PAPI light system. While the above is my method for creating the PAPI, other techniques may be used and may be more efficient for your purposes.

You might also like