Project Design

For this final project I created a simple haunted house scene. For this project my main goal was to create a character with a rotating camera attached to them so they can explore the world. The character has a flashlight that can be turned on and off. The character also has collision detection for most objects in the world.

 

Creating the Scene

Technical Features:
Keys

"wasd" for player movement control
"f" toggles flashlight on/off

Flashlight

 

For the flashlight I used an openGl tutorial talking about different light casters. This spotlight is a point light with cutoff points to give it a circular shape. For each pixel I calculate the distance attenuation from the light source and appropriately color that pixel. The rest of the world is very softly lit by a directional blinn phong light. I purposely made the light very weak to make the flashlight effect even more apparent.

Collision Detection

I also implemented collision detection on most objects in the world. The outside walls are passable so the world can be viewed from outside and the ghosts are passable because there ghosts! To do the collision detection I used bounding boxes around the shelves and tombstones. When the character moves the new character bounding box is checked against each of the bounding boxes in the scene. If there is a collision the change of position is reverted and the character will not move.

 

References

These are the sources for all my models i used in this project. As well as a few online tutorials I used to achieve the effects in the project. Thanks for checking it out!

https://learnopengl.com/Lighting/Light-casters
https://www.turbosquid.com/FullPreview/Index.cfm/ID/688367 https://www.turbosquid.com/FullPreview/Index.cfm/ID/681404
https://www.turbosquid.com/FullPreview/Index.cfm/ID/1250634
https://www.turbosquid.com/FullPreview/Index.cfm/ID/911909
https://www.turbosquid.com/FullPreview/Index.cfm/ID/689759