It seems that my tangents and binormals are wrong from what i understand. The vertex part of the light seems to work (ie the triangle is shaded correctly when moved through the lights) but the bumps arn’t shading correctly. They seem almost static. Bumps show but the lighting doesn’t seem to be updating itself on the bumps. If you could see if there is a problem with the way i generate my tangents and binormals that would help me out alot.
void md2::calcTB(int frame){
for(int verts = 0; verts < theHeader->iNumVerts;verts++){
vector a,b,c;
vector temp3,temp4;
vector temp1,temp2;
float deltaA,deltaB;
for(int k = 0; k < lShared[verts].num;k++){a.setStruct(theFrames[frame].verts[theTriangles[lShared[verts].index[k]].usVertIndices[0]].vert); b.setStruct(theFrames[frame].verts[theTriangles[lShared[verts].index[k]].usVertIndices[1]].vert); c.setStruct(theFrames[frame].verts[theTriangles[lShared[verts].index[k]].usVertIndices[2]].vert); temp1 = b - a; temp2 = c - a; deltaA = (theTexCoords[theTriangles[lShared[verts].index[k]].usTexIndices[1]].coord[0] - theTexCoords[theTriangles[lShared[verts].index[k]].usTexIndices[0]].coord[0]); deltaB = (theTexCoords[theTriangles[lShared[verts].index[k]].usTexIndices[2]].coord[0] - theTexCoords[theTriangles[lShared[verts].index[k]].usTexIndices[0]].coord[0]); } tangents[verts].setX((deltaA * temp1.getX())-(deltaB * temp2.getX())); tangents[verts].setY((deltaA * temp1.getY())-(deltaB * temp2.getY())); tangents[verts].setZ((deltaA * temp1.getZ())-(deltaB * temp2.getZ())); binormals[verts] = tangents[verts].cross(normals[verts]);
}
}
Im using a md2 for the model. Thanks!
[This message has been edited by dorbie (edited 01-22-2004).]