Prepared by:

Gufran Vanjara

CPE 471: Computer Graphics

Brief description of the final project

My final project was to render the main mosque in Makkah, Saudi Arabia (Mecca). I chose this project because I was interested in rendering some 3d scene and this seemed like the perfect choice. My initial goals as laid down in the final proposal were to use texture mapping on the Kaaba (cubic structure), the floor and the surrounding area. The more advanced features would include dynamic lighting, shadows and color of scene depending on the position of the sun.. Also, I was going to add shadows that would change position depending on the position of the light.

History:
Before I speak about my project,  I think it will be informative for the readers to know about the history of the place I  was trying to render.  The scene you see in Figure 1 below is inside the main mosque in Saudi Arabia, Makkah(Mecca) and the holiest shrine for the Muslims. This city is filled with pilgrims year round, and in the month of Dul-Hijja( this year,2003, it will be in December), 2 million Muslims pack this city from all around the world to fulfill one of the pillars of Islam, which is the pilgrimage to this city. Nevertheless, pilgrimage to this city was not introduced after the coming of Islam, but it was started from the time of Prophet Abraham(peace be upon him) . God ordered Abraham and his son Ishmael to build this house of worship that would honor and signify the oneness of God. The Kaaba, the black cubic building that you see in the scene, was then built by Abraham and his son Ishmael( peace be upon them). It is stated that Abraham was asked to call out to people from all parts of the world to come and worship the ONE God. Abraham replied that his voice would never reach everyone, upon which God told him that Abraham's duty was only to call out to people and it was God's responsibility to carry his voice all across the world. Thus, today when millions of Muslims flock to Mecca and to the sacred Kaaba, it is God fulfilling his promise to Abraham. Makkah was orginally a desert city, but an integral trade center in the lands of Arabia. All the important trade took place in this city, and the Kaaba was always the focal point, although wit the passage of time the Kaaba was now used by pagan Arabs to store idols. It was after the coming of Islam, that Prophet Muhammad(peace be upon Him) broke all the idols and restored the kaaba to honor the oneness of God.
The Kaaba itself is a simple cubic structure whose measures are as follows:
Northern wall 11.03 meters
Southern wall 11.28 meters
Eastern wall 12.70 meters
Western wall 12.04 meters

The black cloth around the Kaaba is called Kiswa and is replaced every year on the last day of the annual pilgrimage. The present cost of making the kiswa amounts to SR 17 million. The cover is 658 sq. metres long and is made of 670 kgs of pure silk. For embroidery 15 kilos of gold threads are used. It consists of 47 pieces of cloth and each piece is 14 Metres. long and 101 cms broad. The kiswa is wrapped around the Kaaba and fixed to the ground with copper rings.  For more information on this, look at http://members.tripod.com/worldupdates/newupdates10/id43.htm. I hope this history was interesting and a little beneficial.

Achievement
My achievement in the project was limited to the basic functionality. I was able to apply texture mapping to all my geometric objects. The four faces of the Kaaba had the same texture map, although they should have been different. If you look at the four faces of the cube, they all have a door on it. In the real picture, only one side has a door. The reason for not being able to apply a different texture map was the unavailability of good pictures. The pictures in which the other faces were visible, were rotated and hence made it difficult to crop in a photo editor. I was able to find a marble texture for the floor, but it is not the same one that is in the real location. [Refer to Figure 1]
    For the scene around the mosque, I used a desert skybox, which I was able to find at http://www.planethalflife.com/crinity/skyspace.htm. Apart from texture mapping I added sphere to simulate a sun, where I also put my directional light source. The sun and the light source could be translated, which gave shading effects on the screen. I was not able to obtain dynamic color changing for the scene.

Program usage
The  functionality in this program is controlled by a few keyboard keys. Below I will summarize what those keys do and also include some screenshots.

1) Camera Transformatiions:

    -  Moving the camera left and right:  Use the 'a' and 'd' keys to move the camera around the cube in the left or right direction respectively. The camera will move 360 degrees around the Kaaba.

    -  Moving the camera up and down: To move the camera vertically, use the 'x' and 'c' key respectively. The 'x' key will move the camera vertically, up to 90 degrees. The 'c' key will bring the     camera  back down to zero degrees.

    -  Zoom In and Zoom Out: To move the camera closer to the cube or away from the cube, use the 'w' and 'z' key respectively. The 'w' key will zoom in the camera closer to the cube, but will stop at a certain point. Similarly the camera can be zoomed out using the 'z' key and it will zoom out until a pre determined  value is reached.

2) Dynamic lighting:
    Dynamic lighting, or more correclty, dynamic shading is achieved by moving the sun around in the scene. This can be done by right clicking on the application window and selecting the 'transform' menu option. Select the "move sun and light". After that hold down the mouse key and move the mouse in the direction you want the sun and the light to move. Doing this, you will notice different shading in the scene, depending on the position of the light. For example bring the light closer to the floor will make the scene darker.

Screenshots
This image is the real loacation of the mosque
                                                                Figure 1: Real scene of the Kaaba.

Figure 1 is the real scene I was trying to simulate. Notice the shiny marble floor and the beautiful night sky which creates some very nice lighting.

Front Camera shot of the scene
                                           Figure 2: Front camera scene with the sun in the background

Figure 2 is the initial screen you see when you run the application. Notice the desert background. Makkah is a city in a desert, hence I thought it would be appropriate to use this sky box.

3D look of the Kaaba
                                             Figure 3: 3D view of the Kaaba
Figure 3  shows a 3d view of the Kaaba which was not visible in Figure 1.


Ariel view of the kaaba
                                              Figure 4: Ariel view of the Kaaba

Figure 4 is just an ariel view of the Kaaba. Note the different texture on the top of the cube.

Some resources for future generations
There is a lot of information available on the internet that speaks about OpenGL. All that is required is some searching on google[ Using boolean expressions help. For example, search for texture mapping+opengl]. Below are the few resources I used which you may find useful.

1 ) www.opengl.org. This link is the official website for OpenGL. It has a lot of resources and should be a starting point in your project.
2) http://nehe.gamedev.net/. A lot of good tutorials available. You will definitely find something that you are looking for.
3) prodigy.openglforums.com. I got my camera transformation code from here. Worth looking at.