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.)"

0 comments: