List Embedded Textures

Anonymous

List Embedded Textures

Anonymous
Not applicable

We are trying to extract a list of embedded textures as efficiently as possible from FBX files using the C++ SDK.

 

So far we use the FbxImporter and set an EmbeddedFileReadCallback. This works fine but is about a factor of 10-100 too slow for our use.

 

Is there any other approach we should consider? We are not interested in Mesh/Animation/Camera/etc. information at all. We just want the names of the embedded textures/files.

 

We tried deactivating as much as possible using the FbxIOSettings. Basically everything in fbxiosettingspath.h with an IMP_FBX prefix except IMP_FBX_EXTRACT_EMBEDDED_DATA.

0 Likes
Reply
582 Views
3 Replies
Replies (3)

Anonymous
Not applicable

I have been able to shave off about 15% of time (for my test files) by doing the FBXImporter abstraction level myself.
This means creating an FbxReaderFbx5/6/7 (whichever is appropriate).

 

Now I want to go even one level down. The doc says it should be possible to use the FbxIO class directly:
https://help.autodesk.com/view/FBX/2020/ENU/?guid=FBX_Developer_Help_cpp_ref_class_fbx_i_o_html

 

Though I have tried it in several ways the above snippet doesn't seem to work for me. I have the following code:

 

    FbxStatus status;
    auto const importer = FbxImporter::Create(manager.get(), "");
    FbxReaderFbx7 reader(*manager, *importer, 0, status);
    bool opened = reader.FileOpen(&stream, nullptr);
    // Here opened is true
 
    FbxIOFileHeaderInfo headerInfo;
    auto io = FbxIO::Create(FbxIO::BinaryLarge, status);
    io->CacheSize(8);
    io->Fbx7Support(true);
    bool opened = io->ProjectOpen(&stream, nullptr, &reader, false, false, &headerInfo);
    // Here opened is false

 

The FbxReaderFbx7 approach works. But the FbxIO one does not - even though it does exactly the same calls with the same arguments. (This can be seen when debugging and stepping through the frames.)

 

What am I doing wrong? Or is this not supposed to work at all? What's going on?

 

I'm working with FBX SDK 2020.2 on Windows (but we're also using it on Linux).

0 Likes

Anonymous
Not applicable

Actually a little more debugging made me realize I needed FbxIO::BinaryNormal (instead of FbxIO::BinaryLarge) when creating the FbxIO.
This way it opens the project.

 

Let's see if I can get the performance I need.

0 Likes

Anonymous
Not applicable

Just for anyone reading this topic in the future:

* Reading Ascii FBX files is unfathomably slow. If you don't need to read those, abort early.
* Going down to the FbxIO abstraction level and traversing the file yourself is about a factor 5-10 faster than reading it using the FbxReader implementations.

* Using the FBX SDK with a filename instead of and FbxStream is about a factor 3-5 faster.

* We implemented an incomplete stream based FBX reader based on the information here: https://code.blender.org/2013/08/fbx-binary-file-format-specification/
Without much optimization of the code we managed to get to the speed of the FBX SDK with direct file access.

0 Likes