Second Assignment - CSG140 Computer Graphics - Spring 2004
Professor Futrelle
Version of 6 February 2004
Second assignment - Starting to build/render complex objects - due February 18th
The suggested steps you should follow are listed below.
Remember to take small steps and make sure things work nicely at each
step before moving ahead. I will discuss strategies for this assignment
further during the February 5th lecture.
- Create data structures for 3D points, vectors (edges) and triangles, with no
transforms involved. There are suggestions for types of data structures
in Secs. 12.1 and 12.2 in the text.
- Use them to manually create a few simple structures that
share points and draw them as wire frames.
You may use built-in line drawing procedures for these.
You can draw each edge in a distinct color.
You could try a tetrahedron and then a triangular cylinder or
cube.
Remember, all quadrilaterals should eventually be broken into two triangles.
- Now render each triangle as a solid color, no interpolated
shading. Each triangle can be a different color.
Manually choose which faces will be visible, which not.
You could include the wire frames in addition to the colored
facets or not.
- Going back to wire frames, construct a simple 3D object
at the origin, where it's simpler to do. Then build a simple
3D transform library of 4x4 matrices, starting with translation
only. Test your transform by printing values before you try to
apply it to the points defining a structure.
Use the transformation matrix to translate your object to a visible region of the screen
and draw its wire frame.
The transform is used to translate each point
once and redraw the structure that references the points.
- Now render your translated object as in step 3.
- Now build rotation transforms as well as product methods for transforms.
Test them for simple cases to be sure they're working
correctly by simply printing out values.
You might want to look at my HomogeneousXforms2D example to see
how I restricted the printout of real numbers to make them more
readable (less annoying).
- Now construct a composite transform TxR'xR' which first rotates
one of your objects around the origin in two different axes
and then translates it to a visible area.
Then draw the wire frame.
- At this point you can render each face in a solid color,
but problems arise with back faces. You could manually choose
which ones to display, but if possible, you should attempt to evaluate
the normal to each rotated face and don't display the ones facing away.
- Extra credit (10%): A z-buffer is not that difficult to build and use.
So you can try using one for extra credit.
The barycentric coordinates allow us to compute the z value of
any point in the plane of the triangle.
This will assure that your system only ends up rendering visible surfaces.
Go to CSG140 home page.
or RPF's Teaching Gateway or
homepage