Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing 3d models has non-deterministic behavior #12

Open
DmLvkvch opened this issue Apr 19, 2022 · 7 comments
Open

Importing 3d models has non-deterministic behavior #12

DmLvkvch opened this issue Apr 19, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@DmLvkvch
Copy link

DmLvkvch commented Apr 19, 2022

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?

@fire
Copy link
Member

fire commented May 12, 2022

Can you provide a small case I can use to verify it's fixed.

@fire
Copy link
Member

fire commented May 23, 2022

I made a pr here https://github.com/V-Sekai/FBX2glTF/pull/15. Will need to test.

@DmLvkvch
Copy link
Author

DmLvkvch commented Jun 3, 2022

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.

my fork with edited cmake

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)
image

cat.zip

P.S.
origin converter v0.9.7 convert this model correctly (https://github.com/facebookincubator/FBX2glTF/releases) . maybe this can help

@fire
Copy link
Member

fire commented Jun 3, 2022

I'll test turning off optimizations.

@fire fire changed the title non-deterministic behavior Importing 3d models has non-deterministic behavior Jun 6, 2022
@fire
Copy link
Member

fire commented Jun 6, 2022

I'm not able to work on this for a short period of time.

@fire
Copy link
Member

fire commented Nov 12, 2022

I am looking into this.

@fire
Copy link
Member

fire commented Dec 18, 2022

There is some work here to check if the latest build still has this problem. For a future me or a different person.

@fire fire added the bug Something isn't working label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants