For my project, I made a UFO soar and fly around the New York City Landscape. DisneyLand is one of my favorite theme parks and my favorite ride at that park is Soarin' Over California. I also like sci-fi movies especially movies about little green aliens. Then, I thought why not combine the two ideas together and hence my project. The goal of my project is to be able to experience the beautiful landscape of New York City after it has been taken over by aliens. The UFO can fly anywhere around the city, between buildings, fly around the ocean, and even can visit the statue of their great alien leader.
Controls for the UFO:
W - move forward
A - move left
S - move right
D - move backward
Z - move up
X - move down
You can rotate the UFO by clicking on the UFO and turning it to your desired direction.
However cool the project was, it wasn't without any technical difficulties. Though I found an obj file for the 3d model of the entire city landscape, the vertex normals were not properly rendering on the screen. The city skyline would appear all black and I didn't know what to do until Professor Sueda suggested I should two sided lighting. I implemented it by checking if the dot product between the normal vector and the lightvector is less than zero and if it is indeed then I would negate the normal vector which renders clear images of the buildings..
I also had texture mapping issues with my UFO and the buildings. Sadly though, the texture maps were incomplete for the buildings because creator of the obj file designed the texture maps only for two buildings of the city and the texture maps were a bit too advanced for my graphics knowledge and I needed to keep track of which texture coordinates apply to which map. I ended up being unable to assign texture maps for the buildings and I opted instead to apply grayish colors to the buildings instead.
Even though I had texture mapping issues for the UFO, I managed to design the texture maps for the UFO. Kyle Piddington, the class TA, recommended that I use the convert code provided in our Piazza post to merge the two jpa files of the UFO texture maps together and I used my merge OBJ file to draw out the UFO. I implemented two seperate shaders for the city and the UFO. One shader takes care of the negation of the normal vector for the city and the other shader takes care of the texture mapping of the UFO.
I had issues with sky line when I was using the cube.obj. It kept clipping the sealine until I chose to use the sphere.obj which was more fluid and did not clip with the sealine. I wanted to make the movement of the UFO more fluid and smoother. Initially, I wanted to fly a plane but planes are a lot harder to rotate the plane and requires a more elliptical orbit. For an orbit, it is easier to rotate the UFO by clicking the UFO and rotating it with the cursor. I managed to implement that when I adjusted the Camera's setlookAt method to look at the target vector which in this case the UFO. I adjusted the apply view matrix to look at the target vector instead of the camera position.
Finally, collision detection was to be truthful a nightmare. The number of vertices in the buildings made implementing detection complicated and collision between a box and a spherical collision at this magnitude made it almost impossible for me to implement. However, I did add some collision when I made sure the ship could not go beneath the city or the water surface when I hard-coded a if statement that would check how far below the UFO is. If the UFO is below the surface, I coded it so the surface is set to the ground-level position.
I implemented a shader for the sun that provides a lighting for the city. My Professor recommended that I use Bling-Phong shading to design the lighting for the project. I implemented it when I used the MV->topMatrix and multipliled it with the worldlight position(which is the position of the sun) and passed it in as the lighting position.This will be used in the fragment shader done in previous labs and assignments that uses the ambient, diffuse, and specular and outputs the lighting of the sun.
In the future, I would like to figure out how to do the texture mapping for the buildings and figure out how to do collision detection between the buildings.
References for OBJ Models:
The sphere and cube obj files were provided by Professor Sueda.
URL for The 3d model of the city landscape: http://tf3dm.com/3d-model/the-city-39441.html
URL for The UFO model : http://tf3dm.com/3d-model/ufo-53687.html
URL for the Alien model : http://tf3dm.com/3d-model/alien-86206.html
These are the pictures of the UFO. Enjoy!
In the end, this project really demonstrates how much I have come from the beginning of this course. I can't believe looking back at this project how much I have learned. I look forward to taking more classes in computer graphics and hopefully I can design bigger and better models.