View Full Version : off-topic: how to calculate lightmaps
05-09-2001, 04:53 PM
ok, so the title says it all: how can I calculate grayscale lightmaps (a la Quake) of a scene so i can multitexture them on top of my regular texture set? any utility or technique?
sorry to post off-topic questions, but this is really killing my brain cells...
05-09-2001, 07:45 PM
no!, its a good question. id like to know how to do this also http://www.opengl.org/discussion_boards/ubb/smile.gif
05-09-2001, 08:23 PM
Typical light map compilers involve rendering the view of all lights to each mapped shadow map texel, using the BSP tree visibility that you already built for your level (or whatever system you're using). Yes, this is almost akin to ray tracing. Yes, this is not doable in real time. Yes, this is why level compilers typically run slower than you'd wish :-)
One example algorithm:
for each face F in the world
for each mapped texel position T on F
set T to dark
for each light L among the ML closest lights to T
determine obstruction O of light from L to point T in the world
if O is "none" then add contribution of L to the texel of T (based on distance and light parameters)
Another way of doing it is to render into texture from each light's point of view for each lightmap, where "visible" results in the texture being lit, and anything occluding results in the texture not changing. This is most easily done if you Z sort and draw from near (to the light's viewpoint) to far. And you clearly don't have to draw anything farther from each light than the lightmap surface being generated :-)
[This message has been edited by jwatte (edited 05-09-2001).]
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.