Blurred lightmaps
Hey all. Very simple subject, but wanted to get your input. I know that games since the early quake days have used blurring in their lightmaps to avoid staircasing; the idea being that since your lightmaps can't be extremely high res, it's better to get nice soft ones out of the low res LMs than to try to boost the resolution insanely high to get perfectly sharp edges.
My question is, how do they achieve this? If you use a standard lightmap packing technique (like here: http://www.blackpawn.com/texts/lightmaps/), you can't just blur the resultant texture in Photoshop, as spillage occurs into unwanted UV space for the various LMs. So how is it usually done?
Though I sincerely doubt you need references to know what I'm talking about, here's a shot from HL2 showing such a lightmap:
http://www.mortens1.no/images/The%20Game%20Cube/31.03.2005/Half-Life%202%20bilde%201.jpg
Thanks so much!
Actually, most games use something other than pure lightmap sampling when calculating the textures. These include radiosity and photon mapping, which create a natural blur while still keeping the realism of the lighting (shadows close to the shadow source should be sharp, and blur as you get farther away).
Quote:
Blur the lightmaps before packing them.
But doesn't that produce seam problems? Basically, imagine a small lightmap, before being packed, in which one triangle is represented, leaving some empty space in that quadrilateral lightmap. Once you blur, any edges *within* the triangle's space are handled, but the edges of the triangle itself get blurred along with whatever fill color you're using for that lightmap. Thoughts?
Quote:Original post by zainanak
But doesn't that produce seam problems? Basically, imagine a small lightmap, before being packed, in which one triangle is represented, leaving some empty space in that quadrilateral lightmap. Once you blur, any edges *within* the triangle's space are handled, but the edges of the triangle itself get blurred along with whatever fill color you're using for that lightmap. Thoughts?
Lightmaps are often built up from rectangular regions, in which case there is no fill. Alternatively, simply use a fill color with an alpha of 0, and then divide the blurred map by its alpha channel (pretty much what happens at the borders when blurring any image).
It's usually done as part of the lightmap generation. You don't just sample from the centre of the luxel, but take several samples from all over the luxel and average them together. Or jitter the lights as someone else mentioned. Half-life 2 does both.
If you have a seam problem, it's not the problem that your lightmaps as it are to jaggy. Your graphic card will just filter in some lumel that reside outside the lightmap.
What usually works well is to do a post-processing step on your lightmaps. For all pixels, that are not covered by a lighten polygon, search for a lighten neigbour pixel, and if you found it color it with the average lumel color (or extrapolate).
Do this untill all pixels of the lightmap have been processed. When you're done the lightmaps should work much better, even when a mipmap is used (e.g. when lightmapping something far away from the cam).
Anything is better than a black seam.
Google on image morphology for more info.
If you try to fight the staircase effects, render/compute your lightmaps with supersampling. That'll get rid of this.
What usually works well is to do a post-processing step on your lightmaps. For all pixels, that are not covered by a lighten polygon, search for a lighten neigbour pixel, and if you found it color it with the average lumel color (or extrapolate).
Do this untill all pixels of the lightmap have been processed. When you're done the lightmaps should work much better, even when a mipmap is used (e.g. when lightmapping something far away from the cam).
Anything is better than a black seam.
Google on image morphology for more info.
If you try to fight the staircase effects, render/compute your lightmaps with supersampling. That'll get rid of this.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement