Setting Up Lightmaps in Models
Lightmaps are textures that fake the effect of lit surfaces in models. They are used to implement effects such as having models with lit windows or self-illuminated instrument panels inside cockpits and vehicle cabins.
Using light maps in external models
Create a lightmap – a texture that defines lit areas on your models – usually shades of gray but other colors are also possible.
For example, the Diffuse Map: 
And the Light Map: 
In this example the diffuse texture is named “DiffuseTexture.dds” and the lightmap is named “LightTexture.dds”. (You don’t have to use the same UV channel for the lightmap and the diffuse texture).
- In 3ds max, open the material editor. Find the material you wish to add a lightmap to. Normally this would be a standard material with a single diffuse texture.
- Click the diffuse texture slot to go to the texture level, then click the “Bitmap” button on the top right.
- Select Composite in the Material/Map Browser and select “Keep old map as sub-map”.
- In the composite layers rollout you will see your current texture as the first layer. Press the Add New Layer button to add another layer.
- By clicking and holding, drag the bar labeled “Layer 1” (the one with the diffuse texture) above the new layer, so it’s layer number two.
- In layer number one, add your light texture by clicking the empty texture rectangle.
- Finally, change the blending mode of the light texture to Screen.
- You should end up with a setup similar to this:

Export the model, and then open the material script file (the one with the extension “material”)
It will look something like this:
material Mymodel/MyMaterial
{
Technique Default
{
Pass Main
{
Specular 0.5 0.5 0.5 1 25
texture_unit
{
texture LightTexture.dds
mipmap_bias -1
rtshader_system
{
layered_blend screen
}
}
texture_unit
{
texture DiffuseTexture.dds
mipmap_bias -1
rtshader_system
{
layered_blend default
}
}
}
}
There are two sections that begin with the words “texture_unit”. The first one describes the lightmap. The second describes the diffuse texture. Each, in turn, has an inner section that begins with "rtshader_system". These sections describe the blending mode.
Using this material in the simulation will give you a model with a permanently lit lightmap.
Since we want to be able to control the lightmap dynamically from inside the simulation, we need to add a hook to a custom SIMbox property.
Add the following text inside the first texture_unit, inside the curly brackets after rtshader_system:
source_modifier src1_modulate custom 100
Result should look like this:
…
texture_Unit
{
texture LightTexture.dds
mipmap_bias -1
rtshader_system
{
layered_blend screen
source_modifier src1_modulate custom 100
}
}
texture_unit
{
texture DiffuseTexture.dds
mipmap_bias -1
rtshader_system
{
layered_blend default
}
}
}
}
Save the file.
If you use this model in the simulation and you model has the logic component SMG_ExternalLights, the lightmap will turn on after 18:00.
If you want to use a different custom param, open the material script and change the number from 100 to another number:
source_modifier src1_modulate custom 105
You’ll also need to change the custom param in SMG_ExternalLights in the toolkit (and develop some logic to control that param).
You can use more than one lightmap per material. To use more than one lightmap, arrange them before the diffuse texture in a composite map, again setting each to a screen blending mode.
You will then need to add the line source_modifier src1_modulate custom 100 to each lightmap, using a different channel number (instead of using channel 100) for each. Notice that if you want to use more than one lightmap you’ll need to develop a custom logic component to control said lights.
The result:
Night (with lights turned on using the L key)
Using light maps in consoles
In order to use light maps in consoles, two changes are necessary:
- the material script needs to have the word “console” added in the RTshader definition after the words “rtshader_system” (see example below)
- The console’s light channels begin at 0, so use channels 0, 1, 2… 5 (there are six cockpit light channels available)
texture_Unit
{
texture LightTexture.dds
rtshader_system console
{
layered_blend screen
source_modifier src1_modulate custom 1
}
Testing lightmaps in consoles
You can test the cockpit lighting using this procedure.
