Two Triangles Assignment - CSG140 Computer Graphics - Spring 2004

Professor Futrelle

Version of 31 January 2004

Note 1/31/04: At the bottom of this page is the first screen shot I received from a student. It's fine except that it was sent in Windows-based .bmp image format. It should be exported as .jpeg or .png to be compatible with browsers. I'm not sure what Solaris viewers there might be, if any, for .bmp files. So please turn in shots in a more cross-platform format such as .jpeg or .png. I've converted the image I sent to jpeg and that's what you see below.

Note 1/24/04 on finding z for a given x,y pixel in 3D triangle: Here's a page that explains how to do this. And it's simple.

The basic idea of the assignment is rather simple. You are to set up two connected non-coplanar scalene triangles in 3D that are joined, so there are four distinct vertices, as shown below. The size can be about 200 pixels wide, total. Assign each vertex a distinct color. Then, using barycentric coordinates, for each x,y position you assign a color using Gouraud interpolation. (Of course in your figure you don't draw the text or the color squares or arrow; these are just for explanation here.)

The most striking feature of your result should be that the "seam" between the two triangles will have disappeared, with the colors varying smoothly within each triangle and smoothly from one to the next.

There are two immediate sources of information to help you with this, and I'm sure you can find more, as needed. The first is my rectangle shading demo program here (in Java). The second is the various discussions in the book of barycentric coordinates and interpolation, including Sec. 2.11 and all of Chapter 3, with focus on Sec. 3.6. There's a third source of course, our discussions in class and email and our mailing list. Please do use the list.



Go to CSG140 home page. or RPF's Teaching Gateway or homepage