Diffuse Lighting
Diffuse lighting in Kanikama is inspired by GhostIllumination by phi161 and based on the technique of Precomputed Radiance Transfer2.
Consider a scene where there are green and red point lights in a room. The colors of the lights are (1,0,0)
and (0,1,0)
, respectively, and they have the intensity 2
.

The following image is the baked lightmap.

Set the color of the two lights to white (1,1,1)
and the brightness to 1
and bake the lightmap with only one lit for each.


Two lightmaps are generated from the two lights.

The lightmap with red and green lights turned on can be reproduced by multiplying the two lightmaps by their respective colors and brightness and then summing them up (that is, taking a linear sum).

Note that only the lightmap values are computationally expensive in the right-hand side. If you bake multiple lightmaps in advance, we can dynamically update the lightmap of the scene at runtime by simply changing the colors of the coefficients and summing them up.
Footnotes
-
phi16, 無 解説 - Imaginantia ↩
-
Peter-Pike Sloan, Jan Kautz, and John Snyder. Precomputed Radiance Transfer for RealTime Rendering in Dynamic, Low-Frequency Lighting Environments. ACM Transactions on Graphics, v 21, n 3, 2002, p 527-536. ↩