Geometry Nodes: Convert four nodes to use rotation socket #111482

Open
Hans Goudey wants to merge 3 commits from HooglyBoogly/blender:geometry-nodes-use-rotation-type into main

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

Convert the vector socket from four nodes to a rotation socket, adding
versioning to insert the conversion nodes and change the default values
where necessary.

  • Distribute Points on Faces
  • Instance on Points
  • Rotate Instances
  • Transform Geometry

Using rotation sockets disallows implicit conversions from vectors,
which helps avoid some common mistakes. It can also be faster,
since converting to and from Euler rotations is slow. For best
performance, the automatically added nodes should be removed.

Note that this change is not forward compatible with 3.6.


image

Convert the vector socket from four nodes to a rotation socket, adding versioning to insert the conversion nodes and change the default values where necessary. - Distribute Points on Faces - Instance on Points - Rotate Instances - Transform Geometry Using rotation sockets disallows implicit conversions from vectors, which helps avoid some common mistakes. It can also be faster, since converting to and from Euler rotations is slow. For best performance, the automatically added nodes should be removed. Note that this change is not forward compatible with 3.6. --- ![image](/attachments/f6c295b3-a59f-4108-9216-895247367f28)
164 KiB
Hans Goudey added 1 commit 2023-08-24 18:08:16 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
f5c9bb5960
Geometry Nodes: Convert four nodes to use rotation socket
Convert the vector socket from four nodes to a rotation socket, adding
versioning to insert the conversion nodes and change the default values
where necessary.
- Distribute Points on Faces
- Instance on Points
- Rotate Instances
- Transform Geometry

Using rotation sockets disallows implicit conversions from vectors,
which helps avoid some common mistakes. It can also be faster,
since converting to and from Euler rotations is slow. For best
performance, the automatically added nodes should be removed.

Note that this change is not forward compatible with 3.6.
Poster
Collaborator

@blender-bot build

@blender-bot build
Hans Goudey added this to the 4.0 milestone 2023-08-24 18:11:47 +02:00
Hans Goudey requested review from Lukas Tönne 2023-08-24 18:12:23 +02:00
Hans Goudey requested review from Jacques Lucke 2023-08-24 18:12:24 +02:00
Hans Goudey added this to the Nodes & Physics project 2023-08-24 18:12:32 +02:00
Iliya Katueshenock reviewed 2023-08-24 18:19:04 +02:00
@ -423,0 +427,4 @@
socket.type = SOCK_ROTATION;
STRNCPY(socket.idname, "NodeSocketRotation");
auto *old_value = static_cast<bNodeSocketValueVector *>(socket.default_value);
auto *new_value = MEM_new<bNodeSocketValueRotation>(__func__);

nodes::update_node_declaration_and_sockets ?

`nodes::update_node_declaration_and_sockets` ?
Poster
Collaborator

That won't convert the default value. And I'd also rather not call a relatively higher level function like that in versioning code, since it makes it more difficult to change in the future.

That won't convert the default value. And I'd also rather not call a relatively higher level function like that in versioning code, since it makes it more difficult to change in the future.

Default values can be copied separately, but I'm surprised it's okay to do it manually when declarations already exist...

Default values can be copied separately, but I'm surprised it's okay to do it manually when declarations already exist...
mod_moder marked this conversation as resolved

Attached file is crash when opened.

Attached file is crash when opened.
Hans Goudey added 2 commits 2023-08-24 20:00:24 +02:00
Poster
Collaborator

I think the most recent commit should fix the issues with your file, thanks.

I think the most recent commit should fix the issues with your file, thanks.
Poster
Collaborator

@blender-bot build

@blender-bot build

I think we can only do this once we have the ability to create random rotations in one node, and to combine rotations (or if we actually do allow the implicit conversion between vector and euler).

Without those things, we make some very common workflows harder (like initializing every instance with a random rotation). Not to mention that this also breaks a very large number of tutorials that are meant for beginners.

I think we can only do this once we have the ability to create random rotations in one node, and to combine rotations (or if we actually do allow the implicit conversion between vector and euler). Without those things, we make some very common workflows harder (like initializing every instance with a random rotation). Not to mention that this also breaks a very large number of tutorials that are meant for beginners.

I think we can only do this once we have the ability to create random rotations in one node[...]

There is an open PR that does just this, but it's rolled into the existing Random Value node. Do we want it changed to be it's own "Random Rotation" node? #109846

> I think we can only do this once we have the ability to create random rotations in one node[...] There is an open PR that does just this, but it's rolled into the existing Random Value node. Do we want it changed to be it's own "Random Rotation" node? https://projects.blender.org/blender/blender/pulls/109846

Agree with Jacques, the patch would be fine on its own but it needs a better plan for compatibility and ease of use with existing nodes.

I'd be ok with implicit conversions interpreting any vector as an euler and convert that to a quaternion. The alternative would be a straightforward (x,y,z) -> (x,y,z,0) conversion plus normalization, but that doesn't give very intuitive rotations and the normalization makes it rather useless for math purposes ("Combine Rotation" must be used for that).

Agree with Jacques, the patch would be fine on its own but it needs a better plan for compatibility and ease of use with existing nodes. I'd be ok with implicit conversions interpreting any vector as an euler and convert that to a quaternion. The alternative would be a straightforward `(x,y,z)` -> `(x,y,z,0)` conversion plus normalization, but that doesn't give very intuitive rotations and the normalization makes it rather useless for math purposes ("Combine Rotation" must be used for that).

Reviewers

Lukas Tönne was requested for review 2023-08-24 18:12:23 +02:00
Jacques Lucke was requested for review 2023-08-24 18:12:24 +02:00
Some checks failed
buildbot/vexp-code-patch-coordinator Build done.
This pull request has changes conflicting with the target branch.
  • source/blender/blenloader/intern/versioning_400.cc
  • source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
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 & 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
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
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
5 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#111482
There is no content yet.