Baking animation of bones affected by a curve (spline IK) is wrong #79670
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#79670
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: windows 10
Graphics card: gforce 1060 6gb
Blender Version
Broken 2.92 alpha
Broken 2.83
Worked: likely never
Short description of error
I have a row of bones, I add the curve modifier, I make an animation with that modifier on, I bake the animation of the bones to be able to send it to unreal or unity and the animation breaks completely
Exact steps for others to reproduce the error
CurveBreackExample.blend
SkeletonBase
objectAdded subscriber: @GabrielAntonioDelacruz
Added subscriber: @iss
Changed status from 'Needs Triage' to: 'Needs User Info'
Please upload simple .blend file that demonstrates this issue.
CurveBreackExample.rar
Changed status from 'Needs User Info' to: 'Needs Developer To Reproduce'
Changed status from 'Needs Developer To Reproduce' to: 'Needs Triage'
Baking animation of bones affected by a curveto Baking animation of bones affected by a curve (spline IK) is wrongChanged status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @lichtwerk
I think there are two issues at work here:
For this task I'll focus on the first item, as the 2nd is already handled somewhere else.
Added subscriber: @Josephbburg
It looks like the visual keying issues I thought were there, aren't. This seems to be caused by the Spline IK constraint somehow. @Josephbburg do you have any insight here?
Here is a simplified file that I made. It has no animation, just a scale on the root bone and a Spline IK on the tip bone.
#79670-spline-scaled-nonanimated.blend
To reproduce:
I've expanded my "Copy Visual Transform" add-on to aid in debugging this. It has a button "Bake Selected Bones" and a nice display of the bone matrices
.matrix
and.matrix_basis
.Even with D9244: Fix #81704 applied, there still seems to be a slight scaling error creeping in. And then at
Bone.008
all of a sudden things explode.Added subscriber: @dr.sybren
Well, here's something interesting -- if you set the bones to use "ALIGNED" scale inheritance and THEN bake using the operator, then there seems to be no issue. This makes sense -- the Spline IK constraint handles the scaling components separately. Y is handled and then XZ is handled, and so "aligned" is the most correct way to bake the scale inheritance. I'm fairly certain this is the cause of the bug. The Y scale sets the length of the bone, which sets the next point on the curve that the constraint uses. Then the bone is rotated to point towards it (basically Damped Track) and scales along the local y axis until the tail reaches that point. So the situation is weird -- the input scale is not directly correlated with the output scale. In face, with sufficiently weird curves, you can get much shorter or longer bones than the y-scale should create. Here's a .blend that shows this problem:
#79670-spline-scaled-nonanimated_Bad.blend
It's a really difficult corner case, it's always weird when increasing the scale results in a shorter bone!
I haven't closely read the code of your addon, but I have a suspicion that it isn't factoring the parent's scale or scale inheritance mode in, at least not the same way the baking operator does, Weird behavior like scale explosion after a few bones is actually normal in my experience -- in fact, I've gotten this behavior in scripts that apply a rotation matrix to each bone in a chain one at a time (In my ChainTools addon, it's "SnapPoseBonesToCurve "). Even if the matrices don't contain any scale, and in fact, even when the matrices are decomposed and recomposed to remove scale, this will still occur. So I think all that is happening there is floating point error. In my experience, Python's values aren't very trustworthy past 3 decimal places. I always round them in my own scripts.
Finally, I don't see this as directly related to Y-Scale Mode bug, but even if it is --if there's still slight scale errors creeping in, it's probably just because the fix isn't perfect. In fact, the .blend file I just uploaded should reveal the error in my fix. I mean to solve it by a brute-force bisection search, but I've been too busy to look into it for the past few weeks 😭 . I don't think they're related, though, because it looks like the baking code is just interpreting scale inheritance incorrectly for this situation.
Added subscriber: @Yad
Hey guys, I have a similar issue when baking this huge chain of bones (193 bones + 192 bones) that were attached to 2 curves with spline IK . It seems that the end of the the first chain of bones is inaccurate after bake and does not stay put where it should. It is correct before the bake.
I attached the blend file.
I have 2 curves and 2 armatures. The curves share 1 of the many hooks in the middle.
Here are the settings for the last bone of each of the armature. It still does it if I change the Y Scale Mode to none.
![image](/blender/blender/attachments/b8343fb6-9688-491d-8fe3-aa581b05a71c)
Bake settings:
![image](/blender/blender/attachments/1c736b11-68c3-4137-adec-dd10de7d3020)
Before bake at frame 350 :
![image](/blender/blender/attachments/ab79391b-dc08-4880-b7cb-b43dfc185469)
After bake:
![image](/blender/blender/attachments/ea0a5586-1c65-4479-aa29-5c3872c7e737)
I don't know if there is a work around. I am currently editing the final bake to make it align (not ideal 👎 ).
@Josephbburg wrote:
Have you tried this, @Alin-Blindu ? Would it be a suitable workaround for you?
Hey @dr.sybren I tried that on all of the bones and I am getting the same result.
![image](/blender/blender/attachments/813d3a06-1be7-45d4-9a99-b1df151c3f4f)
Any other ideas?