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

> Discover how Gods Eye View implements CRT NVG and FLIR sensor lookups using data-driven mappings and shaders in src/ui.js. Enhance your visualization pipeline today.

- Repository: [Bilawal Sidhu/gods-eye-view](https://github.com/bilawalsidhu/gods-eye-view)
- Tags: internals
- Published: 2026-09-12

---

**God's Eye View implements CRT, NVG, and FLIR sensor lookups as data-driven mappings in [`src/ui.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L993-L994):

```js
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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L360):

```js
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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L9222) handles specific display contexts:

```js
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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L3157):

```js
/** 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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L3025):

```js
// 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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js#L3189), the system synchronizes IR channels:

```js
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:

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

```

To read the current sensor's UI label:

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

```

To apply cockpit-specific sensor boosts directly:

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

```

## Key Implementation Files

The **sensor lookup implementation** spans these primary files:

- **[`src/ui.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js)** – Central lookup tables (`labels`, `names`), sensor-style UI resolution, and rendering guard logic ([source](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/ui.js))
- **[`src/cockpitVisionPolicy.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/cockpitVisionPolicy.js)** – Handles cockpit-only post-process overrides for NVG/FLIR/CRT/NOIR with IR boost synchronization ([source](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/cockpitVisionPolicy.js))
- **[`src/styles/retro.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/styles/retro.js)** – Defines the CRT shader including scanlines, barrel distortion, and vignette effects ([source](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/styles/retro.js))
- **[`src/styles/thermal.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/styles/thermal.js)** – Defines the FLIR shader implementation and pixelation parameters ([source](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/styles/thermal.js))
- **[`src/styles/nvg.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/styles/nvg.js)** *(if present)* – Defines the NVG shader boost and color grading

## Summary

- **God's Eye View** uses pure data-driven mappings in [`src/ui.js`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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`](https://github.com/bilawalsidhu/gods-eye-view/blob/main/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](https://github.com/bilawalsidhu/gods-eye-view/blob/main/src/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.