DaemonEngine / Daemon

The Dæmon game engine. With some bits of ioq3 and XreaL.
https://unvanquished.net
BSD 3-Clause "New" or "Revised" License
306 stars 60 forks source link

sRGB lightmap #243

Open illwieckz opened 4 years ago

illwieckz commented 4 years ago

q3map2 from NetRadiant already knows to bake them, and we can use Xonotic maps as testbed for this feature.

illwieckz commented 4 years ago

It looks like storing lightmap as sRGB is a mistake, since they have to be applied with linear computation.

In any way, q3map2 has option to compute linear lightmap while internally reading lights and textures the sRGB way. This would be the best way to do q3map2 computation right, and by storing them in linear space this would avoid a conversion in engine.

In any way, Xonotic will require those sRGB lightmaps to be supported.

illwieckz commented 1 year ago

It looks like storing lightmap as sRGB is a mistake.

In fact it is not, storing lightmaps as sRGB also allows do distribute color values in a different way to avoids losing precision on some use case (like low lighting). That can be used as a storage trick to avoid requiring HDR lightmaps and requiring high-bit image formats.

When storing lightmaps as sRGB they should just be linearized before applying the linear computations.