Animation Directx 11中的MD5 3D模型和动画。正常旋转以更新1.QNAN00中的模型结果

Animation Directx 11中的MD5 3D模型和动画。正常旋转以更新1.QNAN00中的模型结果,animation,3d,directx-11,xna-math-library,Animation,3d,Directx 11,Xna Math Library,我尝试将MD5ANIM和MD5Mesh文件中的3d动画和Doom格式的模型加载到DX 11延迟渲染器中。 一切正常,除了我必须用XNA Math更新动画的模型顶点位置和法线。 以下代码计算旋转法线的结果始终为-1.QNAN00,并且模型显示为完全黑色。 除此之外,位置计算工作正常,您可以看到动画正常运行,没有完全黑色的法线 // Add to vertices normal and ake weight bias into account tempVert.normal.x -= ro

我尝试将MD5ANIM和MD5Mesh文件中的3d动画和Doom格式的模型加载到DX 11延迟渲染器中。 一切正常,除了我必须用XNA Math更新动画的模型顶点位置和法线。 以下代码计算旋转法线的结果始终为-1.QNAN00,并且模型显示为完全黑色。 除此之外,位置计算工作正常,您可以看到动画正常运行,没有完全黑色的法线

 // Add to vertices normal and ake weight bias into account
    tempVert.normal.x -= rotatedPoint.x * tempWeight.bias;
    tempVert.normal.y -= rotatedPoint.y * tempWeight.bias;
    tempVert.normal.z -= rotatedPoint.z * tempWeight.bias;
    //End
计算开始时的数值为:

float tempWeight.bias=1.0000000

XMFLOAT3旋转点x=-0.022973990 y=-0.053293169 z=-0.10924719

XMFLOAT3 tempVert.normal=x=0.00000000 y=0.00000000 z=0.00000000

我必须提到,我计算for循环中的值。 循环后,我存储如下值:

MD5Model.subsets[k].positions[i] = tempVert.pos;        // Store the vertices position in the position vector instead of straight into the vertex vector
MD5Model.subsets[k].vertices[i].normal = tempVert.normal;       // Store the vertices normal
XMStoreFloat3(&MD5Model.subsets[k].vertices[i].normal,XMVector3Normalize(XMLoadFloat3(&MD5Model.subsets[k].vertices[i].normal)));
Cheers Max

XMVector3Normalize将返回一个浮点特殊值,如果将其法线设置为0,0,0

要计算法线,您需要将每个元素a 0除以其长度a 0。结果是“除以零”失败