Loading FBX model into DirectX application

2019-09-06 10:59发布

问题:

I am trying to render a 3d model from FBX file in my directx application, so I have loaded it using fbx sdk, but I found a big problem, probably caused by different coordinate system: DirectX use left handed, Fbx - right handed, so finally I got it rendered, but with two issues:

  • all parts of the model look mirrored by Z axis (or by X - its not clear)
  • position of the parts is incorrect after applying transformation matrix provided by FBX for each part;

So how what I can do with Vertex data and/or transformation matrix?

回答1:

You will need to save the model and transformation data in your application differently than they are stored in the file. In general, it sounds like what you need to do is:

  • Load the FBX
  • Apply the transformations to each part according to the FBX
  • Apply the transformation to invert the Z-axis on all of the vertices
  • Render/use the resulting model.

Applying the FBX transformations in the wrong coordinate systems will yield incorrect results.