3d Studio Max Lightmap Tutorial - By Uncle Sam

Written and Produced by UncleSam

Compiled by Perfectionist aka Mr_Perfect 02/02/03
Email via Support on site please



Lightmap Tutorial - By Uncle Sam

Lightmapping is the process used to paint light and shadows on to buildings and other static objects. It’s a fairly simple process now that Rex’s BF tools support lightmapping.

Before we get started, there are a few things we need to make sure we have correct first:

Your static objects in 3D Studio Max must be made from visible meshes and not collision meshes. Otherwise the light maps will not work correctly. If you are currently using collision meshes for static objects in max, then you need to build yourself a new library and import your meshes using the Visible Import setting in Rex’s tools.

Most BF buildings that have an interior to them are made up of two visible meshes. One with an M1 extension, and another with an M2 extension. Both of these meshes need to be lightmapped. Otherwise your lightmaps will disappear as you move further away from your object in-game. It’s a good idea to build an additional library with the M2 meshes but give them the same name as the M1 meshes. That way you can use the Rename/Replace feature in Max to swap them out when its time to do the second set of lightmaps.

Lightmaps need to be placed in the “ObjectLightMaps” directory inside your directory structure. You will also need the Palette.pal file in this directory as well, unless you want your meshes to appear blue in-game. You can copy this file from an existing BF level and your lightmaps will work just fine.


Setting up the lights

Now we’re ready to get started:

First, use Rex’s tools to import your sun if you have not done so already. Check the light settings and make sure shadows are on. I also recommend you use ray traced shadows or advanced ray tracing. You can lower your shadow density as well to reduce the contrast of shadows cast on your object.

Now select the object that you will be lightmapping and make sure this is the only thing that you have selected. Now open Rex’s tools and select Configuration/Utility. Now hit the SetupLightMaps Selected.


NOTE: You can select more than one object at a time for this process, but for the sake of the tutorial, we will be doing only one at a time for simplicity.

Baking ( Rendering Your Texture )

Now it’s time to bake the lightmaps. Open the Render menu in Max and select “Render to Texture(Or you can hit the “0” key). Now open the General Settings section in the Render Texture menu and use the settings shown Below.

For your file output path, use your ObjectLightMaps directory in your level’s directory structure. These settings will stay the way they are so there’s no need to do this everytime you bake a new lightmap, unless you are changing the output directory of course.

Go ahead and open the Select Object Settings menu if it is not already.

You should notice that Rex’s tools have set up the lightmap coordinates for you already. For this tutorial, I have used the lrgfrenchfarm_m1 mesh. Make sure the file type that is being saved is in TGA format(24 bit, non-compressed). Also, make sure the Shadows check box is checked. Go ahead and leave Automatic Map Size checked, but for smaller objects like walls and fences, you can disable this and use a size such as 64X64 or 32X32.

With that done, go ahead and hit the Render button. Your texture will begin baking and the end result will look something like the one Below.


We’re almost done now. Now we have to convert the lightmap to 8 bit format. This can be done using Rex’s tools. Open up the Configuration/Utility menu again and select Lightmap 24bit->8bit. Direct it to the menu where your light map is stored. You can select the lightmap you just made, but if there is more than one lightmap in the directory, select any one of them because Rex’s tools will conert every 24bit file in the directory to 8bit.

Before you forget…

Remember that if your building has an interior to it, then it probably has an M2 mesh so you need to replace your M1 mesh with that one and then bake those lightmaps again.

IMPORTANT: Make sure you save it with M2 at the end or it will overwrite your M1 lightmap. This is an easy mistake to make if you replaced your M1 meshes using the Rename/Replace function.


Trouble Shooting

Make sure you have converted to 8bit format using Rex’s tools. This is the usual result of using 24bit lightmaps.


Be patient, sometimes lightmaps take a little time to render. If this is not the case, make sure the mesh that you are rendering from was imported using the Visible Import option. Also, be sure that the settings are set up the way that I have pictured in figures 3 and 4.


This usually happens when you have tried to render a lightmap a second time for the same object. Delete the elements from the Generated Texture Elements section, then close the Render to Texture window, and then go back and hit the Setup Lightmaps Selected button again. When you open the Render to Texture window again, there should only be one element there.


This object has an M2 mesh. You have either forgotten to render the M2 mesh, or you have overwritten one with the other. Make sure you are saving with the correct extension (ex. Lrgfrenchfarm_m2.tga). Verify that you have both in your ObjectLightMaps directory.


You need to place a palette.pal file in your ObjectLightMaps directory. Copy one from an existing BF level and past it in this directory.


That should do it. Good luck out there.

Written and Produced by UncleSam

Compiled by Perfectionist aka Mr_Perfect 02/02/03
Email via Support on site please