Dynamic lightmapping can be created using texgen.
The lightmap can then be applied to a scene 'externally' - without
the individual objects having texture coordinates or otherwise
expecting a texture.
Basic scene | |
---|---|
Light texture | |
Result |
Generating S & T texture coordinates via
S = x T = z
will cause the light map to lie in the X/Z plane, as if it were projected straight down the Y axis.
If the light is currently located at (LX, LY, LZ), then
S = x - LX T = z - LZ
will cause the texture to move with the light. The (0,0) texture coordinate will be located directly below the light.
Offsetting the coordinates by 0.5:
S = x - LX + 0.5 T = z - LZ + 0.5
will center the lightmap - texture coordinate (0.5, 0.5) will be directly below the light.
Finally,
S = 0.1 * x - 0.1 * LX + 0.5 T = 0.1 * z - 0.1 * LZ + 0.5
will change the lightmap's size - it will cover a 10 x 10 unit area of the scene, rather than a 1 x 1 unit area.
Examples: