PDA

View Full Version : Colored lights add to create white light



bmos
September 26th, 2021, 19:37
49286

LordEntrails
September 26th, 2021, 20:29
This is a known issue with the lighting system. There are some good early discussions on it somewhere around here. One, if I remember, from a physics professor who deals with light experiments etc.

It comes from the simple way that in most digital systems, FGU included, lights are additive in RGB format (i.e two lights of RGB values of 100,100,100 becomes a lit area with a value of 200,200,200), and that once an area gets to have a value of more than 255, the value is clipped to 255, which means lights tend to add to white.

To prevent this, you need to make sure the values of your individual sources won't combine to values greater than 255.

HywelPhillips
September 27th, 2021, 20:36
Indeed, I posted about this when the lighting stuff was released.

The simplest workaround is to:
1) Set the alpha channel of all your lights to something like 190 or 200 rather than 255. This gives you some headroom to avoid clipping.
2) If you want coloured lights, make them more saturated (so if you want a strong red, turn down the green and blue channels, for example). More pastel colours clip to white more quickly.
3) Avoid overlapping areas of bright light. For example, if a map has a lot of candles or torches placed close together, use one light with a bigger radius rather than lots of little overlapping lights.

It's not foolproof- I'd really like FG to implement nice roll-off to prevent clipping, or do the calculations in a better colour/gamma space before transforming back to sRGB to display. But those three things will get you a long way towards making the colours look like you want them to look.

Cheers, Hywel

HywelPhillips
September 27th, 2021, 20:51
P.S. if you want a good in-depth overview of linear, log, colour spaces, etc. to illustrate what's going on:

https://prolost.com/blog/aces

Cheers, Hywel