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.


  • \$\begingroup\$ 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 \$\endgroup\$ – DMGregory Jan 14 at 12:29
  • \$\begingroup\$ RGB24, no compression. \$\endgroup\$ – Ivan Feoktistov Jan 14 at 15:36
  • \$\begingroup\$ Is dl->intensity a shade of grey or else what is it? \$\endgroup\$ – user253751 Jan 14 at 20:08
  • \$\begingroup\$ 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? \$\endgroup\$ – Sergio Jan 15 at 10:04
  • \$\begingroup\$ @Sergio Good thinking, I opened map in Crafty, and apparently it is an effect from a gamma correction applied by the game engine. \$\endgroup\$ – Ivan Feoktistov Jan 17 at 17:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.