This is assuming you're using 3ds max:
Level Modeling:
The idea of modeling a level with a lightmap is to use as FEW objects as possible. If you have 15 objects, that means you'll have 15 lightmaps. The level I used in this example has only 2 objects. Lightmaps are usually larger than textures in terms of file size, so the less objects you have, the better. Learning max polygon editing is CRUCIAL. And don't forget to include the lights! You must add lights to this stage, and you can render it to see what the lightmap will look like while modeling.
Level texturing:
This can get frustrating, especially if you have very few objects, and you need multiple textures on one object. You're going to have to apply UVW maps to individual polygons, which takes a lot of trial and error. You MUST learn about multi/sub texture maps.
Lightmapping
When you've finished with the modeling process, save your scene as a SEPERATE FILE called sceneLightmap. From here on in, you cannot touch the scene. If you see a problem, you cannot fix it. The lightmap file and the scene file must have the EXACT SAME GEOMETRY.
Now, create a new texture. Make it white, but not blinding white. How dark this texture is determines how dark your lightmap is. It's generally bad to use a gray material because it will ruin specular highlight and make the level much too dark. A shade of white will do it.
Zoom out, and select every object in your level (drag a box around it). Then drag and drop the texture onto the selection. With the popup box, hit "Assign to Selection" and hit OK.
You're now ready to bake your textures! Again, select every object in the level. Go to
Render > Render to Texture
Under general settings, in Automatic Unwrap Mapping, change the Spacing to 0.
Scroll down to "Select Object Settings". Hit "Add". Select "Complete Map". Hit OK. Set the texture size to whatever you want, I use 500x500. Keep in mind, lightmaps have rather large sizes.
Hit "Render"
You now get to see your lightmap rendered out. Note, if you move the image file window out of the way, you can find a progress bar behind it. Very useful. When it finishes, you see your scene, completely lit.
You aren't done! This part is tricky, annoying, and stupid, but it must be done.
Open the material editor. You must create a MATERIAL FOR EVERY LIGHTMAP. This means, chose an empty material slot. Hit this button:
Then select "Bitmap" from the list. Then browse your files until you find the lightmap (it will be a TGA file). Then hit OK.
Don't forget to name the material so you can find it later!
Do this for evey lightmap. If there are 3 lightmap files, then you need 3 textures.
APPLY THE LIGHTMAP MATERIAL TO IT'S RESPECTIVE OBJECT. This is where naming the textures came in handy. If you select an object, it will tell you its name. The name of the lightmap will be something like objectNameCompleteMap.tga. Make sure you assign correctly!
Look at your level. It looks terrible the lightmaps don't align at all.
Trying to explain this would take forever. So! Do this for EVERY OBJECT:
-Select the object
-Go to the modify panel
-Delete the "Automatic Flatten UV's" by clicking the little trashcan when it's highlighted:
-Open the dropdown menu. Select "Unwrap UVW"
-Under "paramaters", click "Edit".
-Then select flatten mapping:
-Change the Spacing to 0. Then hit OK.
-Your object is now perfectly aligned to the lightmap!
-Repeat the above steps for EVERY OBJECT.
Alright. You've got two complete objects. One is textured, one has the lightmap. You're gold. Export both to .X files with Panda Exporter with THESE settings:
http://members.lycos.co.uk/mrdarclyte
In DBP, load both objects, ghost one, and you're DONE!
load object "myfileslevel.X",4
load object "myfileslevelLightmap.X",5
ghost object on 5,1
Then write your engine around that.
BEAUTIFUL!
If there are any questions, comments, or problems, you can either reply here, find me on AIM, my AIM name is DelvarWorld , or email me: delvarwo@delvarworld.com
I hope you gained something from this!