Log inGet started
Package

sensorCommon.shaderModule

README.md

sensorCommon (shader module)

What every sensor block shares, in WGSL: reading the sensor input (viewer, time, flash blinding, goggles power, sweep angle, gain, heading, infrared illuminator), the live pings, the contact under a pixel with its role, per-pixel sensor grain, and the exit every sensor block returns through. Used by all six sensorBlocks shaders (thermal, nightVision, optics, xray, sweep, spectral) and by any sensor block you write.

FunctionWhat it gives
sn_contact(uv)The contact at uv: x role (0 none, 1 you, 2 ally, 3 enemy, 4 elite or boss, 5 pickup, 6 hazard, 7 objective), y how far inside, z moving, w index.
sn_role_cue(col, uv, c, strength, ink, tint)Marks the role so things read apart in one colour: you and allies a steady outline with a slow 1 Hz friend-or-foe blink, enemies a bright outline and diagonal hatching, pickups a slow shimmer, hazards a dashed outline.
sn_role_colour(role)A role's accent colour for sensors that show colour.
sn_blind_apply(col, ink, sensitivity)The flash wash-out (rate-limited by Sensors).
sn_power_apply(col, uv, ink)Goggles switching on: instant, tube warm-up, old monitor or digital boot.
sn_grain(uv, rate, cell)Fine per-pixel noise, never a whole-screen flicker.
sn_silhouette(uv, px)Where an outline belongs.
sn_finish(uv, src, styled)Use instead of sk_finish: strength, mask and layer mode as styleKit applies them, without the black-stays-black cap (a sensor makes light where the eye saw none).
// block.yaml: reads: [frame, depth, normal, albedo, "input:sensor"]
// properties.yaml: - { name: in_sensor, type: texture, default: black }
#include "~styleKit.shaders.skCommon"
#include "~sensorBlocks.shaders.sensorCommon"

Include it after styleKit's skCommon. With nothing published it falls back to safe values (power on, no pings, no contacts).

Known limits

  • At most 32 contacts and 8 pings are in the input.
  • Contact shapes are boxes fitted to bounds, so outlines follow the box edge where the silhouette test finds none.