Importing 3d models has non-deterministic behavior
Hi! I had a problem that the build for linux does not work (I'm not sure about all the models, but it fell on mine) with optimization -O0 (without optimizations), its failed here
the same problem with artefacts for mac and windows (they are also non deterministic with or without compiler optimizations such as -O1 -O2 -O3).
also the model can be either converted or not converted from launch to launch . I think it may be due to too serious compiler optimizations (mb some variables store trash values).
here channel.index can store negative value (in my case it was -1). So i hot-fixed it as shown below so that the converter would not fall with segmentation fault , but I'm sure it's the wrong solution.
Raw2gltf.cpp#L170
const RawChannel& channel = animation.channels[channelIx];
//new code
if(channel.nodeIndex < 0)
{
continue;
}
// end new code
const RawNode& node = raw.GetNode(channel.nodeIndex);
Maybe someone fixed it or have the same problem?
Can you provide a small case I can use to verify it's fixed.
I made a pr here https://github.com/V-Sekai/FBX2glTF/pull/15. Will need to test.
sorry for the late reply So, here is an example of a model (cat.zip) where the converter crashes. You can try to build converter tool without compiler optimizations (because on linux that problem does not always occur on release build). Without optimizations this problem always occurs.
ex. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 )
if (NOT MSVC)
# Disable annoying & spammy warning from FBX SDK header file
target_compile_options(libFBX2glTF PRIVATE
"-Wno-null-dereference"
"-Wunused"
"-O0"
)
target_compile_options(FBX2glTF PRIVATE
"-Wno-null-dereference"
"-Wunused"
"-O0"
)
endif()
here is converted model (so maybe this solution works correctly)

P.S. origin converter v0.9.7 convert this model correctly (https://github.com/facebookincubator/FBX2glTF/releases) . maybe this can help
I'll test turning off optimizations.
I'm not able to work on this for a short period of time.
I am looking into this.
There is some work here to check if the latest build still has this problem. For a future me or a different person.