godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.79k stars 20.13k forks source link

Skeleton doesn't deform mesh when imported as .blend, works fine with .glb #78636

Open sfreed141 opened 1 year ago

sfreed141 commented 1 year ago

Godot version

4.0.3-stable_win64

System information

Windows 11, Blender 3.3

Issue description

In a couple .blend files I've noticed the built-in .blend importer results in broken mesh deformation. The skeleton shows up correctly but the mesh itself doesn't deform properly.

The animations work as expected in Blender, and if I export the mesh as a .glb (with all default settings) then importing that works as expected as well. It's definitely possible there's something wrong in the .blend file, but I'd still consider it a bug that the default-exported .glb behaves differently (at least my impression was that these two methods should behave identically).

Imported directly from .blend (skeleton doesn't deform mesh): image image (the bones only deforming some of the mesh objects in this wizard scene hints that maybe there's some trick to getting this to work. I tried messing with reparenting bones, checking weight paintings, and some other misc things but I couldn't figure it out :/)

Imported from .glb (skeleton deforms mesh): image image

(both models are from https://quaternius.com/, good stuff!)

Steps to reproduce

Open attached project and open the trex_*.tscn or wizard_*.tscn. Select the AnimationPlayer and see how the deformation works with the *_glb scenes but not the *_blend scenes. I included the .blend and .glb files as well.

Minimal reproduction project

import-issue.zip

bitsawer commented 1 year ago

Animations seem to work on current 4.1 master branch (68193bee9a1f77427a13b92508d611b1e2110217) on all four test scenes, so I guess something has been fixed at some point. However, there seems to be some geometry processing issue with the trex_blend.tscn. Looks like it might be LOD related, disabling or adjusting the LOD bias hides the issue. Or maybe the LOD just generates bad versions from a geometry that was wrong to begin with. There are some LOD generation bugs: https://github.com/godotengine/godot/issues/57416

.blend imports with strange geometry streching in the highlighted area:

a

LOD blowing up when adjusting the camera angle slightly:

b

philipp-gaddi commented 1 year ago

i got the same result as bitsawer, but the animations are working and deforming the mesh. i couldn't reproduce the error as sfreed141. image setting in the importer tab skins to 4 influences (compatible). seems to solve this. so what is this option changing compared to all influences.

sfreed141 commented 1 year ago

I can confirm @philipp-gaddi's suggestion to set Meshes > Skins to 4 Influences in the Import tab appears to solve the problem. Thanks!

I'd love to know what that 4 Influences does as well, since there's no in-editor tooltip and the official docs only describe non-.blend import settings (Importing Scenes docs). It'd be great to add docs for all the Import properties under the Blender group

And @bitsawer that's interesting, I just tried on 4.1-beta3 and I see the same behavior as 4.0.3 (no deforms). However the same trick of setting Meshes > Skins to 4 Influences appears to work. I don't see any of the strange geometry issues you noticed on 4.1-beta3 either (LOD related or otherwise).

edit: Just tried on latest master (030c1a950e) and I have the same behavior as 4.0.3 and 4.1-beta3. No strange geometry issues, have to set Meshes > Skins to 4 Influences to get deforms working properly. In case it matters my repro steps were

  1. close project
  2. delete the *.import files
  3. open project
  4. create new inherited scene (the pre-made inherited scenes exhibited the same behavior, but I remember when this used to be bugged and the inherited parts wouldn't update. Glad to see that part is fixed now!)
fire commented 1 year ago

Godot Engine supports 8 influences.

  1. Blender export only supports 4 or all (infinity).

Not sure the best approach. I discussed with @julienduroure a few times over the years about this.

See also Vertex bone influence limits for 3D tools

julienduroure commented 1 year ago

A better option tuning is in todo list and should land in Blender 4.0 or 4.1

dsyze commented 11 months ago

I can confirm @philipp-gaddi's suggestion to set Meshes > Skins to 4 Influences in the Import tab appears to solve the problem. Thanks!

I'd love to know what that 4 Influences does as well, since there's no in-editor tooltip and the official docs only describe non-.blend import settings (Importing Scenes docs). It'd be great to add docs for all the Import properties under the Blender group

And @bitsawer that's interesting, I just tried on 4.1-beta3 and I see the same behavior as 4.0.3 (no deforms). However the same trick of setting Meshes > Skins to 4 Influences appears to work. I don't see any of the strange geometry issues you noticed on 4.1-beta3 either (LOD related or otherwise).

edit: Just tried on latest master (030c1a9) and I have the same behavior as 4.0.3 and 4.1-beta3. No strange geometry issues, have to set Meshes > Skins to 4 Influences to get deforms working properly. In case it matters my repro steps were

  1. close project
  2. delete the *.import files
  3. open project
  4. create new inherited scene (the pre-made inherited scenes exhibited the same behavior, but I remember when this used to be bugged and the inherited parts wouldn't update. Glad to see that part is fixed now!)

Thank you so much! That really worked!

fire commented 11 months ago

https://github.com/KhronosGroup/glTF-Blender-IO/pull/1983 Please help us review the Blender 4.0 feature to limit the MAX influences rather than picking either 4 or all.

Godot supports 4 or 8 bone vertex influence (blend weights).