teaching machines

Feature 6 Post Mortem

April 6, 2013 by . Filed under cs455, postmortems, spring 2013.

In order to implement this feature, I decided it best to totally rework my landscape to better integrate a source of water into the scene.  This was the result of some brief fiddling around in GIMP, making a height map and corresponding texture:

Up close, the water looks more like this:

This feature took quite a bit of effort to get working correctly.  Initially, the reflection on the water would just reflect the same image, regardless of where you were standing.  The same section of the skybox would always be displayed at the center of the screen.  After some investigation, I discovered that the vector used as our angle of incidence in the reflection was in clip space, meaning it will always be the same at any one point on the screen, regardless of where the camera is located or facing.  In order to correct this, I had to modify the shader to do the reflection calculation using world space instead.  The new angle of incidence became the difference between the camera position and the water’s vertex positions.  This resulted in the nice looking reflections shown below.
 
[youtube http://www.youtube.com/watch?v=-33FhcqdL4o?feature=player_detailpage]