This project generates a scale render of the Cal Poly P and the surrounding hills and landscape.
Details
Building the Renders
To get an exact scale render of the Cal Poly P hills, I used Google Earth to pinpoint the exact grid square of the hills in hand with the program Simple DEM (Digital Elevation Model) to display the grid as color elevation with shading. From there, I created a greyscale heightmap of the image to read into the program. Finally, I used Blender to create an obj mesh of the Cal Poly P.
Displaying Heightmap
All the graphics for this project are done using OpenGL 2.1. To load the heightmap into my program, I used the CImg external library in conjunction with X11 to read the greyscale image into an array of floats where every three values equal the x, y, z values of a point. I read the color value of the heightmap as the height value in the array where the lighter the color, the higher the value. A total of 5 different textures were used to model the hill landscape. To create a smooth transition/blend between each texture, ranges were set where each individual texture would reside. At certain intervals, the textures were blended by adding them together so that at the highest point of the image has all five textures on top of one another.
Controls
Feel free to roam around the scale landscape using the WASD keys and the scroll feature on your mouse/trackpad to look around. This movement is accomplised using a pitch and yaw camera. There is no collision detection, so check out the underside if it tickles your fancy!
Unimplemented Features/Closing Notes
When I first started this project, I was unaware of the myriad of difficulties that were ahead of me. I initially started off with the idea of implementing a skybox to surround the camera, day and night time changes with a rising/setting sun, and volumetric fog that would fill in the lower levels of the landscape during the night. As you can see, not all of that was implemented. A lot of time was spent using Google Earth and SimpleDEM to find the exact grid square that held the Cal Poly P. Once I was able to pinpoint the location, the next difficulty was correctly reading and loading in the heightmap. Dozens of tutorials exist on the interwebs, but all are implemented differently using different external libraries and techniques, so finding one that fit with my project restrictions proved very difficult. I ended up taking pieces of help from a handful of different tutorials. All in all, I learned a great deal from this project and I would say the biggest take away is that heightmapping and texturizing are two neat technologies.
References
Multilayered Terrain
Beautiful Landscape by Means of Heightmapping
The CImg Library
Thanks for your time!
Mike Sevilla