Interior light leak
by Howard Dortch · in Torque Game Engine · 03/15/2006 (12:42 pm) · 5 replies
I am sure this has been discussed before but can't find it on the forums.
I have a 2 story building, florescent_static light down stairs in a room, a floor seperates the 2 levels. I go upstairs and the ceiling and one wall has light from below shining on it.
I changed light_geometry_scale in the map file to 8 to see if it made a difference but not.
Any hints on how to restrict light to a room?
A floor with a wall sitting tight against it should not leak light (IMHO)
I have a 2 story building, florescent_static light down stairs in a room, a floor seperates the 2 levels. I go upstairs and the ceiling and one wall has light from below shining on it.
I changed light_geometry_scale in the map file to 8 to see if it made a difference but not.
Any hints on how to restrict light to a room?
A floor with a wall sitting tight against it should not leak light (IMHO)
#2
"I also knock map2dif's light map border size down " not sure what you mean there, something to change in the C++ build or an option?
"These lexels, in the case of your wall, extend below the floor and aren't shadowed by it." The wall on the upper level is sitting on the floor and the wall below is up to the floor, the floor completely seperates the 2 brushes.
I hate to make a building with walls that are extremely thick, doesn't look right. A commercial building has at most 10" thick walls.
03/16/2006 (9:14 am)
Thin walls and floors, on my map the floor is 16 units thick and the light_geomeetry_ scale is 8 would you consider this proper settings? I'm using Hammer at the moment so I assume units = inches."I also knock map2dif's light map border size down " not sure what you mean there, something to change in the C++ build or an option?
"These lexels, in the case of your wall, extend below the floor and aren't shadowed by it." The wall on the upper level is sitting on the floor and the wall below is up to the floor, the floor completely seperates the 2 brushes.
I hate to make a building with walls that are extremely thick, doesn't look right. A commercial building has at most 10" thick walls.
#3
When the the surface is rendered it truncates the light map so the parts that extend over the edges are not used, but the way texture mapping works involves blending between texels in the source texture map (in this case the light map). In the case of the light map the blending causes the texels that extend beyond the surface to blend with those at the edge of the surface. This causes the un-shadowed areas to bleed into the shadowed areas, which become light leaks.
I would try creating a test map with a light map scale of 2, splitting or deleting all brushes that are too large. Then seeing how the lighting looks in-engine - at that scale it should look very good. You can then bump it up to 4 and see if you can get away with the lower scale. If all is well I would stick with 4 and fix any brushes that are too large in your good version of the map.
When using high light map densities you should eventually scale back the light map border size (found in lightMapPacker.h in map2dif) to conserve memory (though this can be done further into the game development process). Again same process; try a border size of 4 - if it looks fine try 2, if not try 6, and narrow down an ideal size.
03/17/2006 (9:34 am)
Even if the brushes are separated by the floor the light map extends beyond the surface of the object. Imagine a large sheet of paper (the light map) resting on top of a small book (the surface), the paper extends beyond the edges of the book.When the the surface is rendered it truncates the light map so the parts that extend over the edges are not used, but the way texture mapping works involves blending between texels in the source texture map (in this case the light map). In the case of the light map the blending causes the texels that extend beyond the surface to blend with those at the edge of the surface. This causes the un-shadowed areas to bleed into the shadowed areas, which become light leaks.
I would try creating a test map with a light map scale of 2, splitting or deleting all brushes that are too large. Then seeing how the lighting looks in-engine - at that scale it should look very good. You can then bump it up to 4 and see if you can get away with the lower scale. If all is well I would stick with 4 and fix any brushes that are too large in your good version of the map.
When using high light map densities you should eventually scale back the light map border size (found in lightMapPacker.h in map2dif) to conserve memory (though this can be done further into the game development process). Again same process; try a border size of 4 - if it looks fine try 2, if not try 6, and narrow down an ideal size.
#4
I'll experiment some.
03/17/2006 (12:38 pm)
I set the light_geometry_scale to anything lower than 8 and map2diff/plus throws an exception error.I'll experiment some.
#5
Thats because some of the brushes are too large (map2dif/torque has a maximum light map size of 256x256). If you create a test map with only one brush, set the light map scale to 2, and adjust the brush to just before it causes a crash, you'll have the maximum brush size. You can then use that size to split any of your existing brushes that are too big.
-John
03/18/2006 (1:19 pm)
Hi Howard,Thats because some of the brushes are too large (map2dif/torque has a maximum light map size of 256x256). If you create a test map with only one brush, set the light map scale to 2, and adjust the brush to just before it causes a crash, you'll have the maximum brush size. You can then use that size to split any of your existing brushes that are too big.
-John
Torque Owner John Kabus (BobTheCBuilder)
I also knock map2dif's light map border size down a lot and crank the lighting density up instead (I generally use a lighting scale of 2, and adjust the brush sizes to fit).
Leaks occur because light mapping applies rectangular textures to irregular surfaces, so there will always be some lexels that exist in the light map that are outside the actual geometry. These lexels, in the case of your wall, extend below the floor and aren't shadowed by it.
Adjusting the floor thickness and lowering the lighting scale (which makes the lexels occupy a smaller volume in the interior) increases the number of lexels beyond the wall geometry that are still shadowed by the floor.