Lightmaping for battlefield 2 in 3ds max by Darren Mac Donald (D-Ran(sdp)).
First of all, you will need to have the bf2 3ds max tools installed. I will be trying to take this step by step assuming that the person reading this knows little to nothing about 3ds max and its functions, however if I manage to miss something or am unclear about something, let me know and Ill attempt to correct the issue.
The first step will be to extract your mods objects_client.rar and objects_server.rar into your mods base directory (though you really only need whats in the staticmesh sub-directory). Do the same for the stock bf2 objects_client.rar and objects_server.rar in the mods/bf2 dirrectory. When this is done, it should look like this (1).
Image File: LM_image01.jpg
Next, open up 3ds max and make sure your units setup is right or your objects wont import in the correct places. First, go to the tab labeled customize and scroll down to units setup (2). This will bring up the units setup utility (3). Select generic units (3*) then click the system units setup button (3*) and make sure it looks just like this (3*). Now hit ok.
Image File: LM_image02.jpg
Image File: LM_image03.jpg
Now click on the bf2 tab. scroll down to the bf2 lightmaping as seen below (4) wich will bring up the bf2 lightmapping tool (5)
Image File: LM_image04.jpg
Image File: LM_image05.jpg
Next you will select the load staticobjects.con button (5*) and browse to your levels staticobjects.con file. Now you wait a bit while your level loads. It may take a few minutes depending on your computers speed and the amount of objects in your map. Now after your map loads, its going to make the framerate extremely slow in max. This is mainly because of the fact that when it imports the map, it inports it with all of the lods and its displaying them all at the same time. Fortunately, you only need to select and display the first lod in each object to render these lightmaps, so what were going to do is to hide all the inconsequential objects and only display the first lod in each object. now you COULD go through the whole map and hide everything but the main lods, but that would take forever and there is a quicker way. First you need to assign a temp output folder (a temp folder on your desktop will do fine) by clicking here (5*). Next you'll need to select any objects main lod by opening up the select by list utility (6*) and selecting your main lod as so (6*) then hit select (6*). Next, go to the display sidebar (6*) and click on hide unselected (6*).
Image File: LM_image06.jpg
Now re-open the bf2 lightmaping utility and hit the save/update button (5*) (Ill get into why you did this at the end, but its important you do it before anything further). Save this anywhere as a text file called anything you want (say, lighting file a). Now open up the default lightmap size box (5*) and select any size at all. Next hit the apply lightmap settings button (5*). This button will apply the size you selected to all meshes for lightmaps. Now with the one unhidden object selected, hit the render selected objects button (5*), then hit esc to stop it. You'll now find that all your objects are visible, but only the main lods so the frame rate is now manageable. Note that every time you hit the render lightmaps button, it will automatically un-hide all the main lods for the generation of shadows. Now that we have your map all on screen with (hopefully) a manageable frame rate, were ready to start setting up the lighting. First, you will need to import your main sun by hitting the load sun button in the bf2 lightmaping utility (5*) and browsing to you maps sky.con file. This will load in a sunlight in the scene, but well need to edit it. Now select the new sunlight and go to the modify tab (7*).
Image File: LM_image07.jpg
Now make sure the on button for shadows is clicked (7*) and open up the dropbox (7*) and select raycast shadows. Now set the intensity (7*) to what you desire (I set it to 0.8 with good results).You can also edit the light color here, but I have yet to play with that and don't know how it will work as of this tut. Now scroll down to the shadows parameters tab and open it up. Here you can adjust the shadow color (8*) and density (8*). I leave the color as black and go with a density of 0.65, but you can play and see how you like it.
Image File: LM_image08.jpg
Now that weve setup our main sunlight for shadows, were going to setup an ambient light to keep the rear faces of meshes from being black. Well first do this by selecting the main sunlight and right clicking on it and select clone. Make sure you have clone as a copy selected, not as an instance (Ill explain this later). Now you need to select the cloned sunlight and go to the modify tab again (7*). Now scroll down to the advanced effects tab and click the box labeled ambient only (8*). Next, scroll back up to the light intensity (7*) and set it to 0.2-0.3 depending on you taste. Now that we've setup the maps sunlight, were going to add some lightsources that come from objects in the map such as streetlights, lamps, ext. To do this, go to the create tab (9*) and select the lighting tab (9*). Now select the omni light (9*) and click on the map to place it. Now for placement purposes, I suggest that you hide all objects except the ones that are intended to have lightsources coming from them.
Image File: LM_image09.jpg
Now for placement, what you want to do is once again select your new omni light and right click on it and select clone but this time we want to select clone as instance. The difference here is that when you clone as an instance, any change you make in the light intensity, shadow color, ext of one omni light will be applied to all the lights that were cloned as an instance. Now start cloning and placing them wherever you want an additional light source. Now if you desire a certain light intensity from one type of objects and a different intensity, ext on a different type of object then it would be a good idea to make a second omni light and clone that as an instance for the second object type. Do this for all the different types of objects you have the need a lightsource. Now we need to setup the lighting for these omni lights so select one omni light for an objects and once again setup the raycast shadows (7*) and (7*), as well as the shadow parameters (8*) and (8*). However this time, Were going to set the light intensity (7*) between 0.2 and 0.4, making sure that the ambient only button (8*) is unchecked. The big difference here is that with these lights, were going to click the drop down box under decay (10*) and select inverse square. Select the show box (10*) and you'll see a green sphere appear around the light (10*). Now adjust the size of this sphere by changing the distance (10*o). There is no right distance to put here, its all about your taste. just remember that this sphere represents when the lights starts to decay, not where the decay ends. Now you'll want to do this for each type of light you created for each different object.
Image File: LM_image10.jpg
Now that weve setup the lighting for our map, well setup the lightmap sizes. Remember that file we saved at the beginning (we called it lightmap file a)? were now going to open that up in notepad. It should look like this (11).
Image File: LM_image11.jpg
This is the list of the objects in your map, the lods they have and what each lod has in lightmap size. What you need to do is replace each undefined with a standard dds size (32,64,128,256,512,1024 and 2048) Noteing each undefined represents one lod (the cot shown (12*) has only one lod, ergo it has only one undefined). Also note that you generally make the first lod the largest size and each following lod half the size as the previous (12*). Now that you've replaced each undefined with a number representing that lods lightmap size, you want to save the file and close it, then go back to the bf2 lightmaping utility and hit the lightmaipe size file button (5*) and select the lightmap file a file you just edited. now hit the apply lightmap settings button again (5*). Now you are ready to generate your lightmaps. You can click on only one objects at a time and hit the render selected objects (5*) to generate them one by one to test your light settings out or generate them in groups or you can just
hit the render all lightmaps button (5*) and go to sleep, cause it'll be awhile. Once this is all over, just select and output directory (5*) and browse to your maps lightmaps/objects folder and then hit the convert temp files button (5*) and let it do its job. Thats it, now just open your map in the editor and generate the atlas files and you're done. I hope this tutorial has been helpful and will aid you all in creating much more realistic looking maps and environments. Enjoy.
Image File: LM_image12.jpg.
I hope this aids people in making much more detailed lightmaps with multiple inner lights. Btw, using this method, you will not need those pesky 700 mb samples files.