benilla-re systems structs docs

s_lightScaleBias

global · terrain

Address
0x86aa24 · 4 bytes, up to 0x86aa27
Type
float
Meaning
Holds 0.5, taken off a scale before rounding
Confidence
verified, proof one
Finding
terrain/lights#light-colour-packing

Finding: Light colour packing in terrain: map lights

0x6a77e0 returns two colours from one. With M the largest channel byte (at least 1), the first output is the source, and when M is below the floor its HSV value is multiplied by floor / M and converted back to bytes (alpha 0xff); the second is the source, and when M is above the cap each channel c becomes (c × s + 0xff) >> 8 with s = round(cap × 255 / M − 0.5).

The derivation is in the doc.