Hello All!
Came by here today hoping somebody has some experience loading models into DX11 using the FBX SDK. I am
having a weird problem when I load in my texture coordinates. On some models, they render correctly while on others, they render with the "U" flipped. An example below:
The space ship is rendered correctly, while the planet texture is flipped. Both are using the same code to load them in, the only difference is that I am sending in different strings for where to fetch the file from.
I load in the vertices from FBX in the following manner:
int counter = 0;
//Loop through the polygons
for (int p = 0; p < fbxMesh->GetPolygonCount(); p++)
{
//Loop through the three vertices within each polygon
for(int v = 0; v < fbxMesh->GetPolygonSize(p); v++)
{
const int controlPointIndex = fbxMesh->GetPolygonVertex(p, v);
VertexStruct vS;
vS.position = FBXD3DVector3(fbxMesh->GetControlPointAt(controlPointIndex));
FbxVector2 tex;
bool isMapped;
fbxMesh->GetPolygonVertexUV(p, v, lUVSetName, tex, isMapped);
vS.uv = D3DXVECTOR2(tex[0], -tex[1]);
FbxVector4 norm;
fbxMesh->GetPolygonVertexNormal(p, v, norm);
vS.normal = D3DXVECTOR3(-norm[0], -norm[1], -norm[2]);
m_Vertices.push_back(vS);
m_Indices.push_back(static_cast<unsigned int>(counter));
counter++;
}
}
Tried looking on the FBX forums but had no luck. I could hard code them individually but I was looking to create a system where all my resources are loaded. Any help would be greatly appreciated. Thanks!