Dual quaternion deform breaks on Tara rig #43711

Closed
opened 2015-02-17 18:58:50 +01:00 by Daniel Salazar · 16 comments
Member

System Information

openSUSE 12.3 64bits
NVIDIA 480GTX SC
AMD FX-8350

Blender Version
Broken: 2.73a

Short description of error

https://www.youtube.com/watch?v=bd9QpdoQsBs

Exact steps for others to reproduce the error

File runs on official release but better to use master. Just move selected bone
dualquat.blend

This happens due to neck_01 being deformed by the chest bone. It can be fixed by disabling inherit scale. But still, nasty :D

**System Information** openSUSE 12.3 64bits NVIDIA 480GTX SC AMD FX-8350 **Blender Version** Broken: 2.73a **Short description of error** https://www.youtube.com/watch?v=bd9QpdoQsBs **Exact steps for others to reproduce the error** File runs on official release but better to use master. Just move selected bone [dualquat.blend](https://archive.blender.org/developer/F144316/dualquat.blend) This happens due to neck_01 being deformed by the chest bone. It can be fixed by disabling inherit scale. But still, nasty :D
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Brecht Van Lommel was assigned by Daniel Salazar 2015-02-17 18:58:50 +01:00
Author
Member

Added subscriber: @zanqdo

Added subscriber: @zanqdo

Added subscriber: @Psy-Fi

Added subscriber: @Psy-Fi

There's something wrong with the file, I can't move anything and as soon I try I get not-a-number errors at the translation fields. Can you try if it works for master or if there some linking error somewhere?

There's something wrong with the file, I can't move anything and as soon I try I get not-a-number errors at the translation fields. Can you try if it works for master or if there some linking error somewhere?

Alright, ignore please case of "reload trusted", moving on...

Alright, ignore please case of "reload trusted", moving on...
Author
Member

@Psy-Fi Maybe the run python scripts thing is disabled? There is no external data in this file. A little more info. You move neck_01 in RIG_tara armature (Layer 11) This will move neck_01 in DEF_tara (layer 12). This is the bone that actually produces the issue since it's parented to chest.

@Psy-Fi Maybe the run python scripts thing is disabled? There is no external data in this file. A little more info. You move neck_01 in RIG_tara armature (Layer 11) This will move neck_01 in DEF_tara (layer 12). This is the bone that actually produces the issue since it's parented to chest.
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Brecht Van Lommel was unassigned by Sergey Sharybin 2015-02-20 11:03:36 +01:00

Added subscribers: @brecht, @Sergey

Added subscribers: @brecht, @Sergey

Placing the report for grabs. Don't think @brecht will find time soon to look into it. I'll try to look later, or maybe @Psy-Fi will nail the issue down :)

Placing the report for grabs. Don't think @brecht will find time soon to look into it. I'll try to look later, or maybe @Psy-Fi will nail the issue down :)

I took a look at this file, there is some odd shearing on the neck_* bones in the deform rig, inherited from the chest bone. I would imagine the shearing on these neck bones is not intentional? So perhaps the real issue is in the scale inheriting code, I don't remember what the rules are here.

It seems the dual quaternion code in mat4_to_dquat() is not detecting the shearing, only scaling along the axes, and so it incorrectly assumes that there is an orthogonal matrix. The patch below can work, though I think the tolerance in is_orthonormal_m3() is way too low for any purpose, it should probably be increased to avoid too many false positives where it detects scaling when there isn't any. Maybe 1e-5f? I don't have much time now to test this on various rigs to find the right tolerance.

diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c
index 3ac031d..0a8010b 100644
--- a/source/blender/blenlib/intern/math_rotation.c
+++ b/source/blender/blenlib/intern/math_rotation.c
@@ -1572,7 +1572,7 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order
 
 void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4])
 {
-	float *t, *q, dscale[3], scale[3], basequat[4];
+	float *t, *q, dscale[3], scale[3], basequat[4], mat3[3][3];
 	float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4];
 	float R[4][4], S[4][4];
 
@@ -1585,7 +1585,9 @@ void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4])
 	dscale[1] = scale[1] - 1.0f;
 	dscale[2] = scale[2] - 1.0f;
 
-	if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
+	copy_m3_m4(mat3, mat);
+
+	if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) {
 		/* extract R and S  */
 		float tmp[4][4];
I took a look at this file, there is some odd shearing on the `neck_*` bones in the deform rig, inherited from the `chest` bone. I would imagine the shearing on these neck bones is not intentional? So perhaps the real issue is in the scale inheriting code, I don't remember what the rules are here. It seems the dual quaternion code in `mat4_to_dquat()` is not detecting the shearing, only scaling along the axes, and so it incorrectly assumes that there is an orthogonal matrix. The patch below can work, though I think the tolerance in `is_orthonormal_m3()` is way too low for any purpose, it should probably be increased to avoid too many false positives where it detects scaling when there isn't any. Maybe `1e-5f`? I don't have much time now to test this on various rigs to find the right tolerance. ``` diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 3ac031d..0a8010b 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1572,7 +1572,7 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4]) { - float *t, *q, dscale[3], scale[3], basequat[4]; + float *t, *q, dscale[3], scale[3], basequat[4], mat3[3][3]; float baseRS[4][4], baseinv[4][4], baseR[4][4], baseRinv[4][4]; float R[4][4], S[4][4]; @@ -1585,7 +1585,9 @@ void mat4_to_dquat(DualQuat *dq, float basemat[4][4], float mat[4][4]) dscale[1] = scale[1] - 1.0f; dscale[2] = scale[2] - 1.0f; - if ((determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) { + copy_m3_m4(mat3, mat); + + if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_v3(dscale) > 1e-4f) { /* extract R and S */ float tmp[4][4]; ```

@brecht, awesome to hear from you! :) Thanks for the inputs, and indeed eps seems kinda odd for me as well. We'll check on that since we've got quite a few of rigs to test on.

@brecht, awesome to hear from you! :) Thanks for the inputs, and indeed eps seems kinda odd for me as well. We'll check on that since we've got quite a few of rigs to test on.
Member

@Sergey, found the time to look into this?

@Sergey, found the time to look into this?

I tested this on a bunch of files now and the patch seems to be working fine, so I'll commit it.

I tested this on a bunch of files now and the patch seems to be working fine, so I'll commit it.

This issue was referenced by b6caefdaa9

This issue was referenced by b6caefdaa9f90159b6c058ef245cc9b8d4a110fa

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit b6caefdaa9.

Closed by commit b6caefdaa9.
Sign in to join this conversation.
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
6 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#43711
No description provided.