I've been working on implementing variance shadow mapping for my game. I was able to get a spot light working with variance shadow mapping with a gaussian blur applied to the shadow map to reduce the aliasing. Now I'm trying to implement point lights but I'm not sure how to adapt the gaussian blur to work with the the shadow map when its stored in a cube map. I've searched around for a while but I can't seem to find any examples that use point lights. Can anyone help me out here?


There is an example of how to do variance shadow mapping with point lights, but it uses dual paraboloid mapping instead of cube mapping. The tutorial with the example is shown here.

If you're willing to deal with a bit less detail than cube maps, DP variance shadow mapping is easier to code, and requires two textures instead of six saving you some memory. You also only have one seam to hide.

Point lights are usually the hardest kind of lights to apply shadow mapping to (and consume more memory), which is why many games do not use them so often.

| improve this answer | |
  • \$\begingroup\$ I've seen that tutorial but I was trying to avoid that method since I was going more for methods that look nice rather than being fast enough for a commercial game. It looks like I'll just have to go that route anyway since there doesn't seem to be any documentation on the cubemap method \$\endgroup\$ – Telanor Sep 23 '11 at 3:44
  • \$\begingroup\$ @Telanor If your priority is "nice looking", you could always increase the width and height of the two render targets used to create the DP map. Then you'll have a hi-res texture for the shadows. \$\endgroup\$ – ChrisC Sep 23 '11 at 18:04

When I've implemented this before, I just blurred each cube face individually, using a standard 2D Gaussian blur. You can potentially introduce seams at cube edges, because the blur doesn't go across them, but in my experience this was hardly ever noticable. YMMV, of course.

You could probably even do a blur across cube edges by writing a blur shader that would take its input in the form of a cubemap, and distribute samples around a 3D vector, sampling a cone of directions. That sounds tricky and slow, though, so I'd try just blurring each face individually first.

| improve this answer | |
  • \$\begingroup\$ I haven't tried that specifically because it seemed like the seams would be very obvious, but I'll try it out and see how it looks. Your 2nd suggestion is probably the answer but I'm not sure how to alter the samples to do so, I dont really understand blurs very well \$\endgroup\$ – Telanor Sep 19 '11 at 22:04
  • \$\begingroup\$ After working on it on and off for the past 2 days I wasn't able to convert the 2d sampling coordinates to 3d to be able to blur the cubemap correctly, so it looks like I'm going with the dual paraboloid method \$\endgroup\$ – Telanor Sep 23 '11 at 3:48
  • \$\begingroup\$ @Telanor, here is an article about doing the cross-face cubemap blurring; maybe that will help. developer.amd.com/media/gpu_assets/… \$\endgroup\$ – Nathan Reed Sep 25 '11 at 19:32
  • \$\begingroup\$ Ive seen that article but it's not nearly detailed enough for me. Maybe someone with a lot more experience than I could implement it just by reading a description like that but I'm just a beginner with 3D programming; I need more of a tutorial if I'm to have any hope of implementing it. \$\endgroup\$ – Telanor Sep 26 '11 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.