Is it possible to calculate shadow areas of buildings or simulate shadows of buildings in a city, using the heights of these buildings and the sun angle and azimuth?

The basic light tracing concept using trigonometry is known. However, how would one come up with simulated shadow of group of buildings in one place?

  • 2
    Cool question. I wonder though if you might get better initial responses from the new Physics StackExchange? Nov 10, 2010 at 10:55
  • Note that a group of buildings are prone to shadowing both their surroundings and each other. This may affect what it considered 'shadow area'.
    – 9000
    May 18, 2015 at 14:12
  • You would also need to know building's ground plan and positions.
    – Euphoric
    May 18, 2015 at 14:39

3 Answers 3


Yes, this is a matter of projecting the geometry of the buildings onto a shadow plane along the sun angle, and then computing the union of the resulting polygons. This gives a single polygon that you can then get the area of by simple triangle subdivision. All of these features are actually built into your graphics card these days.

If your buildings are non-polygonal and you need a precise answer you're out of luck unless you can model them mathematically, but really that's a rare case these days--everything's built of polygons, and/or you can get away with an approximated answer.

For a specific solution, I'd recommend asking this question on Stack Overflow.


Yes, of course this is possible. It is called ray tracing.

Being old and grey means I can remember when ray tracing was exclusively the province of large supercomputers. It is now routinely assigned as an undergraduate computer graphics class programming assignment, and the results can be STUNNING.

Take a look at this, for some examples of what the kids are doing these days.

  • I'm pretty young yet, but I've read a bit about what PCs used to be capable of, and yes, it's pretty amazing how far we've come.
    – Michael K
    Nov 10, 2010 at 13:27
  • I'm still waiting for real-time raytracing. We're getting close! Nov 10, 2010 at 17:54

Are you actually ray-tracing? If so, you backtrace from the point being rendered to the light source. If it intersects one of the buildings, its in a shadow.

If you are using OpenGL/DirectX for real-time graphics, there are other solutions - look around online as thats a fairly big topic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.