Here is a workaround if your installation of RenderMonkey fails with "Fatal Error: Installation ended prematurely":

Open a command prompt, go to the directory where the RenderMonkey .msi file is located and type:

msiexec /qr /i RenderMonkey.2008-12-17-v1.82.322.msi

## Friday, October 18, 2013

## Thursday, October 10, 2013

### FBX SDK Tips

Here are some little tips based on my current experience with the FBX SDK (2014.1):

If you get linker errors (e.g. related to ClassId when using the GetSrcObject or FindMember functions) make sure you link to "libfbxsdk-md.lib" instead of "libfbxsdk.lib".

Regarding computation of node transformation matrices you need to realize that there are

Make sure you read the relevant section in the FBX SDK Programmer's Guide -> Nodes and the Scene Graph -> FBX Nodes -> "Computing Transformation Matrices" (http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/).

The first step is to get the local node transformation. There are several ways to do this:

Option 1:

FbxMatrix matTransform = pNode->GetScene()->GetEvaluator()->GetNodeLocalTransform(pNode);

Option 2:

FbxVector4 translation = pNode->EvaluateLocalTranslation();

FbxVector4 rotation = pNode->EvaluateLocalRotation();

FbxVector4 scale = pNode->EvaluateLocalScaling();

FbxMatrix matTransform( translation, rotation, scale );

Option 3:

FbxVector4 translation = pNode->LclTranslation.Get();

FbxVector4 rotation = pNode->LclRotation.Get();

FbxVector4 scale = pNode->LclScaling.Get();

FbxMatrix matTransform( translation, rotation, scale );

The next step is to get the geometric transform (assuming 3dsmax is used):

FbxVector4 T = pNode->GetGeometricTranslation (FbxNode::eSourcePivot);

FbxVector4 R = pNode->GetGeometricRotation(FbxNode::eSourcePivot);

FbxVector4 S = pNode->GetGeometricScaling(FbxNode::eSourcePivot);

FbxMatrix matGeometricOffset(T, R, S);

Then we apply the mentioned formula for 3dsmax:

FbxMatrix nodeMatrix = parentMatrix * matTransform;

FbxMatrix worldMatrix = nodeMatrix * matGeometricOffset;

The resulting matrix should then be converted to the conventions of the 3D API you are using (GL/D3D/etc.)

The FBX SDK in many cases provides several different ways to retrieve the same information, which can be a bit confusing at times.

To iterate over all AnimStacks in the scene you can use

for(int i=0; i < m_pImporter->GetAnimStackCount(); i++)

{

FbxAnimStack* pAnimStack = m_pScene->GetSrcObject(i);

// ...

}

Or alternatively:

for(int i=0; i < m_pImporter->GetAnimStackCount(); i++)

{

FbxTakeInfo* takeInfo = m_pImporter->GetTakeInfo(i);

FbxString takeName = takeInfo->mName;

FbxAnimStack* pAnimStack = m_pScene->FindMember((const char*)takeName);

// ...

}

But as said, there are even more ways of doing the same thing...

**Linker problems**If you get linker errors (e.g. related to ClassId when using the GetSrcObject or FindMember functions) make sure you link to "libfbxsdk-md.lib" instead of "libfbxsdk.lib".

**Node Transformations**Regarding computation of node transformation matrices you need to realize that there are

__two__different formulas used depending on whether the current file is a Maya scene or comes from 3dsmax.Make sure you read the relevant section in the FBX SDK Programmer's Guide -> Nodes and the Scene Graph -> FBX Nodes -> "Computing Transformation Matrices" (http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/).

The first step is to get the local node transformation. There are several ways to do this:

Option 1:

FbxMatrix matTransform = pNode->GetScene()->GetEvaluator()->GetNodeLocalTransform(pNode);

Option 2:

FbxVector4 translation = pNode->EvaluateLocalTranslation();

FbxVector4 rotation = pNode->EvaluateLocalRotation();

FbxVector4 scale = pNode->EvaluateLocalScaling();

FbxMatrix matTransform( translation, rotation, scale );

Option 3:

FbxVector4 translation = pNode->LclTranslation.Get();

FbxVector4 rotation = pNode->LclRotation.Get();

FbxVector4 scale = pNode->LclScaling.Get();

FbxMatrix matTransform( translation, rotation, scale );

The next step is to get the geometric transform (assuming 3dsmax is used):

FbxVector4 T = pNode->GetGeometricTranslation (FbxNode::eSourcePivot);

FbxVector4 R = pNode->GetGeometricRotation(FbxNode::eSourcePivot);

FbxVector4 S = pNode->GetGeometricScaling(FbxNode::eSourcePivot);

FbxMatrix matGeometricOffset(T, R, S);

Then we apply the mentioned formula for 3dsmax:

FbxMatrix nodeMatrix = parentMatrix * matTransform;

FbxMatrix worldMatrix = nodeMatrix * matGeometricOffset;

The resulting matrix should then be converted to the conventions of the 3D API you are using (GL/D3D/etc.)

**Getting all AnimStacks of the current Scene**The FBX SDK in many cases provides several different ways to retrieve the same information, which can be a bit confusing at times.

To iterate over all AnimStacks in the scene you can use

for(int i=0; i < m_pImporter->GetAnimStackCount(); i++)

{

FbxAnimStack* pAnimStack = m_pScene->GetSrcObject

// ...

}

Or alternatively:

for(int i=0; i < m_pImporter->GetAnimStackCount(); i++)

{

FbxTakeInfo* takeInfo = m_pImporter->GetTakeInfo(i);

FbxString takeName = takeInfo->mName;

FbxAnimStack* pAnimStack = m_pScene->FindMember

// ...

}

But as said, there are even more ways of doing the same thing...

Subscribe to:
Posts (Atom)