Light Mapping

About The Product

     Lightmap Lerper is a lightmapping solution for smoothly tranisitioning for different lighting situations in the same environment. The main scenarios this is used for is day night transitions. It allows for the accuracy and performance results of baked global illumination, but with the flexibility of realtime global illumination.

Programming Overview

     Typically for screen effects, or texture manipulation shaders are used to pass the burden off to the graphics card, which produces a rendertexture. Unfortunately, Unity's lightmap system does not allow for the use of render textures, so the information needs to be copied to texture2D and passed in to the lightmap system.

      This system has major performance hits though. The GPU has to finish rendering everything in pipeline up until the shader's render queue, then send the data back to the read call for writing to the Texture2D. This causes a stall in the GPU harming gpu performance.

      Instead of using the traditional method, Lightmap Lerper stores all the pixel data for the different light maps at compile time and then blends them on a seperate CPU thread at runtime. Once the blending thread finishes, the pixel data is then copied to a Texture2D which is finally passed to the light map data. This prevents stalls on the GPU, saving performance.