Babylon migration · 2026-10-11

The main game now also runs through Babylon's WebGL2 renderer at /babylon/.
The previous Three.js renderer remains available at the original main URL.
This is a rendering migration with a compatibility layer: existing Three.js CPU
scene objects, GLTF parsing, animation mixers and geometry builders are retained.
No Three.js WebGLRenderer is instantiated in the Babylon application.

Connected functionality:
- Documented mission briefings, original source/unknowns, historical contacts.
- Bråvalla departure, WGS84 navigation, geographic coast, OSM cities/roads,
  Vättern elevation/lake, map, place names and dynamic titles.
- Local SR mission audio, local Russian radio, YouTube training/exercise radio,
  Spotify, native motor audio and browser-autoplay fallback controls.
- All existing camera modes, orbit controls, separate cockpit depth passes,
  HUD visibility, clean mode, manual/autopilot flight and pause.
- Action arena, DCS aircraft/interior, animated control surfaces, weapons,
  unlimited action stores, terrain protection and targets.
- Formation patterns, city airshows, seven-aircraft shows and demo stages.
- Pilot animation, aircraft identities, opponent models, PBR textures,
  custom paint/patina, cloud sky, dynamic exhaust and condensation shaders.
- Original Wave Dynamics spectrum/FFT, executed with native Babylon
  EffectRenderer passes (256² spectrum, matching the previous game). All runtime libraries are local.

Verified in browser: Bråvalla historical takeoff and playing SR report;
action landscape/exhaust/DCS cockpit; Moscow seven-aircraft airshow;
Su-24 and Su-34 demo with local Russian radio; Motala/Vättern training
with episode 2 player. Simulation tests pass for action, cameras, missions,
navigation, training, formations, every city airshow and HUD visibility.

Differences/limits: transmission uses transparent PBR glass
rather than full screen-space refraction. Some first appearances require shader
compilation. No controlled performance comparison or multiplayer server exists.
YouTube/Spotify still require internet. Native offline ZIP uses a local server.

Build: python3 scripts/build_babylon.py /path/to/esbuild
Package: python3 scripts/package_babylon.py
Web delivery: boot.js decompresses the local gzip bundle explicitly because
Cloudflare Pages does not preserve custom Content-Encoding. The online bundle
uses a content-hashed filename and a versioned loader URL to avoid stale code. Modern browser
DecompressionStream is required online; the local ZIP loads plain JavaScript.

Stage: python3 scripts/prepare_babylon_web.py (after main site's staging)
Start: python3 -m http.server 8910, then http://127.0.0.1:8910/babylon/
Generated bundle/environment/wave-source files are not hand-edited.

Licenses: Babylon engine/materials Apache 2.0 (LICENSE.txt).
Reflection environment: BabylonJS Assets, environmentSpecular.env,
https://assets.babylonjs.com/environments/environmentSpecular.env
CC BY 4.0, ASSETS-LICENSE.txt; used unchanged.
Models/radio/geodata: existing viewer/ACTION-SOURCES.txt, COPYING.txt,
OPPONENT-LICENSES.txt, MATERIAL-SOURCES.txt and audio source registers.
Original wave implementation: viewer/vendor/LICENSE-waves.txt.
Official API reference: https://doc.babylonjs.com/

Visual parity update · 2026-10-11
- Transparent serial canvas, linear-space replacement paint, cleared canvas updates.
- Source ACES/sRGB chunks restored for custom shaders, including every branch.
- Hemisphere sky/ground light, glTF right-handed normals, AO, per-pixel irradiance
  and specular antialiasing. Procedural wear roughness retained in reflectivity hook.
- Legacy fuselage normals smoothed across UV seams at 54 degrees; original
  positions, UVs, silhouette and hard edges retained.
- FFT 256², screen-footprint slope filtering and energy-adjusted distant sun glint.
- 48-sample exhaust integration and travelling, irregular pulse.
- Detailed DCS interior in Cockpit/HUD for all modes, matching camera and screens.
References: renders/three-water-reference.png and babylon-water-before.png;
updated renders/babylon-water-after.png and babylon-detailed-cockpit.png.
Native normal convention: Babylon glTF loader uses inverted X in right-handed scenes.

FFT ocean revision · 2026-10-11
Original WaveFFT and native Babylon WaveFFT were read back on the same GPU
for wind/time (11,0), (11,12.5), (20,12.5), (5,41). All RGBA float values
match exactly after fixing wind changes at a paused clock (max error 0).
The presentation now combines complementary spectral bands: 256² / 256 m
short waves and 128² / 1536 m long waves, phase-locked to geographic position.
The power windows sum to one, avoiding doubled energy in their crossover.
Sky/cloud reflection uses a cheaper three-octave version of the scene sky;
sun glint follows the scene light; whitecaps are a procedural compression cue,
not fluid-simulated foam. Vättern shares wave textures/weather with local UVs.
Checks: scripts/test_ocean_bands.js; babylon/fft-validation.html (bundle its
JS with esbuild first). GPU comparison: references/fft-babylon-parity.json.
Local 1280×720 low-flight sample: median 16.7 ms, p95 17.6 ms, CPU 4.7 ms;
a smoke test, not a hardware-independent performance guarantee.

DCS-only fleet · 2026-10-11
All own/peer/demo/airshow/training aircraft now use Community JAS-39-C.
Factory instances share geometry/textures with per-aircraft transform channels,
glass and dynamically painted fin numbers. No runtime load of gripen.glb.
Legacy extra landing gear/exhaust removed; DCS gear and nozzle animation used.
Pilot camera and all instrument panels use the DCS layout. Historical contacts
remain their documented Russian types. Earlier source assets are retained only
for provenance and archival work; web/Babylon packages exclude the old GLB.
Validated: DCS fleet isolation, formations, all city airshows, action and cameras.

2026-10-11 — original FFT wave motion restored
The production ocean now uses the complete original Wave Dynamics 512x512
spectrum, without the reseeded two-band swell or animated procedural foam.
Babylon displacement is identical to the original Three GPU FFT in four cases
(winds 5, 11 and 20 m/s; times 0, 2, 12.5 and 41 s; maximum error 0).
A 384x384 exponential mesh provides <2 m spacing at its center while retaining
180 km coverage. Normal filtering only reduces subpixel distant-wave shimmer.
Original Fresnel/crest shading restored; haze now applied after crest lighting.
Side-by-side comparison: ocean-compare.html, same wind/time/camera in both engines.
Local game measurement: median 16.6 ms, p95 18.7 ms (not a hardware guarantee).

High-altitude correction: suppress geometric FFT displacement where the
camera-centered grid cannot resolve the 256 m spectrum. Low-pass normal samples
over each pixel footprint to avoid distant-wave aliasing. FFT evolution unchanged.
Gripen C fleet defaults: 213, 248, 274, 276, 223, 227, 289. E-only 609 not assigned.
Grey DCS paint: reduced metalness, matte roughness, stronger authored normal detail
and stable object-space wear; no replacement with the older airframe.

Exterior lighting revision: removed legacy opaque red/green spheres and separate
formation blink logic. Native intake navigation lenses, small aft-facing white
launcher position lights, and one short white fin strobe shared by every aircraft.
Fin strobe moved outside the mesh rear edge (5.01,2.56,0); previous point was inside
fin geometry. Halo uses physical size, depth occlusion and viewing sectors.
Timing 1.15 s / <85 ms pulse is a visual approximation, not a certified sequence.
Reference: https://www.saab.com/globalassets/products/aeronautics/gripen-c-series/gripen_c-foldout.pdf
Saab cutaway items 45 (navigation), 66 (rear position), 80 (anti-collision).

Multiplayer (2026-10-11): eight live WebSocket participants, server-authoritative WGS84 flight, leader orders/transfer, AI default, 213/248/274/276/223/227/289/273 identities and fuselage nickname UV paint. Shared fictional Gulf of Finland mission and original Project 20380-inspired procedural ships. Read multiplayer/README.md in the source archive. Multiplayer requires internet; it is separate from source-verified SR missions.
