DIF/dif lighting

From TDN

This page is a Work In Progress.

About DIF Lighting

When you run Map2DIF on a map, the light maps are created. They are completely separate from your actual texture maps. The texel scale of the light maps is calculated by the light_geometry_scale in the worldspawn properties of the map. What this number really means, is the length and width dimensions for each texel in the units of the program (QuArK or Cartography Shop). Since the size of the geometry is determined by the geometry_scale attribute of the map, the lighting resolution can be thought of as:

   light_geometry_scale / geometry_scale = # of texels per Torque Meter

So, if you have a building that is 10 meters tall and uses the default 32, 32 scale values, there are only 10 grades of light value along the height of the wall. This looks OK at a distance, or if you have very flat walls that don't need detailed shadows. But for up close you most likely want a higher texel ratio.

Light "Leaks"

The so-called light leaks you see in your DIFs are not light leaking through cracks in between brushes or anything of the sort. They are light bleeding across the edges of the light maps. We saw above that the number of texels is bound to binary divisions of the Meter. The problems with lightmaps occur when you have an oddly sized brush face. Continuing the example above, say your building is actually 5 and 1/32 meters (5 x 32 + 1 is 161 editor units) tall. When the light map gets laid out, what is it going to do with that last 1 unit of space? Depending on how the brush's faces are "unfolded" into UV space, the face that's adjacent to the face in question (maybe the top face of our building's brush) will be the face that the bleeding comes from. If both faces are lit with the same color, it looks fine. But if one is light and one is dark, the bleeding will occur.

The solution is to make sure that the surfaces will line up with the pixel space of the light maps, by doing either or both of:

(a) Decrease the light scale to a smaller number. Making it 1 would ensure that any face with integer dimensions lines up.
(b) Build your geometry using brushes that are in sizes divisible by the light scale you will be using.