Jump to content
  • Advertisement
Sign in to follow this  
JakeM

Lightmaps and Smooth Shadows

This topic is 4411 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Id say just blur the end result. Quick and will probably yield the result you are looking for.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!