Log inGet started
Package

sensorBlocks.package

This package holds more than this page lists. See all of its files in its world.

README.md

Night vision: auto-gated (styleBlock, Colour)

Auto-gated gen-3 night vision, the special-forces tube: a clean green picture that dims itself the moment a bright light comes into view. A lamp, a fire or a muzzle flash stays a small hot spot with a tight halo instead of washing the tube out, and the picture comes back up when the light leaves the view.

The shader reads how much bright light sits on a 4 x 4 grid of points of the frame and cuts its gain to a third and its halos by up to 70% as that grows. It ramps with the amount of light rather than switching, so a flickering campfire dims the picture gently and never flashes the whole screen. autoGate sets how strongly it gates (0 off, 1 full); any other night vision block can turn it on too.

local Sensors = require("~sensorBlocks.Sensors")
Sensors.use("nvAutoGated")                 -- on this machine only (your goggles)
Sensors.use("autoGatedNightVision")        -- the ready-made look: auto-gated through binocular tubes
Sensors.flash(explosion.position, 1)       -- a flash still dazzles it, for a moment

What it gives up in motion

Amplified light moves with the scene, so nothing slides. The fine grain changes every frame per pixel, a noise rather than a flicker. The gate is worked out fresh each frame from 16 fixed points of the picture and ramps with how much bright light they see, so a light turning into view dims the picture smoothly and a flickering fire moves it only a little; it never switches the whole screen on and off. A flash washes the picture out and it recovers over about a second and a half; the runtime lets at most three of those begin in any second. The honeycomb is fixed to the screen, as on a real tube.

How it treats content

  • Opaque things: their light amplified, plus the illuminator near and ahead; the whole picture dims while a bright light is in view.
  • Transparent things (glass, water): their light like anything else; a lamp behind glass gates the tube like any lamp.
  • Particles and smoke: bright particles (fire, sparks, muzzle flashes) are what the gate reacts to: they stay small hot spots with tight halos.
  • Sky: a moonlit sky turns green; a bright sky fills the gate's points and keeps the picture dimmed.
  • Fog: lit fog brightens the picture and can gate it a little when it glows strongly.
  • Skinned characters: like any surface, with their role marked so players and enemies read apart.
  • Foliage: leaves read brighter (near infrared).
  • World text: amplified like the rest and readable when lit; screen UI is drawn after the stack and is never touched.
  • Black does not stay black: an intensifier makes visible what the eye could not see.

Known limits

  • The gate looks at 16 fixed points of the frame, so a very small light between them dims the picture less than a large one.
  • It gates on what is bright on screen, not on where a light is: a bright white wall in the illuminator's beam dims it too.