I think im on good way to grasp the complete concept of simple hard-edged shadowmapping! The thing i find the hardest to grasp though is about the individual shadow-render for each light...

Since the example shadowmap-textures i have looked at are normal textures with a width and height as any other texture and does not cover the entire area around the light but only the area within a normal view-frustum i cannot help but wonder if it is about rendering a shadowmap for each light AND object with the camera centered on the object in each render?

I think it feels weird since this would create an exponential growth in the number of shadowmaps used in proportion to lights and objects.

I've had a hard time finding information on the subject and simply find it confusing...

So my question basicly is if this is how it works or if im missing something else?

By the way, if this question is confusing it might be because i have mostly learned this from the perspective of deferred shading but i dont think that should make much of a difference, right?

If you would use code-examples to explain something i would appreciate C# syntax by the way...

  • 1
    \$\begingroup\$ tinyurl.com/p6grfng Look at this. You render shadowmap for each light that casts shadow (That means draw scene from the view point of the light). And you only need to know where it casts shadow inside frustrum you are looking at. You draw scene from the view point of light and store depths of everything you render - shadow map is actually a depth map from lights perspective. Then you use these depth maps from all lights for comparison with cameras depth map to know which pixels are shadowed (if your camera sees pixel that light doesnt see, then there is a shadow). \$\endgroup\$
    – Kikaimaru
    Jun 7, 2013 at 19:09
  • \$\begingroup\$ I have been through that tutorial and a couple others but did for some reason not find the answer to my question. I already understood the depthmap concept and just wondered how to cover the entire surroundings of the point-light. Anyways, i got my answer below but thanks for answering! And by the way... As far as i know i should not compare the 2 depthmaps to eachother but rather the light's depthmap to the distance from the pixel to the light in order to get an accurate result. \$\endgroup\$
    Jun 7, 2013 at 22:04

1 Answer 1


No, you would not typically render a shadow map for each light AND object. Typically there will be a fixed number of shadow maps per light (sometimes 1, sometimes more), but the number of shadow maps doesn't usually vary with the number of objects to be shadowed.

There are three kinds of lights commonly used in computer graphics: spot, point, and directional.

  • A spotlight only shines within a cone with some fixed width, so the shadow map frustum only needs to be big enough to cover that width.
  • Point lights (omnidirectional) are commonly just not shadowed at all. But when they are shadowed, it can be done using a cubemap - 6 individual shadow maps forming a cube, each with a 90-degree-wide frustum; collectively they cover the entire sphere of directions around the light.
  • A directional light theoretically covers an infinite area. In practice, if the scene is small you can simply fit a shadow map around the boundaries of the scene. If the scene is large, such as outdoor areas in an open-world game, cascaded shadow maps or CSMs are a very good and popular solution. CSMs take the camera's view frustum into account; they focus several shadow maps on different parts of the camera's frustum, with higher resolution closer to the camera and lower resolution farther away.

There are occasional cases where an extra shadow map might be drawn for a specific object. For example, in a cutscene where you are doing close-ups on a character, you might like to put in an extra shadow map focused on the character's head, so you get ultra-high-quality shadows on the character. Or in a racing game, you might put in a shadow map focused on the player's car. But that's the exception rather than the rule, and would only be turned on for specific cases where the extra quality is desired.

  • \$\begingroup\$ Very good answer! The cubemap was what i was looking for. Sorry if i left som info out, i think i could be more specific. However, those 6 maps should then all be rendered in 1:1 aspect ratio then. I guess what confused me was that the shadomaps i had seen was in a wider aspect ratio. From here i guess it is just to check the angle from each pixel to the lightsource in order to know which of the 6 shadowmaps to use and compare the depth with the distance from the pixel to light right? \$\endgroup\$
    Jun 7, 2013 at 22:00
  • \$\begingroup\$ @DOOMDUDEMX Yes. DX11-level GPUs support depth cubemaps directly, so you wouldn't even have to choose the cube face yourself; you could just feed in the vector from the light source to the pixel and it will figure out which cube face to use. On older GPUs you might have to do the math yourself. \$\endgroup\$ Jun 7, 2013 at 22:19
  • \$\begingroup\$ Oh, that sounds nice! Ill have to look into that! Even though the math isn't too advanced i'll assume that the built in functions come with better performance! Thanks again for some high quality help! \$\endgroup\$
    Jun 7, 2013 at 23:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .