I want the distance fog to have a whiteness that depends on surrounding luminance. How can this be implemented effectively?
There is a light map with luminance information for every pixel. However, this map has the same size as the display, so some kind of blurring is needed. I think downsampling the light map to something really small, maybe 8x8 pixels, would make a good input. However, I worry about efficiency here. Though I haven't measured it, I strongly suspect most algorithms will cost much?
A very simple algorithm would be to sample 8x8 pixels from the original light map. But that would give a high degree of randomness, and flickering effects when the player turns around. A slightly better solution would be to read 16x16 pixels, and manually downsample to 4x4. However, I think it is preferable not having to read pixel data to the CPU, and then transfer it back to the GPU again.
Any suggestions how to best go ahead?







