-
Notifications
You must be signed in to change notification settings - Fork 46
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
Crashes when rendering gltf model with skeleton #202
Comments
@afonso360 thank you for submitting the issue! Could you share the model for us to repro? |
Sure, You should need these two files: I exported them from blender using the latest version of |
Thanks for the files! I'm able to repro now. |
I wonder if this will be affected (positively?) by #203. cc @randomPoison |
I'll certainly test it out and make sure it doesn't cause a problem with the new implementation. @afonso360 what is the licensing on the glTF files you provided? Could they be added to the three repo (or rather the example-data repo to be used for examples and regression testing? |
Unfortunately, I think that might be a more complicated issue. I got the model from here, changed a few things, did the animation and exported. I'm not sure that the original license covers this use case. However, i've quickly created another example animation which shows the same issues. I've uploaded it here: This one is completely mine, so feel free to use it. If you guys want me to explicitly license it, let me know which one would be preferable. |
I can confirm that the changes in #203 avoid this issue when loading glTF files, but the underlying bug is easy to reproduce by making the first child of a Internally, the issue has to do with how the renderer handles skeletons and bones. When the renderer walks the node hierarchy, it pushes any skeletons it finds onto a stack. When it finds a bone, it assumes the bone belongs to the skeleton at the top of the stack (i.e. the skeleton it found most recently). This assumption doesn't match how the three-rs API allows users to put Personally, I think the best solution is to somehow limit bones/skeletons such that the bones in a skeleton must be "children" of that skeleton. In practice, any other setup doesn't make sense, and allowing skeletons/bones to be put anywhere only allows users to inadvertently create nonsensical hierarchies. If that's not desirable, I think it would be possible to rework the renderer to fully adhere to the public API's semantics. |
Three supports having the skeleton separately from the meshes it affects. But not the bones - I don't see the point of having them outside of the skeleton. So we are in agreement here, and just need to adjust the code to enforce it (earlier and more politely - a panic is also sorta enforcement). |
I dunno if this is the best place to discuss it, but my suggestion would be to limit skeleton/bone hierarchies to only be composed of |
A problem with the solution I described above: How would we handle the case where we want to attach an object to a joint in a skeleton? For example, say we have a skinned character model and we want to have it hold an object in its hand. Under the current model, we could easily add the model to the I could imagine adding some kind |
@randomPoison right, we can't have bones only in there.
I've been thinking around this idea for a long time, albeit not so deeply. The conclusion I came up with is that parent/child relationships are bad in general and should be gone. Instead, all objects should only have the world space transformation tracked. And there should be a set of physical constraints between them. Some of the constraints would then simulate the old-style parent-child relationships. However, this is too futuristic and experimental. Three-rs is a fine place to try out things internally, but it's not meant to expose unconventional APIs to the users. So we are pretty much settled on having the traditional parent-child hierarchies here, for convenience reasons. |
Note that glTF does not currently require a particular skeleton structure — the bones do not have to form a tree, and (if they are a tree) there may also be other nodes in that tree. The See KhronosGroup/glTF#1403 for details and links to related issues, and feel free to comment there. 🙂 |
Hi,
Three-rs crashes when I try to render a gltf model with a skeleton. The crash happens at src/render/mod.rs:719. This happens because we get a bone before a skeleton.
I've temporaraly fixed it by iterating twice, once for the skeletons and again for the bones.
Thanks.
The text was updated successfully, but these errors were encountered: