Portal Topper

The Portal topper has no moving parts. The application can control the following LEDs:

TopperBluePortal0 to 33

TopperOrangePortal0 to 13

TopperPortalLogo0 to 29

TopperGladosEye

TopperGI0 to 81

TopperReggie

TopperHLB0 to 51

The TopperBluePortal segment is the blue oval located in the lower center of the topper. Although the underlying LED string is straight, it appears to follow the bottom arc of the portal. This effect is achieved through the placement of an opaque cube in the center, creating the illusion of a continuous curved light path. The upper arc is not illuminated. Brightness is greatest at the ends of the arc and gradually decreases toward the center, as those LEDs are positioned farther from the arc. The application may optionally adjust the brightness of individual LEDs to compensate for this effect.

The TopperOrangePortal segment is the orange oval located in the upper-right portion of the topper. Although the underlying LED string is straight, it appears to follow the right side of the portal, with the left side remaining unlit. Brightness gradually decreases toward the center, though less noticeably than with the TopperBluePortal segment due to the smaller size of the orange portal.

The TopperPortalLogo segment illuminates the Portal sign at the top.

TopperGladosEye is the large single LED in the middle of GLaDOS in the top-left corner.

The TopperGI segment is the full-width LED string used for general illumination at the bottom of the topper.

TopperReggie is the large single LED in the middle of the personality core in the lower-right corner.

The TopperHLB segment is the blue Hard Light Bridge in the middle of the topper.

The numbers in the diagram are the first and last indices on that LED segment.

Topper Beams

Beam0 and Beam1 are single-color red LED strings.

Thematically, Beam1 starts at the turret, enters the orange portal, and exits the blue portal as Beam0 before hitting the Portal logo.

Each beam is controlled by a single PDLED output. All the lights in a beam are the same color, i.e., a single intensity of red.

The SDK only supports the declaration of RGB LEDs in the module definition file. The application must declare the PDLED output as part of an RGB LED definition and assign the individual element color to control a single output like this:

led.SetIndividualElementColor(rgbIndex, value);

where rgbIndex is an int from 0 to 2, and value is a ushort from 0 to 255.

Portal.json defines 3 RGB LEDs like this: SpecialFeatures0, SpecialFeatures1, and SpecialFeatures2. Those PDLED outputs control the cubes, Reggie toy, right ramp, gel lamp and kickback diverter. It is important to tag those RGB LEDs with "MapIntoSpecialLEDFeatures": "True". This tells the SDK to remove these LED definitions from p3.LEDs and add them to p3.SpecialLEDFeatures instead. This prevents a module-agnostic game from inadvertently treating them as actual RGB LEDs.

The module definition file does not declare what each PDLED output does. For Portal, the application does not need to know because the module driver takes care of these details.

The Portal module driver does not handle the topper beams because they use two PDLED outputs from the speakerPanel, which is declared in the base machine definition built into the SDK. Some older machines do not have an illuminated speakerPanel. The application must first check whether speakerPanel exists in p3.SpecialLEDFeatures before accessing it.

Beam0 uses the red (R) element (index 0), while Beam1 uses the blue (B) element (index 2).

The topper plastics try to convey that the ray starts condensed at the turret and becomes widest at the Portal logo. Because Beam1 is less dispersed by the plastics, it appears brighter than Beam0 at the same brightness setting.

The Portal game declares many GameAttributes to control the color of the topper LEDs. This is not part of the module driver. Each application can declare those GameAttributes for itself if desired. This is probably unnecessary.

In the Portal game, the default value is 100 for Beam0 and 60 for Beam1.

private const int Beam0RGBIndex = 0;

private const int Beam1RGBIndex = 2;

...

if (p3.SpecialLEDFeatures.ContainsKey("speakerPanel"))

{

    ushort beam0Value = 100;

    ushort beam1Value = 60;

    p3.SpecialLEDFeatures["speakerPanel"].SetIndividualElementColor(Beam0RGBIndex, beam0Value);

    p3.SpecialLEDFeatures["speakerPanel"].SetIndividualElementColor(Beam1RGBIndex, beam1Value);

}

LED Simulator

The LED simulator does not display the topper beams. This is expected, as they are not standard RGB LEDs.

When using Portal module driver version 1.0.3.2, shipped with P3_SDK_V0.9, the LED simulator displays many Portal topper LEDs in incorrect positions. The start and end indices of TopperPortalLogo and TopperHLB are inverted. TopperBluePortal and TopperOrangePortal are depicted as circles, even though the actual LED strings are straight lines positioned behind translucent 180° arcs.

For best results, make sure to test Portal topper light shows on the real machine.