Having quite some lava in my current map, I placed a couple orange lights (1 0.4 0.1 or thereabouts in RGB) with a “light” value of 600 each in various lava pools to make them emit a strong orange glow. The lightmap was properly orange, but the actual result was far from orange:
Green walls! How did that happen?
It turns out that the wall colour is a result of multiplying the lightmap with the wall texture, scaling for overbrights, and clamping the end result. The texture in this case is Quake’s standard greyish metal/stone wall, metal4_4. Now if you take a closer look at that texture, you’ll notice it has a lot of blue/grey and a large amount of green pixels in it. It is actually rather green when compared to a real grey texture. It has practically no red.
What happens has to do with a) the existing colors of the wall texture and b) the “clamping” of the light value. The latter clips away any “excess” light value above 255…
Apparently my light setting of 600 was so strong that it amplified the red component of the light (1 0.4 0.1, remember, R G B) so much that it got clipped at 255. However, the green component was also hugely amplified. This made the green component appear relatively stronger than it normally does.
MH explained it like this: The area just seems to be far too bright which is causing the red contribution to clamp at 255 and the green to contibute more than it otherwise would.
On top of that, the wall texture contains lots of blue and green pixels, but practically no red. Again, green gets amplified while red loses out. Spike:
05:58 < Spoike> that texture is mostly blue, right?
05:58 < Spoike> a little green, but no red?
05:59 < Spoike> in which case 0*red = 0, 0.5*green = 0.5 1*blue = 0
05:59 < Spoike> hence green
So how do I avoid the clamping of my red component? By keeping the light value relatively low. This sadly means that if you try to have very bright, high intensity colored lights in GLQuake, nasty color shifts in the wall textures may appear.
So I set the light value way under 200 and that made the color shift disappear. Then, step by step, I went higher. Currently it’s at 200. The downside of this is that your light doesn’t reach as far as a 600 light one and the general impression is less intense. However, you can somewhat make up for this by setting a very low “wait” value. By that I mean, 0.5 or less. A wait of 0.5 will double the falloff distance of the light. I’m currently at 0.4 (!).
Now this is better. I’m using the Quake retexturing Project pk3 there (hi res textures), but you can still compare the rune textures, which are the same. It’s clearly a lot more orange. What happened is that the clamping is avoided, and the falloff distance of the lights is artificially increased.
This does away with most of the sickening green color shift even with the original low-res metal4_4 texture. Learn something new every day. More shots, again using largely QRP textures:
The brighter orange to the front right stems from a few large flame braziers. I might shift that a little more towards white still. But notice the orange in the corridor – it’s the lava beneath. This also looked very green previously.
This area as well – compare this to the screenshots in the Demo #2 announcement below. Again, the greenish tinge is largely gone. I consider this something of a success, but it pissed me off to no end until I slowly lurched closer to the ideal values. Not quite there yet, but better.