close

xna4.0,ps2.0,PC平台使用hlsl定義結構體:
struct VS_INPUT
{
float4 Position : POSITION0;
float2 TexCoord : TEXCOORD0;
float3 Normal : NORMAL0;
float3 Tangent : TANGENT0;
float4 BoneIndices : BLENDINDICES0;
float4 BoneWeights : BLENDWEIGHT0;
}
載入一個簡單的貼圖mesh,調用Bump相關pass時,運行時在
mesh.Draw();
處跳出異常:
The current vertex declaration does not include all the elements required by the current vertex shader. Tangent0 is missing.

問題就在於這個切線數據 Tangent 丟失。
外事不決問google,找到答案。
到Content項目中將默認為false的“Generate Tangent Frames”項目置為true,編譯後約多出10%容量,問題解決。
貌似3.1時默認是開啟的,可能因為大多數model不用到切線數據,所以4.0不再默認生成。

arrow
arrow
    全站熱搜

    createps 發表在 痞客邦 留言(0) 人氣()