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

Fix GeometricTransform (fix #56) #58

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

hu-xd
Copy link
Contributor

@hu-xd hu-xd commented Apr 29, 2024

when Fbx node has GeometricTransform, use an additional Gltf node to hold the mesh and the transform. fix #56

* add Mesh to a child node to hold GeometricTransform

* Fix

* Fix typo

* Fix type

* Fix Typo

* Fix

* Fix

* Fix

* Fix

* Optimize

* Cleanup
src/fbx/Fbx2Raw.cpp Outdated Show resolved Hide resolved
src/gltf/Raw2Gltf.cpp Outdated Show resolved Hide resolved
src/gltf/Raw2Gltf.cpp Outdated Show resolved Hide resolved
hu-xd and others added 3 commits April 30, 2024 01:41
Co-authored-by: K. S. Ernest (iFire) Lee <[email protected]>
Co-authored-by: K. S. Ernest (iFire) Lee <[email protected]>
@fire fire requested a review from lyuma April 30, 2024 15:24
@fire
Copy link
Member

fire commented Apr 30, 2024

@bqqbarbhg Could you take a look with some of your fbx test suite? You don't have to spend too much time.

@bqqbarbhg
Copy link

@bqqbarbhg Could you take a look with some of your fbx test suite? You don't have to spend too much time.

Unfortunately currently I don't really have much extra time to spend on non-critical ufbx stuff, as I have a lot going on simultaneously. Though, I can still give a few thoughts:

This seems to be quite similar to the ufbx helper nodes option, which was disabled by default as there was concerns about the node tree not matching up with the FBX file. So then to be consistent I think this should be an option, maybe not enabled by default. On the surface level this diff seems solid for basic cases, and does fix the problem of instanced geometry transforms, like the ufbx import option.

One key thing to pay attention to however is skinned meshes: the geometric transform is expected to be baked to the geometry when using the FBX bind matrices, so you'll need to include that into those manually if transforming it under a child, depending on how the whole glTF pipeline and Godot do things. In general I really recommend testing with skinned meshes that use geometric transforms.


About the dataset testing, if you want to replicate the testing setup I have for Godot ufbx, you can get started with the hacked editor I have, diff here: https://github.com/bqqbarbhg/godot/compare/7abe0c60140..5ce120bdd79 (you can ignore the changes to fbx_document.cpp and ufbx.c/h here).

Using this requires an empty project to load the files in and some way to iterate test cases from the command line, I used my execute_per_fbx.py. Here's an example of what I used for testing:

python3 /path/to/execute_per_fbx.py \
  --verbose --allow-fail \ # Just some options for execute_per_fbx.py: verbose and keep going if Godot crashes
  --exe /path/to/godot/godot.windows.editor.x86_64.exe \ # Godot editor built with '--import-fbx' hack
  -p ufbx -p gltf \ # This will execute every command twice for each FBX with #p="ufbx" and #p="gltf"
  --root /path/to/fbx-files \ # Directory with FBX files, searches recursively
  -- \ # Rest of the options are passed to the '--exe', Godot in this case
  -e --path /path/to/empty-godot-project \ # Usual Godot options
  --import-fbx "#p" /path/to/output "#" # Options to hacky loading, "#p" is ufbx/gltf, "#" is the FBX filename

The above command will start the editor for each FBX file contained in /path/to/fbx-files (and its subdirectories), and will dump loaded screenshots and logs to /path/to/output.

@bqqbarbhg
Copy link

Oh one thing to note about the --import-fbx option: It will delete almost everything in the project it's pointed at, so you want to be really careful not to use it when pointing the editor into a project that you care about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fbx GeometricTransformation support is problematic
3 participants