Log inGet started
World

Sensor Looks: Thermal, Night Vision and X-ray

Branchmain
Commita92ee78fb2

README.md

SensorBench (module)

Measures what a sensor look costs on the machine it runs on, with the engine's own profiler: engine CPU time per frame (profiler.cost) with no sensor look and with a look on, and the GPU time of the look's own passes (profiler.gpuFrame: styleKit's per-block passes and shared capture). It spawns test objects first (2,500 by default) and removes them after. The same code runs in the desktop app and in the browser, and engine.platform in the result says which, so the two are measured the same way. sensorBlocks' README publishes its numbers; the showcase's sensor panel has a "Measure cost on this device" button that runs it.

local Bench = require("~sensorBlocks.SensorBench")
local r = Bench.run({ looks = { "militaryThermal", "gen3NightVision" } })   -- in play, takes a minute
print(r.platform, r.drawn, r.off.cpu, r.looks.militaryThermal.gpu, r.looks.militaryThermal.cpuDelta)

Known limits

  • GPU numbers need timestamp queries; where the device or browser has none, gpuSupported is false and only CPU is reported.
  • The numbers are this machine's at the size it draws; post-process GPU cost scales with the number of pixels.
  • Other programs on the same machine move the CPU numbers a little; compare the look-on and look-off windows, not single frames.