cybereality
var normal = new Vector3[realVertexNum];
var tangent = new double[realVertexNum * 4];
for (int i = 0; i < realVertexNum; i++)
{
int q = i / 10;
int m = i % 10;
Vector3 curNormal = (OriginVertexs[q + 1] - OriginVertexs[q]).Normalized();
Vector3 curTangent = (OriginVertexs[q + 1] - OriginVertexs[q]).Normalized();
normal[i] = curNormal;
tangent[i * 4] = curTangent.x;
tangent[i * 4 + 1] = curTangent.y;
tangent[i * 4 + 2] = curTangent.z;
tangent[i * 4 + 3] = 1.0;
}
I am using TANGENT in the vertex shader. The above code is the code where I set the NORMAL and TANGENT of each vertex. I think there should be no problem because the obtained NORMAL value is correct. In theory, TANGENT should be the same value as NORMAL, but it is not.