Monday, April 21, 2008

Finally heard back from the author with explanations on 3-way blending:

"I rendered a triangle mesh face-by-face (as usual in OpenGL, but DirectX normally requires a different approach) and I set three min-curvature directions (because each face has 3 vertices) for all vertices for each face. Here I attach some part of my source code:

glBegin(GL_TRIANGLES);

// set curvature values as texture coordinates.
glMultiTexCoord3fv(GL_TEXTURE0, face.getVertex(0).getTexCoord
(0).v); // min-curvature directions
glMultiTexCoord3fv(GL_TEXTURE1, face.getVertex(1).getTexCoord(0).v);
glMultiTexCoord3fv(GL_TEXTURE2, face.getVertex(2).getTexCoord(0).v);

glMultiTexCoord3fv(GL_TEXTURE3, face.getVertex(0).getTexCoord(1).v); // max-curvature directions
glMultiTexCoord3fv(GL_TEXTURE4, face.getVertex(1).getTexCoord(1).v);
glMultiTexCoord3fv(GL_TEXTURE5, face.getVertex(2).getTexCoord(1).v);

for(int k = 0; k < 3; k++)
glVertex3fv(face.getVertex(k).getPosition().v);

...

glEnd();

In this code, face.getVertex(i) retrieves the vertex index of the face and getTexCoord(j) retrieves the texture coordinate of the vertex. And I used multi-texturing to set three min-curvature directions for each face.
Therefore, all vertices in a face have three texture coordinates whose values are min-curvature directions.
(Also have three max-curvature directions, total 6.)"

Wednesday, April 9, 2008

Tuesday, April 1, 2008

Current Progress and Problems

Progress :

We finished the whole program set-up and figured out how to do multi-pass on GPU using CG. We based our project on the third assignment, modify the program structure to incorporate the following functionalities.

1. Half-edge Mesh data structure : load obj model, compute vertex normal, compute principle curvature direction, display normal and principle curvature direction for debugging. (Cynthia)
2. Created Small set of pencil textures, prepared to do texture mapping (Connie)
3. Incorporated image loader to load pencil/paper textures into the program and passed them to GPU (Cynthia)
4. Implemented sign function distortion method currently distort the whole texture for the screen which will be used for contour shaking(Connie)

Problem:

1. Do not quite understand the principle direction concept. Not sure whether it is computed correctly.
2. Unsure about how to do 3-way blending of pencil texture to the interior. Confused about the wording on the paper.
To be specific, in the pixel shader they propose to use three different angles to rotate pencil textures and then blend them together, but how can we get the three angles? If you consider passing the computed angle from vertex shader, the problem is at a single instance in time, the vertex shader is only computing one angle for a single vertex, when it passes the angle to the pixel shader, the pixel shader will only get one angle value (either interpolated or not interpolated, not sure)

plan for the near future:

Continue to figure out the 3-way blending. Start to implement run-time processes:

1. generate normal and depth map
2. contour detection using the normal and depth map
3. contour shaking / multiple line drawing