Skip to content

NegativeLight Magic Effect flag

@Greatness7 is looking into various ESM things and discovered that the NegativeLight flag does something after all. It inverts the RGB values of the effect.

@Hrnchamd speculates that it was probably not supposed to do this (since it's pretty useless):

I think it could be due to something stupid like setting the rgb to negative but integer conversion overflows it to positive
It's probably supposed to be a negative light like regular lights but the calculations are wrong
e.g. r = 0.1
negative r = -0.1
-0.1 * 255 = -25.5
-25.5 to int = -25
store -25 (0xFFFFFFCF) in packed color = 0xCF, oops it just inverted it

G7 also noted the following:

I tried logging the actual generated NiPointLight colors, but they arent inverted. Despite visually looking obviously inverted.

So it's a little unclear how it actually works.

I confirmed that it didn't affect enchantment glow and the combined glow of a spell containing multiple effects appears to behave as though the RGB values are inverted before being combined. Which is to say a negative effect of 255, 0, 0 doesn't cancel out on a positive effect with the same RGB value.

Edited by Evil Eye