Vertex normal regression in version 2020.1?

Vertex normal regression in version 2020.1?

thomasmfields
Explorer Explorer
1,277 Views
4 Replies
Message 1 of 5

Vertex normal regression in version 2020.1?

thomasmfields
Explorer
Explorer

Hi there,

 

I believe FBX 2020.1 has a regression relating to vertex normals.

 

I have a FBX mesh (attached) that is now reporting vertex normals as 0,0,0. This works fine in FBX 2020.0 and my normal are not 0 in that build.

 

My code is as follows:

 

bool hasNormals = fbxMesh.GetElementNormalCount() > 0;

 

hasNormals is set to true, but then after doing:

 

FbxVector4 nrm;
bool gotNormal = fbxMesh->GetPolygonVertexNormal(i, j, nrm);

 

gotNormal is set to false and my nrm vector contains 0,0,0.

 

What is going on here? Has something changed in the SDK that means my FBX file is no longer valid or is it a bug?

 

Regards,
Tom

0 Likes
1,278 Views
4 Replies
Replies (4)
Message 2 of 5

regalir
Autodesk
Autodesk

The latest FBX SDK have more strict checks on the data imported. In this case, your files specifies that the normals are mapped by PolygonVertex and a Direct reference mode. But, while the mesh have 2728 vertices, the array of normals defines 2735 values. Since the FBX SDK cannot know which of 2735 normals are the valid ones, and to prevent possible vulnerability risks, it reports a mismatch error and clears the LayerElementNormal.

 

Most likely the original mesh data was not properly cleaned before being exported to FBX.

0 Likes
Message 3 of 5

thomasmfields
Explorer
Explorer

That's interesting. Thank you for looking into it. It seems kind of weird to me that an application can output a broken FBX.

 

Also, would it be possible to include these changes like these in the release notes? The more detailed the better, please.

 

Regards,
Tom

0 Likes
Message 4 of 5

regalir
Autodesk
Autodesk

One thing you can do is to disable the validation pass if you know that your file is "somewhat ok" 😉

You will need to change the value of IMP_RELAXED_FBX_CHECK in the IOSettings to true before you initialize the FBxImporter. For example, in the Common.cxx file (function: :LoadScene) of the samples:

 

    // Get the file version number generate by the FBX SDK.
    FbxManager::GetFileFormatVersion(lSDKMajor, lSDKMinor, lSDKRevision);

    // Create an importer.
    FbxImporter* lImporter = FbxImporter::Create(pManager,"");


if (pManager->GetIOSettings())
    pManager->GetIOSettings()->SetBoolProp(IMP_RELAXED_FBX_CHECK, true);

 

// Initialize the importer by providing a filename.
const bool lImportStatus = lImporter->Initialize(pFilename, -1, pManager->GetIOSettings());
lImporter->GetFileVersion(lFileMajor, lFileMinor, lFileRevision);

 

You cannot add it to the IOS_REF.SetBoolProperty section found later in the function because the Importer switch state while it is instanciated and changing the value of the property after, will have no effect.

0 Likes
Message 5 of 5

thomasmfields
Explorer
Explorer

Thanks for the information. Didn't know about that feature. Seems a bit risky.

0 Likes