Add rotation attributes and node sockets #92967

Closed
opened 2021-11-09 19:01:04 +01:00 by Hans Goudey · 4 comments
Member

Tasks, not necessarily in order:

  • Add a basic Quaternion class in blenlib. More methods can be added as needed. 8a16523bf1
  • Add a rotation node socket
    • Expose in the UI as an XYZ order Euler (in the future, this could be a runtime option).
  • Convert existing rotation nodes to have rotation inputs and outputs.
    • Rename nodes "Rotate Euler" and "Align Rotation to Vector". Maybe "Modify Rotation" is the best name for the former.
    • Move the nodes to a new "Rotation" category.
    • Add versioning for backwards compatibility (maybe deal with forward compatibility too by just implementing new nodes?)
  • Add a "quaternion" custom data type, using a specific type instead of float4, similar to the way we refer to colors.
    • Interpolations for the custom data API
    • Interpolations for the DefaultMixer class.
    • Add as a choice for nodes with type drop-downs.
      • Mix (#109084)
      • Others: Capture attribute, named attribute nodes, etc.
      • Nodes that generate rotations: Curve to Points, Distribute Points on Faces
  • Axes to Rotation node (#104416)

Related: #92766 (Decide how rotation socket type should be stored)

Tasks, not necessarily in order: - [x] Add a basic `Quaternion` class in blenlib. More methods can be added as needed. 8a16523bf1fba4371b9b79f51ad61903a71836f2 - [x] Add a rotation node socket - [x] Expose in the UI as an XYZ order Euler (in the future, this could be a runtime option). - [ ] Convert existing rotation nodes to have rotation inputs and outputs. - [ ] Rename nodes "Rotate Euler" and "Align Rotation to Vector". Maybe "Modify Rotation" is the best name for the former. - [x] Move the nodes to a new "Rotation" category. - [x] Add versioning for backwards compatibility (maybe deal with forward compatibility too by just implementing new nodes?) - [x] Add a "quaternion" custom data type, using a specific type instead of `float4`, similar to the way we refer to colors. - [ ] Interpolations for the custom data API - [x] Interpolations for the `DefaultMixer` class. - [ ] Add as a choice for nodes with type drop-downs. - [x] Mix (#109084) - [x] Others: Capture attribute, named attribute nodes, etc. - [ ] Nodes that generate rotations: Curve to Points, Distribute Points on Faces - [ ] Axes to Rotation node (#104416) Related: #92766 (Decide how rotation socket type should be stored)
Hans Goudey changed title from Add rotation data type to Add rotation attributes and node sockets 2022-02-02 18:05:01 +01:00

One thing I'd like to point out here is that Euler to quaternion conversion is a lossy operation, since multiple Euler coordinates map to one quaternion coordinate. So if you store a value as a quaternion and show it in the UI as Euler, sometimes the value will then jump to something else. For some cases it does not matter, but an animator does not want to have their Euler coordinates completely changed when editing rotations for animation. For mechanical rigging, the sequential nature of rotation along each axis can also be information that you want to preserve.

I don't immediately know if that would cause many issues when it comes to geometry attributes. But one thing is that if you have a socket then the default value of that should be stored the same as Euler if its shown in the UI that way, and it should only be converted to quaternion for evaluation of the node.

One thing I'd like to point out here is that Euler to quaternion conversion is a lossy operation, since multiple Euler coordinates map to one quaternion coordinate. So if you store a value as a quaternion and show it in the UI as Euler, sometimes the value will then jump to something else. For some cases it does not matter, but an animator does not want to have their Euler coordinates completely changed when editing rotations for animation. For mechanical rigging, the sequential nature of rotation along each axis can also be information that you want to preserve. I don't immediately know if that would cause many issues when it comes to geometry attributes. But one thing is that if you have a socket then the default value of that should be stored the same as Euler if its shown in the UI that way, and it should only be converted to quaternion for evaluation of the node.
Hans Goudey added this to the Nodes & Physics project 2023-02-15 22:51:54 +01:00
Sybren A. Stüvel added the
Interest
Animation & Rigging
label 2023-05-11 15:41:23 +02:00

Please also include the Animation & Rigging module in any future discussions, we kinda do things with rotations as well ;-)

Please also include the Animation & Rigging module in any future discussions, we kinda do things with rotations as well ;-)
Hans Goudey added this to the 4.0 milestone 2023-06-06 18:48:12 +02:00

Noticed some inconsistency. It's not that important right now, but it makes sense to have a final choose.

Print method:

By quaternion components By euler rotation
image image

Name for enums.

Quaternion Rotation
image image
Noticed some inconsistency. It's not that important right now, but it makes sense to have a final choose. Print method: | By quaternion components | By euler rotation | | -- | -- | | ![image](/attachments/6cb02362-dcaf-40fe-adc5-0e89d1343057) | ![image](/attachments/bb0f4418-790a-4f8d-bb5a-4a3fe6ede7e1) | Name for enums. | Quaternion | Rotation | | -- | -- | | ![image](/attachments/6e5c48f0-8a42-4191-a5d9-634c270e3886) | ![image](/attachments/6796bba5-f3bc-4f00-b007-cefde14c60ec) |
Hans Goudey modified the milestone from 4.0 to 4.1 2023-11-14 16:30:30 +01:00
Author
Member

Big picture, this is finished. Two more PRs to follow:

Big picture, this is finished. Two more PRs to follow: - #118565 - #104416
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2024-03-14 17:52:02 +01:00
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 Assignees
4 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#92967
No description provided.