Research: import FBX with ufbx instead of Assimp

Aperta
#3,825 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Start by reading the related discussion in #3533 and inspect MeshConverter's Assimp processing steps. Build a spike that imports FBX files from Stride's repository, samples, and a few real projects through ufbx, then compare bones, animations, materials, vertex counts, and import time with Assimp. Done means the comparison supports a documented decision to use ufbx, potentially opt-in, or keep Assimp and fix remaining issues upstream.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area-Animation area-Asset enhancement

Summary

Research whether FBX files should be imported with ufbx instead of Assimp. Other formats would stay on Assimp.

This is still a research topic: the switch only happens if the research shows it is worth it.

Why

Recent work on RescueDrone and on Assimp's FBX importer found several Assimp faults that are specific to FBX (bone offsets fixed in assimp/assimp#7038 and assimp/assimp#7039, shipped by Stride in its own Assimp 6.0.5 build, #3824). Assimp's FBX importer has few tests that check the imported data, so such regressions are easy to miss: none of its tests checked a bone offset.

ufbx is a single-file C library (MIT or public domain) with an extensive test suite of real FBX files exported by Maya, 3ds Max, Blender, MotionBuilder and others, each checked against the tool's own export. Both Godot (since 4.3) and Blender (since 4.5) import FBX with it.

It would also solve other Assimp issues:

  • Animation curves: Assimp keeps only the keys and interpolates linearly between them, so cubic curves are lost (a 3ds Max test file is off by 11.5 units mid-animation). ufbx evaluates curves with their real interpolation, and can bake them.
  • Scale inheritance modes (Maya, MotionBuilder): Assimp ignores them, so bones under a non-uniform parent scale end up wrong. ufbx handles them.
  • Old FBX files: Assimp refuses files older than FBX 7.1. ufbx reads ASCII and binary files from FBX 3.0.
  • Blend shapes: ufbx supports in-between shapes. Assimp had a regression that scrambled blend shape order, only fixed in 6.0.5.
  • Bone offsets: ufbx uses the same formula as the FBX SDK. Assimp's changed in 2023 with no test catching it.
  • Pivots and geometric transforms: handled the same way as Maya and 3ds Max evaluate them.

Costs and open questions

  • Bindings: ufbx has no C# bindings that Stride could use as is. Options: bind its structs directly, or a small C layer that gives MeshConverter flat arrays (vertices, indices, bones, node transforms, animation keys).
  • Native builds: one more native library to build for each platform, like Stride's own Assimp build.
  • Processing steps: MeshConverter relies on Assimp's steps (vertex join, tangents, normals, bone weight limit). ufbx only has helpers (triangulation, index generation, normals), so the rest would need another source.
  • Existing projects: a different importer can give different node names, hierarchy, mesh splits and material slot names. Godot hit this and kept the old importer for files already imported. Stride would need a safe path for existing assets, likely opt-in at first.
  • Speed: likely faster, not measured against Assimp.

Research plan

  1. A spike that imports the FBX files of Stride's repository and samples, and a few real projects, through ufbx.
  2. Compare with the current Assimp import: bones, animations, materials, vertex counts, import time.
  3. Decide from the numbers: ufbx for FBX (maybe opt-in at first), or stay on Assimp and fix the remaining issues upstream.

Related

  • #3533 (comment): the discussion this comes from.
  • #1923: an earlier mention of moving the FBX importer to ufbx.
  • assimp/assimp#7038, assimp/assimp#7039: the Assimp fixes; #3824 ships them in Stride.

This issue was drafted by CodeAlta, an AI coding agent.

Lingua principale
C#
Stelle
8k
Fork
1.2k
Merge medio
2g 7h
PR unite (30g)
316

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stride3d/stride

Tutte le issue di stride3d/stride

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.