Cycles transform from fbx node


I am trying to build cycles scene from fbx file using fbx sdk.
This is how I am calculating the Cycles transform from a FbxNode.

The meshes are not positioned properly they are displayed as if they are thrown a part in different directions.

Any idea what I am doing wrong?
Can someone help me?

Thanks in advance.

FbxAMatrix& fbx_transform = CalculateGlobalTransform(fbx_node);
Transform& cycles_transform = fbx_matrix_to_cycles_transform(&fbx_transform );

FbxAMatrix CalculateGlobalTransform(FbxNode *pNode)
  FbxAMatrix &lGlobalTransform = pNode->EvaluateGlobalTransform();
  return lGlobalTransform;
Transform fbx_matrix_to_cycles_transform(const FbxAMatrix &matrix)
  FbxVector4 &translation = matrix.GetT();
  FbxVector4 &rotation = matrix.GetR();
  FbxVector4 &scale = matrix.GetS();
  Transform &transform = transform_euler(make_float3(rotation.mData[0], rotation.mData[1], rotation.mData[2]));

  transform.x.x = scale.mData[0];
  transform.x.w = translation.mData[0];

  transform.y.y = scale.mData[1];
  transform.y.w = translation.mData[1];

  transform.z.z = scale.mData[2];
  transform.z.w = translation.mData[2];

  return transform;

You’re overwriting the rotation with the scale. It’s easier not to decompose that matrix into translation/rotation/scale at all, just copy the first 3 rows of the FBX matrix to the Cycles transform.

1 Like

Thank you @brecht for your quick and continuous support

Hi @brecht,
Instead of copying rows, if I copy columns, it works fine. But the only problem is it is mirrored.
Here is my code. Can you please help me in fixing this?

Thanks in advance.

Transform fbx_matrix_to_cycles_transform(const FbxAMatrix &matrix)
  Transform transform;
  transform.x.x = matrix.Get(0, 0);
  transform.x.y = matrix.Get(1, 0);
  transform.x.z = matrix.Get(2, 0);
  transform.x.w = matrix.Get(3, 0);

  transform.y.x = matrix.Get(0, 1);
  transform.y.y = matrix.Get(1, 1);
  transform.y.z = matrix.Get(2, 1);
  transform.y.w = matrix.Get(3, 1);

  transform.z.x = matrix.Get(0, 2);
  transform.z.y = matrix.Get(1, 2);
  transform.z.z = matrix.Get(2, 2);
  transform.z.w = matrix.Get(3, 2);

  return transform;


With Cycles: