teaching machines

HW F.8 – Hannah

March 13, 2013 by . Filed under cs455, postmortems, spring 2013.

For this feature, I added a texture to my terrain. I found an image online of a view of a Packer football field, and the image was square. I took the image and converted it into a PPM. In my vertex shader, I forwarded texture coordinates on to the fragment shader using the x and z positions divided by 128.0, the width of the terrain, to put the coordinates in the [0, 1] space. The terrain doesn’t really look like “terrain,” but that’s because it’s a football field, and it should be relatively flat. However, it still is computationally generated; I just put the corners of the terrain at zero, generate within three, and decay by a factor of 0.45. Everything went very smoothly, and I didn’t have to reference any more than the lectures.

I did add a second goal post and fiddled with orienting them. It turned out that I hadn’t actually implemented my GetRotateAroundX and Y methods, so I had to reference the Rotation Matrix page by Wikipedia to get those matrices. And voila! I had goal posts.

Here is the shader code for the terrain with the texture:

 

 

 

 

 

 

 

 

 

Here is a picture of my football field:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Finally, here is my video of me running around on my football field!

http://youtu.be/7De3KzGfVbw