sensorInk.shaderModule
- .metadata17 B
- README.md1.4 KB
- module.wgsl2.3 KB
README.md
sensorInk (shader module)
Keeps the ink of the blocks under a sensor. styleKit runs the Line slot before the Colour slot, and every sensor block replaces all colour, so without this a Style Cookbook line (starterBlocks, inkBlocks) would vanish under thermal, night vision or x-ray. sn_keep_ink(col, uv, amount) compares the picture the earlier blocks handed on with the frame as it entered the stack (sk_rendered), finds the thin strokes they darkened, and draws them back over the sensor picture as a distinct line: dark on a bright picture, light on a dark one. Broad washes and tints do not print, and with nothing under the sensor it costs two texture reads.
The thermal, night vision, x-ray, sweep and spectral shaders include it; every sensor block has a keepInk setting (0 drops the ink, 1 keeps it fully).
#include "~styleKit.shaders.skCommon"
#include "~styleKit.shaders.skRendered"
#include "~sensorBlocks.shaders.sensorInk"
// properties: sk_rendered (texture) straight after the shared header, keepInk (float)
// block.yaml: reads: [..., rendered]
col = sn_keep_ink(col, in.uv, material.keepInk);
Known limits
- It finds ink by darkening, so a light-coloured line (chalk on a board) under a sensor is not carried over.
- A stroke wider than about six reference pixels reads as a wash and fades out.
Used by sensorBlocks 1.0.6 and later.