How Gods Eye View Implements CRT, NVG, and FLIR Sensor Lookups

God's Eye View implements CRT, NVG, and FLIR sensor lookups as data-driven mappings in src/ui.js, where lookup tables translate internal sensor keys into display labels while the rendering pipeline activates corresponding shaders for scanlines, night-vision boost, or thermal imaging.

The open-source God's Eye View repository uses a declarative lookup system to manage sensor visualization modes. This article examines how CRT, NVG, and FLIR sensor lookups are implemented across the UI and rendering layers, mapping internal identifiers to human-readable labels and shader effects through centralized configuration tables.

Sensor Lookup Architecture in src/ui.js

The implementation centers on src/ui.js, which hosts the primary lookup tables that drive both interface labeling and rendering decisions.

Display Label Mappings

Two parallel dictionaries map internal sensor keys to interface strings at ui.js#L993-L994:

const labels = { optical: inherited, crt: 'CRT', nvg: 'NVG', thermal: 'FLIR', noir: 'Noir' };
const names  = { optical: inherited, crt: 'CRT', nvg: 'Night vision', thermal: 'Thermal', noir: 'Noir' };

These definitions provide O(1) lookup performance for HUD rendering and dropdown menus.

Retro Style Resolution

The UI exposes a "retro" entry that resolves to the CRT sensor type at ui.js#L360:

retro: 'CRT',

This mapping ensures consistent sensor key normalization before shader selection.

Display Name Resolution for HUD Elements

An additional lookup table at ui.js#L9222 handles specific display contexts:

const displayNames = { surveillance: 'NVG', thermal: 'FLIR', retro: 'CRT' };

Rendering Pipeline Integration

Beyond UI labels, the sensor lookup system triggers specific post-processing shaders and cockpit vision policies.

Shader Activation and Post-Process Overrides

When a sensor style becomes active, the rendering code injects the appropriate shader parameters. The system supports temporary cockpit-only overrides as noted at ui.js#L3157:

/** Apply a temporary cockpit‑only CRT/NVG/FLIR/NOIR post‑process override. */

The shader system auto-detects time-based uniforms for animated effects at ui.js#L3025:

// Auto‑detect time uniform — animated shaders (CRT scanlines, snow, etc.)

Cockpit Vision Policy and IR Boost

The cockpitVisionPolicy class manages channel-specific boosts based on the active sensor selection. At ui.js#L3189, the system synchronizes IR channels:

this._syncIrBoost(); // Cockpit vision override ('nvg'/'thermal' boost; CRT/NOIR clear)

Programmatic Sensor Control

Developers can interact with the sensor lookup system through the viewer API to switch modes and retrieve labels.

To activate FLIR (thermal) view programmatically:

// Maps internal 'thermal' key to FLIR shader activation
viewer.setSensor('thermal');

To read the current sensor's UI label:

const current = viewer.getCurrentSensor();   // e.g., 'crt'
const label   = viewer.ui.labels[current];   // → 'CRT'

To apply cockpit-specific sensor boosts directly:

// Enables night-vision IR channel amplification
viewer.cockpitVisionPolicy.applySensorBoost('nvg');

Key Implementation Files

The sensor lookup implementation spans these primary files:

Summary

  • God's Eye View uses pure data-driven mappings in src/ui.js to resolve sensor keys to display labels and shader configurations.
  • The lookup tables at lines 993-994 provide constant-time resolution for CRT, NVG, FLIR, and Noir sensor modes.
  • Retro style entries map to CRT sensors before shader selection occurs.
  • The rendering pipeline activates post-process overrides based on lookup results, with automatic time-uniform detection for animated effects.
  • Cockpit vision policies handle IR channel boosts for night vision and thermal sensors while clearing effects for CRT and Noir modes.

Frequently Asked Questions

How do I programmatically switch to FLIR mode?

Call viewer.setSensor('thermal') to activate FLIR view. The system looks up the 'thermal' key in the internal labels table and activates the corresponding shader from src/styles/thermal.js while updating the HUD display name to "FLIR".

Where are the CRT scanline effects defined?

CRT visual effects are defined in src/styles/retro.js, which implements scanlines, barrel distortion, and vignetting. The UI layer references this style when the lookup table resolves a 'retro' or 'crt' sensor key.

What is the difference between NVG and FLIR implementations?

NVG (Night Vision Green) and FLIR (Forward-Looking Infrared) use distinct lookup keys—'nvg' and 'thermal' respectively—and different shader pipelines. NVG applies a green channel boost via cockpitVisionPolicy, while FLIR uses tone-mapping defined in src/styles/thermal.js.

How does the UI determine which sensor label to display?

The UI queries the labels and names dictionaries defined at ui.js#L993-L994. When viewer.getCurrentSensor() returns a key like 'nvg', the interface renders the corresponding value 'NVG' or 'Night vision' depending on the context.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →