Spotlight

CPE 471 - Jason Widjaja

 

 

The purpose of this project is to demonstrate the effect of spotlight and attenuation to a scene. A spotlight is a restricted point light, in which that instead of lighting towards all direction, it only shines in a cone shape (similar to a flashlight) in a directed direction. The light also includes attenuation, in which the closer the light source is to the fragment, the brighter the color becomes. 

 

Controls:

w : move forward

a : strafe left

s: move backward

d: strafe right

i/o: increase/decrease cone angle

k/l: increase/decrease attenuation

x/y/z: increase light position in x/y/z direction

X/Y/Z: increase light position in x/y/z direction

 

Technical difficulties:

1.     Rendering the scene

a.     As there are many objects to be loaded, half of the time spent on the project is spent on creating the scene itself

b.     Solution: separating the objects makes rendering easier as I can just use one render function.

2.     Setting up the cone direction

a.     Changing the cone direction somehow also change the position of the flashed light (the light is not angled).

b.     Solution: by only incrementing the light position instead of both cone direction and light position, the light became angled.

 

Future Implementation:

 

-       Shadow mapping:

o   Due to time constraints, I was not able to implement shadow mapping. The scene would look more realistic if shadows are implemented. This is especially true when I move the light position, as shadows become more apparent.

 

 

 

 

References:                             

http://www.tomdalling.com/blog/modern-opengl/08-even-more-lighting-directional-lights-spotlights-multiple-lights/

 

http://www.tomdalling.com/blog/modern-opengl/07-more-lighting-ambient-specular-attenuation-gamma/

 

 

Pictures:

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web1.jpg

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web2.jpg

 

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web4.jpg

 

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web3.jpg

 

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web5.jpg

 

Description: Macintosh HD:Users:Widjaja:Desktop:Spring2016:web6.jpg