Fakultät Informatik

Sun in the City

Supervisor: Joachim Georgii
Author:  Alexandru Duliu

One of the key interests for architects designing a new building is the way it which it will be illuminated by the sun and how it's shadows will behave. Shadows play an important role in urban planning because when planning a new building, one must also take into account how it will affect the lighting conditions around it. Also because of environmental and economic concerns, it is important to try to maximize the natural illumination of a building.
This Project implements a simulation of the shadowing and illumination of a model under outdoor conditions.


  • Load DXF-Files which contain the models
  • Evaluate the shadowing and lighting conditions of the scene from multiple positions of the sun
  • The Position of the sun must be computed depending on the geographical position of the model and the exact time and date.
  • Results for each sun position must be blended together
  • Visualization of the results

One of the main concerns of this project was speed. To achieve this, the shadows where done with shadow maps which is a technique that runs almost entirely on the GPU. One weak link in the shadow mapping calculations with OpenGL was the copy of the depth buffer in the first pass. Until not to long this was either very slow (glCopyTexSubImage2D) or very complicated (P-Buffer). For this project the new Frame Buffer Objects Extension was used which offers a very fast and easy to use implementation of the render to texture functionality.
In order to display the shadows of a large number of light sources (1 – 255) and still be interactive, the shadows had to be computed in a preprocessing pass and rendered into textures so that they only have to be mapped on the model. Each primitive (triangle or quad) was “photographed” into a “texture atlas”. This was done by placing the camera just above the triangle and filling the entire view port with the primitive. The resulted image was rendered into a portion of the “texture atlas”. A “texture atlas” consists of (2048 / resolution of the primitive)2 primitives, and there are usually more then one texture atlas for a scene.
Almost all rendering was done using Shaders written in GLSL. This offered a possibility to have full control of all the aspects of the rendering and even improve on some occasions. One such example is the use of a adaptive pixel offset dependent on the angle of the face with the light diection to get rid of self shadowing artifacts.
As to the visualization of the results, the user can choose just to view the shadows or shadows with illumination (diffuse Lighting). Shaders where also used to artificially color the scene (the actual data is gray scale) in order to enhance the contrasts.


Shadows with 16 positions of the sun
Shadows with 128 positions of the sun
Shadows with 128 positions of the sun (synthetic colors)
Shadows and lighiting with 128 positions of the sun
Shadows and lighiting with 128 positions of the sun (synthetic colors)




- Game Devel. Lab Practical for SS'18: kick off meeting on April 3rd,  details here. No matching system sign-up needed!

