teaching machines

Feature 6

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

My biggest challenge this time was correctly reflecting the skybox off the water. The vector that needs to be reflected is the direction from the camera to the world position. There was no way to get this with the shaders written in the water tutorial video. Passing in the camera’s position as a uniform was simple enough. In order to get the world position, I had to split up the camera’s view matrix and the xform matrix, which had previously been multiplied together before being set as a uniform.

With these separated, the shaders have everything necessary to calculate the reflection vector. Here’s what those parts look like: http://imgur.com/a/ba7o9#0

Here is a video showing the result:


[youtube http://www.youtube.com/watch?v=gz5Gbe9f_ZE?feature=player_detailpage]