Geometry Nodes: Nodes to expose matrix components #121283

Merged
Jacques Lucke merged 12 commits from mod_moder/blender:matrix_inputs into main 2024-05-01 21:31:20 +02:00

These nodes allow working with the raw values that make up a matrix. This can be used to construct a 4x4 matrix directly, without using the Combine Transform node. This allows building transforms with arbitrary skew, or projection matrices.

image

These nodes allow working with the raw values that make up a matrix. This can be used to construct a 4x4 matrix directly, without using the `Combine Transform` node. This allows building transforms with arbitrary skew, or projection matrices. ![image](/attachments/d5bef4e7-3a8c-4dc2-8b15-9afbbc5d5d21)
Iliya Katushenock added the
Interest
Geometry Nodes
label 2024-04-30 21:24:44 +02:00
Iliya Katushenock added 3 commits 2024-04-30 21:24:55 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2024-04-30 21:24:59 +02:00
Iliya Katushenock added 1 commit 2024-04-30 21:34:34 +02:00
Iliya Katushenock added 2 commits 2024-04-30 21:53:20 +02:00
Iliya Katushenock added 4 commits 2024-05-01 11:35:28 +02:00
Iliya Katushenock requested review from Jacques Lucke 2024-05-01 11:35:53 +02:00
Iliya Katushenock added 1 commit 2024-05-01 12:02:14 +02:00
Jacques Lucke requested changes 2024-05-01 14:01:08 +02:00
Dismissed
Jacques Lucke left a comment
Member

I have a feeling that these nodes can be implemented more efficiently without having to iterate over all values 16 times, but that can be optimized separately. It's nice to have a simpler implementation now.

The other main new thing is that the outputs come after the inputs. Will gather some feedback about that.

I have a feeling that these nodes can be implemented more efficiently without having to iterate over all values 16 times, but that can be optimized separately. It's nice to have a simpler implementation now. The other main new thing is that the outputs come after the inputs. Will gather some feedback about that.
@ -268,6 +268,7 @@ DefNode(FunctionNode, FN_NODE_ALIGN_ROTATION_TO_VECTOR, 0, "ALIGN_ROTATION_TO_VE
DefNode(FunctionNode, FN_NODE_AXIS_ANGLE_TO_ROTATION, 0, "AXIS_ANGLE_TO_ROTATION", AxisAngleToRotation, "Axis Angle to Rotation", "")
DefNode(FunctionNode, FN_NODE_BOOLEAN_MATH, 0, "BOOLEAN_MATH", BooleanMath, "Boolean Math", "")
DefNode(FunctionNode, FN_NODE_COMBINE_COLOR, 0, "COMBINE_COLOR", CombineColor, "Combine Color", "")
DefNode(FunctionNode, FN_NODE_COMBINE_MATRIX, 0, "COMBINE_MATRIX", CombineMatrix, "Combine Matrix", "")
Member

Description: Construct a 4x4 matrix from its individual values

Description: `Construct a 4x4 matrix from its individual values`
mod_moder marked this conversation as resolved
@ -291,6 +292,7 @@ DefNode(FunctionNode, FN_NODE_ROTATE_VECTOR, 0, "ROTATE_VECTOR", RotateVector, "
DefNode(FunctionNode, FN_NODE_ROTATION_TO_AXIS_ANGLE, 0, "ROTATION_TO_AXIS_ANGLE", RotationToAxisAngle, "Rotation to Axis Angle", "")
DefNode(FunctionNode, FN_NODE_ROTATION_TO_EULER, 0, "ROTATION_TO_EULER", RotationToEuler, "Rotation to Euler", "")
DefNode(FunctionNode, FN_NODE_SEPARATE_COLOR, 0, "SEPARATE_COLOR", SeparateColor, "Separate Color", "")
DefNode(FunctionNode, FN_NODE_SEPARATE_MATRIX, 0, "SEPARATE_MATRIX", SeparateMatrix, "Separate Matrix", "")
Member

Description: Split a 4x4 matrix into its individual values

Description: `Split a 4x4 matrix into its individual values`
mod_moder marked this conversation as resolved
@ -0,0 +40,4 @@
column_d.add_input<decl::Float>("Column 4 Row 4").default_value(1.0f);
}
static void step_copy(const IndexMask &mask,
Member

Maybe copy_with_stride is a better name here. Same in the other node.

Maybe `copy_with_stride` is a better name here. Same in the other node.
mod_moder marked this conversation as resolved
Iliya Katushenock requested review from Jacques Lucke 2024-05-01 15:59:18 +02:00
Iliya Katushenock added 1 commit 2024-05-01 15:59:23 +02:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
9c01f9c05a
progress
Member

Just chatted with @JacquesLucke about this. My initial reaction to seeing the screenshots is that there has to be a less bloated solution in terms of UI, but after some more consideration I don't really think there is much to say against the utility and consistency this brings.

I do think that ideally we wouldn't present this as the only way to access this data though, so I'd like to propose adding get(/set ?) nodes for specific matrix elements by indices so they can be in the same release.

Such would be at least a Matrix Element node with Matrix, Row, Column inputs and the value field of that element as output.
There could be one to Replace Matrix Element as well and in some way this also relates to future list functionality, so maybe this still needs a desing task to figure things out.

Just chatted with @JacquesLucke about this. My initial reaction to seeing the screenshots is that there has to be a less bloated solution in terms of UI, but after some more consideration I don't really think there is much to say against the utility and consistency this brings. I do think that ideally we wouldn't present this as the only way to access this data though, so I'd like to propose adding get(/set ?) nodes for specific matrix elements by indices so they can be in the same release. Such would be at least a `Matrix Element` node with `Matrix`, `Row`, `Column` inputs and the value field of that element as output. There could be one to `Replace Matrix Element` as well and in some way this also relates to future list functionality, so maybe this still needs a desing task to figure things out.
Author
Member

Not sure this is actually good idea to use index to access data of attribute component.
We do not do this for vector and color.

Not sure this is actually good idea to use index to access data of attribute component. We do not do this for vector and color.
Member

@blender-bot build

@blender-bot build
Jacques Lucke approved these changes 2024-05-01 21:14:15 +02:00
Jacques Lucke left a comment
Member

Thanks for working on this node.
Can you make a separate patch for a Matrix Element node like the one Simon described? I have to think about use-cases for it a bit more, but would be nice to have a patch already.

Thanks for working on this node. Can you make a separate patch for a Matrix Element node like the one Simon described? I have to think about use-cases for it a bit more, but would be nice to have a patch already.
Author
Member

This is pretty trivial node group with Index Switch node.

This is pretty trivial node group with Index Switch node.
Jacques Lucke merged commit 831e91c357 into main 2024-05-01 21:31:20 +02:00
Iliya Katushenock deleted branch matrix_inputs 2024-05-01 21:35:54 +02:00
Author
Member

I have tried to check some different ways to combine component of matrix: https://projects.blender.org/mod_moder/blender/src/branch/tmp_optimiza_combine_matrix_node
In result, current approach the most faster.

I have tried to check some different ways to combine component of matrix: https://projects.blender.org/mod_moder/blender/src/branch/tmp_optimiza_combine_matrix_node In result, current approach the most faster.
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 Assignees
3 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#121283
No description provided.