• ### Announcements

#### Archived

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

# Lightmap Editor

## Recommended Posts

I''m going to start a lightmap editor. It will basically be a world editor that can load models and setup lightmaps. There is a few ideas I have of how to go about creating the lightmaps in an editor and they''re listed as follows but I was wondering how you would go about it and if you could give me any tips. Other editors didn''t work on my computer. I''ve downloaded demos of programs that had that this feature disabled. Hopefully you can give me some ideas. Here''s what I''ve came up with so far: -Give the user the ability to map the object with textures both with the base texture and the lightmap texture. Both textures will be created in external modelers. The texture mapper would hopefully resemble something like the one found in milkshape where you position you vertices over a image visually. The problem with that is that you''ll be doing a lot of trial and error setting up the light maps so that they match the world. -Have a compile option which generates the lightmaps for the lightmapped objects. Hopefully, you''d just load your world and position lights in the scene and it would figure out what the lightmaps should look like. I would love to do it like this but I don''t know how to implement it. Here''s a simple design for it. Would this kind of work(not optomized, that comes later)?

loop through all triangles in the scene
-create a texture for that polygon if that polygon is a lightmapped one
-loop through the texture dimensions and figure out the position on that polygon of it
-do raytracing and find out that current color value from the lights
-Save that texture to a file

By the way, the editor would have a custom format so saving to a friendly format isn''t a problem. ---
My Site

##### Share on other sites
bump. By the way, I just bought red faction and it''s level editor that comes with it does the second option: It has an option to calculate the lightmaps from the lights setup. That''s the way I''m going to go but now I''m wondering how to go about it. Would the previous idea work or does it have to be more detailed? Also, when calculating the lightmaps, would the math used in per pixel lighting work to calculate the lightmaps?

---
My Site

##### Share on other sites
Hi
Creating a lightmap engine is NOT an easy thing, because of the complexitiy of real light behaviour. Because of radiosity, the light that hits a surface does not only come from direct sources, but also from any other lit object that reflects a part of the light it recieves. Think of a mirror: it re-emits all the light it recieves. Each surface, may it be wood, metal, ... acts like a mirror that reflect a part of the light (water reflects more than metal, which in turn reflects more than wood, ...)

So if you want your lighting engine to be realisitic, you should consider this fact, else you won''t get any intersting result.

##### Share on other sites
tibo,

I realize it''s not going to be easy. At first it will just load up models but after that I''m going to add texturing support and finally lightmap support. Yes, I also realize it''s going to take a long time but I''m not no time limit.

I''ll take what you said into consideration. The editor doesn''t have to be "that" good. It just has to calculate shadows basically. Radiosity and other advanced lighting techniques probobly won''t be implemented until the less advanced but still hard features are in.

If anyone here has created some type of editor or engine that supports lightmaps, how did you setup the geometry for it? Hardcoding the lightmaps is not a question for me. No modelers I''ve found support calculating lightmaps and exporting to a friendly format. Also, wouldn''t it be better to create a custom editor so that you could add specially created features? If somebody could just answer a few of these questions, I''d be grateful.

---
My Site

##### Share on other sites
Sorry about this, maybe I should have reworded everything better. Basically, I found a new lightmap tutorial on polygone.flipcode.com and it''s nice. I''ll use their technique and use lighting math from other sources. Basically, here are my questions, no more no less(at least not now). I added a few more and took out a few:

1.) If you were using a lightmap editor but it took about 5 minutes to calculate the lightmaps and save them for a detailed and complete scene, would that stop you from using the editor?

2.) Overall, is a custom lightmap editor nescesary or can I get away with some type of command-line lightmap creator and file converter?

3.) Can you verify for me that using the math for per-vertex lighting will work for lightmaps if you know the position of a lumel on the lightmap? Of course it would also do raytracing for the shadows but this is for the lighs themselves.

I wish I would have found the Red Faction editor and polygone article before posting. Both answered a lot of questions but these are the only ones I have left. Thanks in advance.

---
My Site

• ### Forum Statistics

• Total Topics
628288
• Total Posts
2981845

• 11
• 10
• 10
• 11
• 17