# How do I fix this unintentional chromatic aberration on a lightmap?

Some strange rainbow halos (front and left) appear after computation of a lightmap for direct light. The formula is

dot * dot2 / ( dist * dist ) * dl->intensity


with gamma correction, lightmap is computed as vec3_t and ultimately cropped to 3 bytes. However, brightness of the region in question fit into 255 nicely, and even calculating in byte instead of float beforehand - result in just a subtle "oil painting" effect and does not produce such artifact across entire image.

My best guess is how this artifact appear from base change in a floating point math, but I don't know for sure nor do I understand what exactly is happening.

• What format do you save your lightmap in? Do you use any compression? You might need to apply some dithering to break up the quantization banding, as described in this talk – DMGregory Jan 14 at 12:29
• RGB24, no compression. – Ivan Feoktistov Jan 14 at 15:36
• Is dl->intensity a shade of grey or else what is it? – user253751 Jan 14 at 20:08
• Are you sure it is texture itself where problem resides? Maybe it is caused by some post processes? Does texture have this problem when viewed in external viewer? – Sergio Jan 15 at 10:04
• @Sergio Good thinking, I opened map in Crafty, and apparently it is an effect from a gamma correction applied by the game engine. – Ivan Feoktistov Jan 17 at 17:59