Render Type 02: Ambient Light Map

So Basically what render type 02 does is it applies ambient lighting to an object via a texture. It is important to note 2 things: First, your light maps MAXIMUM lighting should be no higher than medium gray (50.2% on all channels or R:128, G:128, B:128). Any values higher than this will cause light bloom to kick in uncontrollably. (Honestly I think this deals with the fact that light maps seem to have been snuck into the Light Bloom settings.) It is important to note that if you have a white texture, and you have your light map set to medium gray, the light map will make the white texture 100% ambient. This is the highest value you should use for your light map as anything higher makes bloom kick in for white textures. Second thing to note is world lighting with this flag applied to your model will do nothing. This is an absolute Ambient Light Map, the objects lighting exclusively comes from this map when applied.

1.) Implementation

This is very simple to implement, simply choose a greyscale texture to use as your light map and input it into the texture 2 slot, (in this case its testcube_base.tga). Then change your render type to 2.

For this example I am using my multiple colored cube texture as a diffuse texture.

This is the lightmap I will be using, note because the red and white sides are darkest they will be lighted the darkest. Because the light blue colours on the right recieve a full gradient we should see each shade of blue light very differently. Again this shader recieves no light other than from this texture.

Here we can see the way the gradient lights the cube.

Now there is a misconception that alpha in either diffuse or lightmap affects the light map. In reality it does not, alpha is translated in this map as black, so in reality although alpha darkens the light, what its actually doing is just blackening the image. I recommend doing this in the actual RGB channels and not in alpha as it is not intended for alpha and this can produce unexpected results.

One last note: Data0 and Data1 in XSIZEtools will control the texture repeats on the lightmap. This will not repeat, Data0 controls U repeats, and Data1 controls V repeats.

Leave a comment