This project is designed to not only display beautiful Cal Poly campus environment but also reflect a popular discussion topic nowadays- Coronavirus Crisis. It's done using OpenGL, C++, and an open source tool - TinyObjLoader. I am excited to see how real-world remote sensing data enriches this interactive computer graphic project. To reduce the size of the raw data, the quality 3D obj mesh has to be compromised.
My original intent is let players to experience a virtual tour of the Cal Poly campus. Therefore I implemented a first-person-view camera where the player is placed in front of the camera in the direction towards target. Player is translated horizontally according to the keyboard update. Whenever player presses one of the WASD keys, the camera's position will be updated accordingly. Player's vertical offset is set by the terrain height. Player can use mouse scroll to look around. Accordingly, the View matrix will be adjusted by the new "eye" and "lookAt" value.
For the 3D campus scene, I discovered many ways to generate OBJ from Point Cloud data. The raw LiDAR data comes from recent survey from the San Luis Obispo County. There are softwares like ArcGIS Pro, MeshLab and Agisoft Metashape that perform such data processing and generates 3D spatial models. Through trials and erros, Agisoft Metashape Pro is able to write out vertex color (RGB) directly into OBJ file, which comes handy later on. However, the couterpart is the exported mesh is blurred. Generating a "clean" mesh of the buildings and trees needs intensive effort. If time permitted, I would seperate the entire mesh into a multi-mesh with buildings, terrain, trees, path, etc by restraining the shape based on basic geometric shapes.
Each vertex comes with X Y Z coordinates by default, some comes with vertex color R G B value in addition. I modified the tinyOBJloader, Shape.cpp/h and added a feature so it reads vertex color if there appears to be any, similar to how it reads vertex normal.
A Skybox consists of 6 2D pictures of the blue sky. Cubemapping enriches the background and make the campus to look more realistic. Future improvements could be replacing the pictures with a real scene of San Luis Obispo, where players can see Bishop mountain and the "P".
Y and Z axis for the 3D campus mesh is reversed, therefore instead of using "Matrix->rotate()", I wrote my own rotation function which takes an angle and a vec3(x,y,z), modify the shape.mesh.positions value based on the rotation angle. After proper manual transformation, I saved an average height of the grid into a 2D array. I can get the corresponding height using current X and Z value.