Lightmaps and Smooth Shadows

Started by
14 comments, last by Enrico 17 years, 5 months ago
How can I create smooth shadows on static, precomputed lightmaps using direct illumination? My lightmap shadows are very jagged because I use one ray. I must use sampling, but I'm not sure how to do it correctly or what math to use? [Edited by - JakeM on November 15, 2006 1:22:54 PM]
Advertisement
Id say just blur the end result. Quick and will probably yield the result you are looking for.
Sorry, but, blurring is definitely not what I'm looking for.

This is a packed lightmap. All polys are packed onto one bitmap. Not all the polygons are continuous.
Blurring would just screw up the seams.

[Edited by - JakeM on November 15, 2006 1:15:10 PM]
Do you meean precomputed lightmaps? What about using more than one rays? You can do it by sampling the area of the light (i.e. a square) and then trace a ray for each sample. Then you average your shadow tests.
Yes, how to create smooth shadows for a static, precomputed lightmap.

Thanks for the explanation, but I'm really asking for a working example of how to use
more than one ray.

[Edited by - JakeM on November 15, 2006 3:19:09 PM]
I don't know how you currently render your maps, but if all you use is standard raytracing techniques, then perhaps this could be helpful. Chapter 5 explains how to sample (in a very trivial way) an area light. If you already work with vectors and matrices, triangles/rays intersections and so on, then adding this will be very easy.
Yes, that's interesting. I'm just trying to understand it.

They modelled their light source as a square that emits light in one direction.
But what I have is a point/omni light that emits light in all directions. So I think their
type of sampling does not help me?
Quote:Original post by JakeM
Yes, that's interesting. I'm just trying to understand it.

They modelled their light source as a square that emits light in one direction.
But what I have is a point/omni light that emits light in all directions. So I think their
type of sampling does not help me?


Consider the light as a volume: it is non longer a point, but a sphere. As an alternative, you may try to simply shot n rays (with bigger n quality will increase) moving the light position for each ray. Light positions will be (randomly) moved inside a circle, this means that you will need 2 (random) values between -1 and 1 to use as the translation amount for the light. If light are always very small you may not care about it being a volumetric object and treat it as a circle. You choose 2 axis (selecting perhaps those nearly perpendicular to the ray) and then you move the light. The you do the calculations and move it again. Another ray, another calculation and so on for as many times as you like. Then you average. The result will be a soft shadow.
If I wanted to model my light source as a sphere, do you think it matters if I pick
random points anywhere inside this sphere, or should my random points only lie on the
surface of the sphere?
Yes they, should lie on the surface of the sphere, as light is emitted from the surface.
Also pay attention to use correct formulas for sampling, you need a constant sample density w.r.t to the solid angle. e.g. NOT cosine weighted samling etc.


Another issue that came to me, is the resolution of the shadowmap, the jagginess can be a direct result of low resolution and not undersamling.

This topic is closed to new replies.

Advertisement