Project 3

CSE 167: Computer Graphics

 

Project 3: Make a program that tessellates and renders a smooth cubic Bezier surface. It should start with the 16 control points of the surface and output a ‘Model’ class, making use of shared vertices. Use the 16 points provided below as an example, but you can also add more surfaces of your own as well. It must also compute correct, unit length normals, and use simple lighting. The code should be structured in an object oriented fashion.

Grading

Project 3 is due at or before 6:00 pm, November 9, 2006

Project 3 is worth 10 points. The breakdown is as follows:

 

2: Evaluate points on the surface

2: Properly generate single-indexed model with shared verts

2: Compute correct normals & use some lighting

2: Good object oriented style with classes for key components

1: Be able to switch between shaded and wireframe view modes

1: Be able to toggle on/off rendering of the control mesh as a grid of lines

 

Extra credit:

1: Load & render the teapot model (at the bottom of this page)

Object Oriented Approach

Project 3 must have some object oriented structure and have classes for major components. It should re-use the Model class from previous projects, but in this project it is required to use single indexing to enable vertices to be shared.

 

You don’t have to do it exactly like this, but I would suggest something like:

 

//// Surface ////

 

class Surface {

            Vector3 Point[16];

public:

            Model *GenerateModel(int sres,int tres);

            void DrawControlMesh();

};

 

 

// NOTE: the Surface::GenerateModel() function takes an ‘sres’ and ‘tres’ (s- and t-resolution) and outputs a model containing (sres+1)*(tres+1) vertices and (2*sres*tres) triangles

 

// NOTE: Test your code with different values for sres & tres!

Sample Surface

Try these 16 control points. See slides 17 & 19 of lecture 13 for a description of the specific ordering in S & T.

 

-1.5,     -1.5,     1.0

-0.5,     -1.0,     0.0

0.5,      -1.5,     0.0

1.5,      -1.5,     -1.0

-1.0,     -0.5,     0.0

-0.5,     -0.5,     -5.0

0.5,      -0.5,     5.0

1.5,      -0.5,     0.0

-1.5,     0.5,      0.5

-0.5,     0.5,      0.5

0.5,      0.5,      0.5

1.0,      0.5,      0.5

-1.5,     1.5,      0.0

-0.5,     2.0,      0.0

0.5,      1.0,      0.0

1.5,      1.5,      0.0

Sample Object

For a more complex test, try loading this text file. It is a simple text file containing 28 Bezier patches. At the top of the file is an integer which is the number of patches. After that, the individual patches are listed, in groups of 16 control points.

 

teapot.bez