This is my final project for 559-- Graphics town. This implements many of the pieces I made earlier in the class, and some new elements as well. There are houses and a theater using custom made textures. I created the texture images in Photoshop, and then mapped the vertices of the objects (like the cube of the house) to a u,v position on the texture map. This is a process known as texture mapping, and while tedious, I found quite fun. There is also a big texture for the ground plane, and an environment map for the background that is dynamically reflected off objects, and provides its own light source to objects with low roughness.
The part I am most proud of is the track. I recently got into Formula 1 racing, and decided to make an F1 track. This is similar in concept to the train project, but this time with a 3D spline that has to account for banking, and vertical coordinates making the trig a lot more involved. The cars get a random speed to move around the track generated every set interval with a smoothing period in between to make things seem more like a race, and not two cars moving around at constant speeds. The leaderboard is a live-updating texture that is generated every render frame and tracks the fastest lap, and laps completed by each car with the leader on top. Finally, there is a second environment map that takes the form of a screen on the leaderboard. This is to simulate a jumbotron or something like that. There is also a custom WebGL shader written in GLSL applied (using vertex and fragment shaders) to create a static effect, like you may see on a screen.
Again, this is a deceptively tricky aspect to implement. In order to generate the image, a second camera has to be inserted into the scene. However, the screen cannot already be there since its contents have not been determined yet. So, multi-pass rendering is utilized to render the scene once without the screen, snap a "photo" to capture the state, and then render a second pass that then includes this capture as an image on the board. Keep in mind, this is done every frame, or 60fps, or every 16.7ms.
You can read more about the specifics and everything I implemented in these text files for the submission:
Open View Code