Geometry Nodes: new Axes to Rotation node #104416
No reviewers
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#104416
Loading…
Reference in New Issue
No description provided.
Delete Branch "JacquesLucke/blender:axis-to-euler"
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?
This adds a new
Axes to Rotation
node which creates a new rotation. In many cases, the primary and secondary axis inputs are a normal and tangent of a mesh or curve. This provides a simpler and more direct way to create this rotation compared to using twoAlign Euler to Vector
nodes.This more direct way of computing the rotation also allows us to optimize the case better.
The node rotates one axis (X, Y or Z) to the given primary axis direction. Then it rotates around that primary direction to align the second axis to the given secondary direction. Ideally, both input axes are orthogonal. However, the node still creates the "best" rotation when they are not orthogonal. If one or the axes is zero or both are (close to) parallel, the resulting rotation is unstable. There is not too much the node can do to make it more stable.
The code looks relatively straightforward. Assuming this works for Simon, this looks good to go.
@ -9901,0 +9922,4 @@
RNA_def_property_ui_text(
prop,
"Secondary Axis",
"Axis that is aligned as good as possible given the alignment of the primary axis");
as good
->as well
@ -0,0 +38,4 @@
uiItemR(layout, ptr, "secondary_axis", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
if (storage.primary_axis == storage.secondary_axis) {
uiItemL(layout, N_("Must not be equal"), ICON_ERROR);
Must not be equal
->Axes must not be equal
Just reads a bit better IMO
@ -0,0 +70,4 @@
/* Through cancellation this will set the last axis to be the one that's neither the primary
* nor secondary axis. */
tertiary_axis_ = (0 + 1 + 2) - primary_axis - secondary_axis;
Ooh, clever!
@ -0,0 +94,4 @@
const float tertiary_factor = invert_tertiary ? -1.0f : 1.0f;
for (const int64_t i : mask) {
float3 primary = math::normalize(primaries[i]);
Not asking for any changes here, but it would be nice if we could build function nodes with multiple multi-functions. In this case we could split the normalization of
primaries
andsecondaries
to separate functions. Later on we could implement an optimization pass that removes sequential normalization functions.I guess that might be possible with some improvements to
NodeMultiFunctionBuilder
?.
Geometry Nodes: new Axis to Euler nodeto Geometry Nodes: New Axis to Euler nodeGeometry Nodes: New Axis to Euler nodeto Geometry Nodes: new Axis to Euler nodeSeems good to me overall I tested some corner cases, where I think the behaviour could be different.
When primary and secondary axis are parallel, it should probably ignore the secondary axis entirely. At least I don't see a reason, why it would have any particular impact.
When using only the secondary axis as an input it would make sense to me to rotate first around what is selected as primary axis. Right now it seems a bit random to me, not sure of the logic behind it right now.
e.g. this shouldn't result in any rotation imo
With the rotation socket in 4.0, we have another opportunity to add this node. But it needs to be updated for that.
What about default values for inputs:
Primary Axis
:1.0, 0.0, 0.0
.Secondary Axis
:0.0, 1.0, 0.0
.This will let to use this node in simple cases without additional value nodes (or maybe better to not hide values of inputs?).
Geometry Nodes: new Axis to Euler nodeto Geometry Nodes: new Axes to Rotation nodeThis is somewhat tricky. Due to floating point math, it's hard to distinguish the case when both are parallel reliably. We'd have to use some epsilon, which might not work in all cases and can potentially also have undesired effects. The case when both are (almost) parallel is just very unstable, not sure if we can prevent that in practice.
I think this resulted in a rotation because the default for the primary axis was the X axis. Now I changed it so that by default the node does nothing. So the setup in your image should also do nothing then. I also made both inputs non-hidden again. Seems wrong to hide inputs whose values are important and that can make sense to modify manually.
I'm happy with the code now. No strong opinion, but didn't we talk about hiding the value of the first vector but not the second?
@ -0,0 +1,180 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
Missing copyright info
Yeah, we did. However, I changed my mind on that because of the Simon's screenshot. This wouldn't have been an issue if the input value is not hidden.
@blender-bot build
Checkout
From your project repository, check out a new branch and test the changes.