-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FBX][UV] Problem exporting multiple UVs (>2) #67
Comments
Your issue is probably also related to this one Perfare#1047 From what I tested earlier, the problem seems to be in UVs of the same type. You would need to add something like this to AS_API(void) AsFbxMeshCreateDisplacementUV(FbxMesh* pMesh, int32_t uv)
{
if (pMesh == nullptr)
{
return;
}
auto pUV = pMesh->CreateElementUV(FbxString("UV") + FbxString(uv), FbxLayerElement::eTextureDisplacement);
pUV->SetMappingMode(FbxGeometryElement::eByControlPoint);
pUV->SetReferenceMode(FbxGeometryElement::eDirect);
} to AS_API(void) AsFbxMeshCreateDisplacementUV(fbxsdk::FbxMesh* pMesh, int32_t uv); to [DllImport(FbxDll.DllName, CallingConvention = CallingConvention.Winapi)]
private static extern void AsFbxMeshCreateDisplacementUV(IntPtr mesh, int uv); And then replace this part AssetStudio/AssetStudioFBXWrapper/FbxExporterContext.cs Lines 256 to 268 in f7e6d23
with something like this for (var i = 0; i < importedMesh.hasUV.Length; i++)
{
if (!importedMesh.hasUV[i]) { continue; }
switch (i)
{
case 1 when !exportAllUvsAsDiffuseMaps:
AsFbxMeshCreateNormalMapUV(mesh, i);
break;
case 2 when !exportAllUvsAsDiffuseMaps:
AsFbxMeshCreateDisplacementUV(mesh, i);
break;
default:
AsFbxMeshCreateDiffuseUV(mesh, i);
break;
}
} Still not sure how correct this workaround is, but it may solve some issues with multiple UVs 👀 |
Honestly I have no idea how "Diffuse" and "Normal Map" UVs are different, but I can confirm that using different type, as you suggested, works as expected and UV2 is correctly exported. |
I've ran into a problem with exporting more than two UV channels.
If any object has three or more UV channels, the exported object has no UVs at all.
Forcefully setting hasUV[n] to false for n >= 2 on all ImportedMesh resolves the problem. (only correctly exports first 2 channels)
Simple reproductive example:
If the UV[2] parts are commented out, it works - UV1 is successfully copy of UV0 (if UV1 not exist)
Does anyone know how to fix it?
The text was updated successfully, but these errors were encountered: