As many of you are, I am working on a game.

I have just added my first attempt at shadow mapping (standard variation) and quite frankly I am very disappointed.

I am literally squeezing as much out of this approach as possible and it simply not usable.

Its too slow and too ugly to look at!

So what do people do?

I have bumped into something called "Perspective shadow mapping" but I have not got any working examples of this yet and I don't really want to spend a long time working on this only to find that its too slow to use and not all that much better.

So what I am asking for is some feedback on your experiences and how you overcome all the problems with shadow maps.

Some details are: I have a single light (point light) Standard first person type game The light moves (all the time, but slowly) The draw distance is not very far

If I don't use shadows then the game runs at 500 FPS, and with shadows it drops to 90!

Edit: As I have said, I have put a lot of effort into this so I have already solved: Getting the tightest possible near/far Getting the tightest X/Y (without constant change per frame) I have no peter panning No acne

But, due to the fact that my light moves all the time I get constantly (shaking) shadow pixels.

And the only way I am able to make the shadows look crisp/and stop shaking is to make the shadow map ridiculously high resolution. And this then drops the frame rate too much.

I understand all the problem, but what I want to know is what do people rely do to solve the problem. People cant really be using this in games as its just no good.

I am also looking into cascaded Shadow Mapping. That looks to be the solution. What are people experience with this?

  • 1
    \$\begingroup\$ This question looks quite broad to me. Shadow mapping is a huge topic, with lots of different problems can arise, and different solutions to those problems depending heavily on the application. To help narrow the question to get specific answers most useful to you, I'd recommend including a summary of exactly what you're doing so far, and precise descriptions (or images/videos) of the problems you're observing. For performance improvements, including profiling information will help identify whether there are particular trouble spots you could optimize. \$\endgroup\$ – DMGregory Jul 29 '16 at 18:06
  • 2
    \$\begingroup\$ If you implement all the recommendations in msdn.microsoft.com/en-gb/library/windows/desktop/… you will find all your problem go away. One last hint not included in this link is that, once you have a stable light frustrum (i.e. it doesn't move with every change in the Camera frustrum) then you need only recalculated your depth texture once every 10 or 20 frames, or only when the view camera substantially changes position or orientation. \$\endgroup\$ – PhillipH Sep 24 '16 at 12:59

Any other forms of shadow mapping are probably going to be slower.

I would not necessarily say it is too slow if you are getting 90 frames per second, though. When you have nothing going on in a scene it's very common to go from a very high frame rate to a much lower one. Yes, in a sense 4/5 of your power is going to shadows, but it is a relative measure not an absolute one. It doesn't mean that you can't still add all the stuff you need to onto the screen without going under 60 fps.

For talking about quality, it is too vague to just say they look bad. Likely you have something wrong like shadow acne or having too low of a resolution.

It's also possible you have some implementation detail slowing down your results but that is impossible to tell without code to look at.

This tutorial is pretty good for covering basic shadow maps and you can tell the performance is good.


It's in opengl but it describes the concepts and pitfalls pretty well.

There's also cascading shadow maps you could look into, but as I said any other kind of shadow map will be even more expensive.


Likely it looks ugly because you have problems like shadow acne and peter panning, it is likely not aliased either. OpenGL-tutorials.org has great tutorials for shadows. Even if you're using DirectX. Here is the link.


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