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

[Epic] Rejuvenate M3D model loading #5859

Open
3 of 5 tasks
tellypresence opened this issue Nov 2, 2024 · 5 comments
Open
3 of 5 tasks

[Epic] Rejuvenate M3D model loading #5859

tellypresence opened this issue Nov 2, 2024 · 5 comments
Labels
Bug Global flag to mark a deviation from expected behaviour

Comments

@tellypresence
Copy link
Contributor

tellypresence commented Nov 2, 2024

Goal: restore the ability for users to opt-in for M3D model support, and be able to load as many available sample models as possible.

@tellypresence tellypresence added the Bug Global flag to mark a deviation from expected behaviour label Nov 2, 2024
@tellypresence
Copy link
Contributor Author

@bztsrc I think I've taken this effort as far as I can. At this stage, if a couple of PRs get merged, users will be able to load all of your sample models except

  • the rigged/animated ones
  • the elephant

If you're able to spend a few hours some weekend to try to fix the problems with those models, can get to a state where users can load 100% of your sample models via assimp. Not sure whether you're still actively maintaining the M3D format, but if so please consider addressing these issues to expand your user base -- thank you

@bztsrc
Copy link
Contributor

bztsrc commented Nov 4, 2024 via email

@tellypresence
Copy link
Contributor Author

tellypresence commented Nov 5, 2024

@bztsrc Thank you for your response.

I wanted to check whether the code did in fact work at one point so went back in time to the commit where you introduced M3D to assimp:

Then built assimp and retried loading the sample models

Summary

  • most of the models cause catastrophic crash on load, including the "elephant" model
  • two (non-textured) rigged/animated models worked at that point

Details

Most sample models cause catastrophic crash on load, including (but not limited to) anything with textures. 2 rigged/animated models were able to load and appear to animate OK, though the "swat" model seems to have insane bone count, and the bone check indicates an incorrect number of meshes, so possibly there was a problem with converting from M3D to assimp skeleton in the code at that commit.

The "elephant" model is among the ones that crash, so based on this test it appears that the elephant never worked.

Screenshots

Models that load OK

4 Nov 2019 assimp commit 308db73
ModelScreenshotNotes
teapot.m3dteapot_m3d
madmax.m3dmadmax_m3d
r2d2.m3dr2d2_m3d
swat.m3dswat_m3dModel has 4 meshes
Model has 24 animations
Model indicates it has 47,120 bones in 760 meshes (despite only having 4 meshes)
(Because of massive bone count, implementation can't keep up and model appears fragmented)
aliveai_character.m3daliveai_character_m3dModel has 1 mesh
Model has 1 animation
Model indicates it has 6 bones in 1 mesh (seems reasonable)

Models that crash on load

All these models caused catastrophic crash on import attempt:

4 Nov 2019 assimp commit 308db73
Models with catastrophic crash-on-loadNotes
bat.m3dRigged/animated model
lara.m3dRigged/animated model
seagull.m3dRigged/animated model
dragon_vrip_res3.m3d
Elephant
atat.m3d
batmobile.m3d
cessna.m3d
fishboat.m3d
castle.m3d
medieval.m3d
bender.m3d
gandalf.m3d
wolfzoid.m3d
yoda.m3d
awing.m3d
birdofprey.m3d
viper.m3d
enterprise.m3d
mfalcon.m3d
alkesh.m3d
tie.m3d
vaderstie.m3d
xwing.m3d

Do you recall if you had made fixes to address the crashing and weird bone problems? If so please let me know the specific git commit, and I can try again -- would be great to establish if there was a commit where things were working so we can figure out where things broke. Thank you

@tellypresence
Copy link
Contributor Author

tellypresence commented Nov 5, 2024

Never mind, I may have found it -- looks like there were indeed fixes made; AFAICT the final PR for M3D was

Built assimp at this commit and retried loading the sample models

Summary

  • most of the models load OK at this commit
  • "elephant" and "CesiumMan" models failed to load; seems clear these models never worked in assimp at all
  • Most of the rigged/animated models load and animate, but bat/seagull have animation artifacts and "swat" has insane bones

Details

Textured models were mostly working at this commit. Rigged/animated models were able to load, but while "Lara" appeared to animate correctly and have reasonable bone count, "bat" and "seagull" had severe animation artifacts, and "swat" still has insane bone count.

The "elephant" and "CesiumMan" models fail to load; it is clear these models never worked in assimp at all.

Screenshots

Models that load OK

With the exceptions of "elephant" and "CesiumMan" most models load OK (so not all are shown here for brevity)

12 Feb 2020 assimp commit 58b9dcb
ModelScreenshotNotes
aliveai_character.m3daliveai_character_m3d1 mesh
6 bones
1 animation
Looks correct
bat.m3dbat_m3dObvious animation artifacts
lara.m3dlara_m3dModel has 1 mesh
Model has 313 animations
Model indicates it has 15 bones in 1 mesh (seems correct)
mobs_dwarves_character.m3dmobs_dwarves_character_m3d1 mesh
6 bones
1 animation
Looks correct
seagull.m3dseagull_m3dObvious animation artifacts
swat.m3dswat_m3dModel has 4 meshes
Model has 24 animations
Model indicates it has 47,120 bones in 760 meshes (despite only having 4 meshes)
(Because of massive bone count, implementation can't keep up and model appears fragmented)
batmobile.m3dbatmobile_m3d
tie.m3dtie_m3d

Models that fail to load

Forced to conclude these models never worked at all with assimp

12 Feb 2020 assimp commit 58b9dcb
Models failing to loadNotes
ElephantValidation failed: aiTexture::pcData is NULL
CesiumMan.m3dValidation failed: aiTexture::pcData is NULL

@bztsrc So you were correct that most of the models loaded at one point, except that "elephant" and "CesiumMan" models clearly never worked in assimp, so there's no working state to be restored.
Also, as of the final M3D PR, there were obvious problems with skeletal animations; doesn't seem worth the effort to restore broken animations so will leave things here (unless I missed a commit fixing the situation, in which case please let me know)

@tellypresence
Copy link
Contributor Author

Feedback from the original author below, in case there's useful information for future reference in the event someone else wants to investigate

Thank you so much for your efforts!

assimp. Not sure whether you're still actively maintaining the M3D format,

Well, I'm actively maintaining the M3D code base, but the M3D format and the in-memory structure that the SDK uses hasn't changed from the very beginning, it is as stable as it can be. Nothing has changed on the M3D side as long as Assimp concerned.

but if so please consider addressing these issues to expand your user base -- thank you

I'm sorry, but I'm the M3D developer and not an Assimp developer. As I've said, the M3D SDK's API and in-memory format hasn't changed, and it used to work in Assimp but if not any more then the problem is on the Assimp side for sure, and I'm not willing to spend time with that because the Assimp devs were total j**ks (except kimkulling, he was always nice and professional).

I wrote a detailed description https://gitlab.com/bztsrc/model3d/-/tree/master/assimp#model-with-skeletons on how the M3D in-memory structure should be mapped to Assimp in-memory nodes, also here is my Assimp wrapper https://gitlab.com/bztsrc/model3d/-/blob/master/assimp/code/M3D/M3DImporter.cpp code (with lots of comments and explanations) that used to work with rigged models and with the elephant too.

I'm afraid that's all the help I can provide for Assimp integration.

Cheers, bzt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Global flag to mark a deviation from expected behaviour
Projects
None yet
Development

No branches or pull requests

2 participants