WIP: IK: distinguish 'off' from '0% influence' in IK constraints #117178

Draft
Sybren A. Stüvel wants to merge 8 commits from dr.sybren/blender:pr/anim-ik-off-means-off into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Context (as in, main Blender behaviour): depending on the situation, the IK solver will use the influence slider in different ways. If there is no pole vector, it will interpolate between the target position and the bone's current position. This means that an influence of 0% will still fully run the IK solver, which overwrites the bone's transform matrix.

This PR introduces a distinction between '0% influence' and 'muted'. The former still behaves as above, and the latter now actually skips the IK solver for that bone chain.

This PR doesn't quite work, though. A simple test case seems to work fine, but when I test with an actual production rig it causes glitching. The glitching disappears when running Blender with -t 1, suggesting that it might be due to threading and missing relations in the dependency graph. From what I can tell, the semantic change of having "OFF" as "completely ignored by Blender" requires deeper code changes so that it's really properly ignored by the depsgraph. Although that might be the correct approach for an always-OFF constraint, things get more complex when actually animating the 'enabled' property.

This is aiming at fixing #115915.

Context (as in, `main` Blender behaviour): depending on the situation, the IK solver will use the influence slider in different ways. If there is no pole vector, it will interpolate between the target position and the bone's current position. This means that an influence of 0% will still fully run the IK solver, which overwrites the bone's transform matrix. This PR introduces a distinction between '0% influence' and 'muted'. The former still behaves as above, and the latter now actually skips the IK solver for that bone chain. This PR doesn't quite work, though. A simple test case seems to work fine, but when I test with [an actual production rig](https://studio.blender.org/characters/5f1ed640e9115ed35ea4b3fb/showcase/1/) it causes glitching. The glitching disappears when running Blender with `-t 1`, suggesting that it might be due to threading and missing relations in the dependency graph. From what I can tell, the semantic change of having "OFF" as "completely ignored by Blender" requires deeper code changes so that it's really properly ignored by the depsgraph. Although that might be the correct approach for an always-OFF constraint, things get more complex when actually animating the 'enabled' property. This is aiming at fixing #115915.
Sybren A. Stüvel added the
Module
Animation & Rigging
label 2024-01-16 17:42:14 +01:00
Sybren A. Stüvel added 5 commits 2024-01-16 17:42:24 +01:00
c0115450ad IK: distinguish 'off' from '0% influence' in IK constraints
Depending on the situation, the IK solver will use the influence slider
in different ways. If there is no pole vector, it will interpolate between
the target position and the bone's current position. This means that an
influence of 0% will still fully run the IK solver, which overwrites the
bone's transform matrix.

This commit introduces a distinction between '0% influence' and 'muted'.
The former still behaves as above, and the latter now actually skips the
IK solver for that bone chain.

There is a difference in target positions between '0% influence' and 'muted'
when it comes to tree IK (i.e. multiple bones with IK constraints, where the
IK chains at some point overlap at a common parent bone).

This should fix #115915.
0cb872ba52 IK: draw relationship line when influence is 0%, hide when OFF
When IK constraints are enabled was recently changed. This commit updates
the overlay drawing code to match.

The relationship line, between the start and the end of the IK chain, is
now drawn whenever the IK system is active for that chain. This means that
it's drawn even at 0% influence, but not when the constraint is OFF/muted.

iksolver_execute_tree is meant to solve all IK constraint from the pchan_root. But here position_skipped_bones handles all bones in the armature, which indeed is likely not thread safe.

For example the dependency graph might figure out that the left and right arm can be handled in parallel, but iksolver_execute_tree should then only affect the bones on one arm.

I would expect position_skipped_bones to only work on bones in tree->pchan.

`iksolver_execute_tree` is meant to solve all IK constraint from the `pchan_root`. But here `position_skipped_bones` handles all bones in the armature, which indeed is likely not thread safe. For example the dependency graph might figure out that the left and right arm can be handled in parallel, but `iksolver_execute_tree` should then only affect the bones on one arm. I would expect `position_skipped_bones` to only work on bones in `tree->pchan`.
Sybren A. Stüvel added 2 commits 2024-02-08 16:23:49 +01:00
Sybren A. Stüvel added 1 commit 2024-02-08 17:13:31 +01:00
17e6619983 Move the "cleaup" phase to a separate depsgraph operation
This is just for testing, not sure if it's the right way to approach this.
This pull request is marked as a work in progress.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u pr/anim-ik-off-means-off:dr.sybren-pr/anim-ik-off-means-off
git checkout dr.sybren-pr/anim-ik-off-means-off
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
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
EEVEE & Viewport
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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
EEVEE & Viewport
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
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#117178
No description provided.