Hieu Phan & Dan Nelson
Please find our code in nelson-phan/handin_project7.zip
In this project, we implemented z-buffer rendering to do hidden surface removal. In our projects thus far the order in which we made our primitives dictated the way they were drawn into the image. For instance in drawing a scene we would put the images in the background first and then place the foreground images on top of them. If we ever wanted to rotate the scene then this could cause us problems by switching the order of the shapes that we had originally intended.
We are interested in 1/z instead of z because 1/z interpolates linearly in image space.
Required Picture 1
In this following picture, the box is colored in the ShadeConstant mode.
In the following picture, the box is colored in ShadeDepth mode. The further the point is in the background, the less light it gets.
Required Picture 2
Hieu's image showing that z-Buffer is working
In this image, I draw 3 boxes which are 0.5 units away from each other in terms of z coordinate. I rotate them to change the angle and we can see that sometimes you can see 3 different boxes and sometimes you can't.