Joined: 08 Aug 2004
Location: Lage Zwaluwe
|Posted: Mon Nov 14, 2005 9:16 am Post subject: Lightmapping of transparent surfaces improved (DeleD 1.34)
|Well, with just a few days left before the DeleD 1.34 deadline (*pant pant*), I applied a quickfix to the lightmapper algorithm.
Although I'll try to write down something sensible, things might get a bit technical. Feel free to skip the text, look at the image, and say "ok".
The old lightmapper algorithm was based on the assumption that light passing through a 'darker colored' medium would turn out less bright than light passing through a 'brightly colored' medium. Hence, if the transparent color of a window was dark gray, barely any light would pass through.
However, as some user (thanks afecelis!) clearly pointed out, that is not the expected behaviour, because the texture color of a transparent surface is not representative of the underlying material. When for example a window texture is dark, it usually doesn't mean that the actual glass material is dark, but that for example the texture is in shadows, or the room behind the window didn't have the lights on.
So now the new algorithm works like this:
(a) Alpha determines the brightness of the light passing through.
(b) Hue determines the color filter (without influencing brightness).
Resulting in images like this (the old lightmapper would have caused an almost solid shadow when shining through this particular texture):
Note for future improvement: in the image above, the light gets pretty blueish. Reason for this is that the window color is pretty much blueish (although because of it's low intensity it doesn't show very well). Depending on your application you might or might not want this to show up that clearly. In the future, the lightmapper will have a global or per-material setting to set the amount the texture hue affects the final light color (including the possibility to simply turn it off).