Archived

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

The_Fallen

Creating Lightmaps

Recommended Posts

The_Fallen    122
Hi, I''m looking for some good articles about _creating_ lightmaps (not about displaying them!). I don''t need something advanced like radiosity. something simple would be great. Has anyone some links? thx, fallen

Share this post


Link to post
Share on other sites
TerranFury    142
For each lightmap texel, for each light, see if the light is occluded. If it is not, then add a lighting value to the texel corresponding to that light.

The light intensity will be proportional to the dot product of the polygon''s normal and the ray from the texel to the light. It will also be inversely proportional to the square of the distance between the texel and the light.

Red, blue, and green values can be added seperately.

You said you weren''t interested in radiosity. However, if you really do want to try it out after you get your simple lightmap generation code working, it''s pretty simple. Just perform the process repeatedly, treating each texel as a light source.

Share this post


Link to post
Share on other sites
The_Fallen    122
Thx, sounds good. But is there some sample code anywhere in the web? Something like how to get the world coordinate of a texel, etc would be great. Pseudo code would be enough, I think...

Share this post


Link to post
Share on other sites