Archived

This topic is now archived and is closed to further replies.

Light Maps

This topic is 6448 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Can anyone recommend good reading for how to calculate light maps. I''ve seen some code, but when it doesn''t include comments, it''s a pain to figure out. I have to believe someone has written some docs on calculating lightmaps and the using them? I know how to take a lightmap and apply it. The DirectX lightmap demo is pretty easy. But, everyone I''ve spoken to says you need to calculate the lightmaps as a preprocessing step. This is the part that confuses me, how is this done. Also, maybe I could figure it out if I understood better how more complicated light maps work. using a round lightmap like the directx demo is easy enough, but what about how to handle when you need to mix lightmaps because you have multiple light sources illuminating the same poly. I''ve never seen a well documented sample or descripton of how to take multiple light maps to apply them to different parts of one poly? Also, are the lightmaps themselves calculated, or is it more the use of the lightmap that is calculated? For example, take a square texture, black at the edges and slowly changing to a white circle at the center. This is a basic lightmap, right. Do other light maps have different shapes or designs, or is one lightmap used and manipulated? Thanks for any information you can provide. Larry Please reply to muve01@hotmail.com

Share on other sites
For tutorials check out the articles section at flipcode http://www.flipcode.com/tutorials/. In my engine lightmaps are implemented as follows. For every surface I have one lightmap. The lightmaps are computed in the pre-processor stage as you said. The basic algorithm is:

For every light.
For every surface.
For every texel of the lightmap of the surface.
For every other surface.
If the vector from the light source to the texel is blocked by the surface, continue to the next texel.
If the vector from the texel to the light source is not blocked by any other surfaces, compute the colour of the texel(I use the Lambertian diffuse equation).
When all the texel colours have been calculated I create a bitmap file using the texel data.

That’s a very basic description of the algorithm. I do other things like calculate what size the lightmap should be based on the size of the surface, only compute light sources for surfaces if they are in the same PVS as the surface etc. I’m working on a radiosity renderer that is going to be used after the above algorithm has finished. If you need anymore help or want to discuss anything else ICQ me 55035048.

Edited by - Phobia on October 29, 2000 12:35:29 PM

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• Forum Statistics

• Total Topics
631431
• Total Posts
3000040
×