FBX UV coordinates Problem

Started by
2 comments, last by isu diss 6 years, 7 months ago

I don't know whether this is correct or wrong. This is how I load the UVs.


UV = new XMFLOAT2[NumVertices];
for (int i = 0; i < Mesh->GetPolygonCount(); i++)//polygon(=mostly rectangle) count
{
	FbxLayerElementArrayTemplate<FbxVector2>* uvVertices = NULL;

	Mesh->GetTextureUV(&uvVertices);
	for (int j = 0; j < Mesh->GetPolygonSize(i); j++)//retrieves number of vertices in a polygon
	{
		FbxVector2 uv = uvVertices->GetAt(Mesh->GetTextureUVIndex(i, j));
		UV[3*i+j] = XMFLOAT2((float)uv.mData[0], (float)uv.mData[1]);
	}
}

How do I correct this? Below image was captured when I was trying to load a texture onto a plane.

 

Untitled.jpg

Advertisement

There are different ways UVs can be stored in a FBX file (per-vertex, per-index). Try checking your mesh and see if you're parsing it correctly.

You can checkout the DisplayMesh example[0] in the FBX SDK to see how to do that.

 

[0] - http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/cpp_ref/_import_scene_2_display_mesh_8cxx-example.html

How can I store UVs as per-vertex? I've found that all the model I load into have UVs as per-index.

This topic is closed to new replies.

Advertisement