Assignment 2

Goal:

The goal of this assignment is to familiarize you with the 3D head model.  We will also develop some tools that will be useful later and explore the illumination models from the Blanz/Vetter papers.

Data and support code

Everything you need is in /course/cs296-4/Heads/ and /course/cs296-4/Assign2/

Task 1 (20pts)

You will compute the visibility of all vertices.  Various code fragments are provided.  You need to fill them in.

load ../Heads/heads-male20
Pts=reshape(muD,4846,3);
Head = createHead(tri, Pts); %code provided
displayMesh(Head); % code provided

Look in createHead.m.  Your first job is to implement the following functions

tripts = pts2tris(Tri,Pts(:,1)',Pts(:,2)',Pts(:,3)');
tsn=trisurfnormals(Tri,Pts(:,1)',Pts(:,2)',Pts(:,3)');
ptnormals = trinormals2ptnormals(tsn,tripts);

Stubs for each of these are in the directory.  Given these compute

visible = headVisiblePoints(C, Head);

which returns a vector that is 1 for visible vertices and 0 otherwise.  See the stub for this.

Choose 3 light positions and compute the visibility for each.  Then render each head:

visible = headVisiblePoints(C, Head);
Head.color=zeros(size(Head.color));
Head.color(visible)=1;
displayMesh(Head);

Submit a pdf showing these from three camera views.

Task 2 (20pts)

Implement the Phong shading model (eq 6 from Blanz and Vetter).  Choose three sets of parameters for the free parameters (background illumination, directional light intensity, specular dispersion, and camera position).  Render each head from Task 1 with one of the parameter settings.  Submit a pdf showing each head from 3 views.

You can do this for grayscale only but if you get ambitious you might as well do it for color since we will need to anyway.  It is better to make the code general enough to do the color case.

Extra Credit (priceless)

If you can figure out a better/faster way of testing visibility (eg OpenGL z-buffer), you will have the unwavering respect and admiration of the entire class.