1

I am trying to understand the best approach to converting an 3D object defined by a series of vector coordinates into a .fbx file in within a c++ language environment.

Lets use a simple example: say I have a simple wire-frame cube which exists as a series of 12 vectors (a cube has 12 vertices) which consist of a start and end 3D x, y, z co-ordinate e.g

int vec1[2][3] = {
    {0, 0, 0},
    {1, 0, 0}};

This is in a sense a mesh object although it is not in any standard .MESH file form.

My question is how best would I go about writing a code to convert this into the correct structure to be saved as an .fbx file.

Additionally I have found online much information regarding:

  • fbx parsers
  • fbx writers
  • fbx sdk

However I do not believe these are exactly what I am looking for (please correct me if I am wrong). In my case, I would like in a sense to generate an .fbx file from scratch with no prior file type to begin with or convert from.

Any information on this topic such as a direct solution or even just the correct terminology that I can then use to direct my own more specific research, would be much appreciated. Kind Regards, Ichi.

Ikiro
  • 35
  • 4
  • 1
    Autodesk offers the FBX SDK as a C++ library. You can use [this class](https://help.autodesk.com/cloudhelp/2018/ENU/FBX-Developer-Help/cpp_ref/class_fbx_mesh.html) to create a `FbxMesh` from your vertex lists. Then add this `FbxMesh` to a Scene and write that to a file. – eike Apr 15 '21 at 15:54
  • 1
    usual way to implement any fileformat is to read the [its (FBX) file format specification](https://docs.fileformat.com/3d/fbx/) and mimic that in your code. So copy paste all used structures into C++ structs. Then feed them data from your current mesh and save the structs to file in the correct order... the same structs can be reused for parsers too. So if you got parser code already you can grab its struct definitions to make your life easier. Also parser and save code is usually very similar for many formats mostly you just change the load to save (read/write) and the direction of data copy. – Spektre Apr 16 '21 at 07:46

0 Answers0