VIPER 11 · NotesFly it →

Note 8 of 15

Jets made of numbers

How the F-35C and the Super Hornet were built in code from fact sheets and locked reference images, and why the F-16 was rebuilt alongside them.

For a long time VIPER 11 had one jet, and you only ever saw it from the inside. Now the hangar has three: the F-16C you have always flown, the Navy’s F-35C, and the F/A-18E Super Hornet. None of them came from a 3D model store or a sculpting program. Each one is a few thousand lines of TypeScript that build the airframe when the page loads, from numbers someone looked up.

Start with the facts

Every jet begins as a reference pack: a fact sheet and a handful of images, kept in the repository next to the code. The fact sheet covers dimensions, weights, engines, control surfaces, gear, cockpit and paint, and every line says how far it can be trusted: official, a reputable ref, weak (a forum or a model kit), or our own estimate. The F-35C’s length, 15.70 m, is official. Its folded span, about 9.1 m, is weak, because nobody publishes it.

The images are the other half. An image model draws one master view, three-quarters from the front, from a short list of facts that must hold: two canted fins, a two-wheel nose gear, no gun bump. That master is locked, and the side, front and top views are edited from it, so all four show the same aircraft. Each view is measured before it is kept. The F-35C’s top view came out at a span-to-length ratio of 0.84 against a real 0.835, so it stayed; an earlier one at 0.76 was thrown away.

Even the kept images are wrong somewhere, and the pack writes down where. The F-35C’s top view shows a tailhook you couldn’t see from above. Every Super Hornet image makes its fins too tall. So each pack carries the same instruction: lock the proportions to the numbers, not to the pictures. The pictures settle what numbers can’t, like where a panel line runs.

The F-16, F-35C and Super Hornet seen from directly above, side by side at the same scale
The three from above, to scale. F-16C 15.1 m long, 9.5 m across the wingtip rails. F-35C 15.7 m by 13.1 m: the carrier version’s wing is so big that its span is 84% of its length. Super Hornet 18.3 m by 13.6 m, with the long leading-edge extensions running forward beside the cockpit.

Built from cross-sections

The fuselage is built like a boat hull. At a few dozen stations along the body, the code describes a cross-section: a chain of points round the right half, from spine to belly, with a curve between each pair. Where the curve passes smoothly through a point, the skin is smooth. Where it turns, there is a crease: a chine, the hard edge along the F-35’s nose. Each point is then interpolated along the body with a curve that never overshoots, so two stations a couple of centimetres apart make a crisp intake lip.

Wings and tails are thin surfaces built from their outlines. Gear, doors and nozzles are tubes and plates. The paint is drawn on canvases, in metres, as seen from above, below and each side, then projected onto the jet from where each point sits at rest. So when a wing folds, its stars and panel lines go with it.

Each jet comes in two levels of detail, one for close up and one for a jet far away in the sky:

Building one, paint and all, takes about half a second on a fast laptop, from 2,200 to 2,500 lines of code per jet.

Everything that moves

Every part that moves on the real jet is its own named node, hinged on the line it really turns about, and one call drives them all: jet.set({ gear, canopy, hook, fold, … }). The game, the menu’s turntable and the trailers all use it, with the same names and signs on all three jets.

The values are fractions, and each jet decides what a fraction means. At gear: 0.5 the doors are already open: they take the first 30% of the travel and the legs the rest. fold: 1 stands the F-35C’s outer wings up at 90° and the Super Hornet’s just past vertical, at 100°. The F-35C’s canopy hinges at the front; the other two hinge at the back.

Figure 1 · The jets, live

The F-35C on the turntable, gear down

Loads when you scroll here, about 200 KB.

This is the game’s own exterior code, running in this page, with the start menu’s studio light. Drag to turn the jet. The sliders call the same set() the game does. The F-16 has no wing fold: it was never meant to go to sea. With the gear down, the Navy jets’ launch bar drops with the hook, as it would on deck.
The deck routine. The outer wings fold so the two carrier jets take less room on a crowded deck. Canopies open, hooks and launch bars come down. The F-35C’s ailerons ride up on its folding panels.
Gear up and down on all three. The doors open first and the legs follow. The F-16’s nose leg folds back into the underside of its intake, and its main legs swing forward and in, into the fuselage.

Why not a generated mesh

You can ask a model to turn pictures into a 3D mesh, and sometimes that is the right call. The pilot’s gloved hands and flight suit were made that way, because hands are soft and hard to describe with numbers. A jet is the opposite: exact measurements, and parts that move.

The cost is time. Most of the work is looking at a render next to a reference and moving a number by a few centimetres.

The F-16, rebuilt

The F-16 was the hardest, because it already existed. Its cockpit came first, built to match a real cockpit clip, with just enough airframe to be seen from the seat: nose, canopy, strakes and wings. On the menu’s turntable it was a stand-in made from that shell, with the cloud-shadow proxies for a tail.

Its full exterior had one rule: the cockpit is the anchor. The radome, forebody and canopy are imported from the cockpit’s own code, and the airframe hangs off one offset from the pilot’s eye, 2.55 m up and 4.12 m ahead of the main wheels. A check image draws both silhouettes from the GoPro, in cyan and red, white where they agree. Everything new fits round that: the Block 50’s big-mouth intake, the blade antennas on the nose, the split speedbrakes.

Three cockpits, one piece of glass

From inside, each jet has to feel like itself within a second, and most of that is what frames the view. The F-16 has nothing over your head: a bubble from nose to seat, a tall HUD, a side-stick at your right hand. The F-35C has no HUD at all. Its symbology is in the helmet, so the glareshield is low and bare, and one 20 × 8 inch touchscreen runs across the panel. The Super Hornet has an arch: a wrap-around windscreen and a thick bow overhead with mirrors and grab handles. Under it are a low-profile HUD, one 10 × 19 inch display, a centre stick and two throttles.

Figure 2 · From the seat

The F-35C cockpit from the helmet camera: the helmet symbology over the sky, the panoramic display below
The F-35C. The green ladder floats in the sky with no glass under it: that is the helmet display, drawn far out along the pilot’s line of sight. Below it is the panoramic display, two halves with a seam. All three are the same moment: 12,000 ft over the sea, 420 knots, the afternoon sun behind the left shoulder, seen from the GoPro on the back of the helmet through the game’s lens. Captured in the Super Hornet’s cockpit lab, which can swap in the other two.

What they share is the physics of the glass. A canopy in VIPER 11 is a coated polycarbonate sheet with two reflecting surfaces, Fresnel for a refractive index of 1.585, scratches that light up in arcs round the sun, smudges and dust, droplets that slide aft with airspeed, and the cockpit and helmet reflected inside it. None of that cares about shape. So each jet hands the lens a short list of glass pieces: a surface, a sheet size for tiling the scratches, a coating colour and strength, a reflection blur, and how scratched, smudged and dusty it is. The F-16’s is the default. The F-35C’s is longer and flatter, with a stronger gold. The Super Hornet’s is near-clear.

The F-35C cockpit at golden hour, the sun scattering in scratches on the canopyThe Super Hornet cockpit at golden hour, the sun beside the canopy bowF-35CSuper Hornet
Drag to compare. The same golden-hour sun, the same glass physics, a different shape. The scratch arcs round the sun and the halo on the glass come from one shader. Only the surface they’re drawn on and the coating differ.

One small difference is kept on purpose. A HUD is real light on real glass, so the F-16’s and the Hornet’s show faintly in the canopy’s reflection, a green ghost overhead. The F-35’s symbology is inside the visor. It sits on a layer the reflection cameras can’t see, so it never reflects, and it blanks where it would cover the panel display, as the real helmet does.

Not everything is finished. The Hornet’s windscreen should be sharper and cleaner than its canopy, but the lens still draws one piece of glass. For now both are cut from one surface, the bow hides the seam, and the canopy’s optics serve for both. Each piece already carries its own numbers for when the lens can draw two.

Flying them

The F-35C is in the plane picker now, with its own flight model, its own engine sound and the helmet display. The Super Hornet is built inside and out, and you can see it in the figure above. Flying it is next. It needs its own flight model, with an on-speed approach at 8.1° angle of attack against the F-35C’s 12.3°, and the sound of two engines instead of one. It will be in the hangar soon.

Fly it

viperoneone.com

VIPER 11 is a browser flight game: three.js, WebGL2 and Web Audio. Every figure on this page is drawn from the game’s own code and numbers. Made by apek. Follow me @apekshik for what’s next.