Geometry Nodes: Add Random Rotation node #109846
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#109846
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "cmbasnett/bdk-blender:geometry-nodes-random-value-quaternion"
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
Random Rotation
node as part of task: #92967.The algorithm used generates uniformly distributed unit quaternions and is based on this paper:
Effective Sampling and Distance Metrics for 3D Rigid Body Path Planning (2004) - James J. Kuffner
https://www.ri.cmu.edu/pub_files/pub4/kuffner_james_2004_1/kuffner_james_2004_1.pdf
Colin Basnett referenced this pull request2023-07-08 05:53:35 +02:00
While the rotation socket is an experimental feature, it shouldn't be visible in the item list unless the feature is enabled. It seems that for now your socket is available without regard to experimentation. You can find examples of how to implement this in #109084 / #109517.
a575570de5
to1154803026
I have added handling to respect the experimental flag.
@ -2220,0 +2217,4 @@
const eCustomDataType data_type = eCustomDataType(item->value);
if (U.experimental.use_rotation_socket && data_type == CD_PROP_QUATERNION) {
const bNodeTree* tree = reinterpret_cast<const bNodeTree*>(ptr->owner_id);
if (tree->type == NTREE_GEOMETRY) {
This check is a bit redundant, this node is not used outside of geometry nodes (Mix node used and in shaders...).
We talked about this in the recent module meeting. There was more to it than I expected, sorry for misleading you a bit earlier.
So, I think to move forward with this feature, it might be best to port the math to nodes and see how this works as a "Random Rotation" node group asset. Unfortunately the essentials repository is still in SVN, so we can't make pull requests for it yet.
I don't think that, in this case at least, a basic operation like getting a random rotation should be an asset that has to be linked in. How is a script author expected to add these nodes? I am doing a lot of heavy node scripting at the moment and I would consider it very inconvenient to have to go and load basic math functions from an asset bundle.
The convenience of adding an asset through a script is fairly tangential to the decision here-- we can always make that more convenient, in fact this may be a good reason to look into that.
Other than that, I don't think there's any reason to avoid using assets even for "basic operations" (though I'd argue this isn't that basic, since there are potentially many ways of generating a random rotation). The asset bundle is called "Essentials" after all.
I agree with @HooglyBoogly that baking a single "blessed" approach for this into geometry nodes maybe isn't the best idea. More thoughts below.
In the world of path tracing, sampling is generally split into two separate concepts:
So, for example, generating samples inside a disc is broken into two steps: 1. generating uniform samples in the unit square, and 2. remapping those samples to the unit disc.
The reason for this split is two-fold:
The paper you based your implementation on provides one possible way of mapping the unit cube to the surface of the 4D unit hypersphere. But there are certainly other mappings that may be more/less appropriate depending on circumstances.
Having said all of that, I don't know if I necessarily agree that these should be entirely left up to node groups. (Although, admittedly, I'm not part of the geonodes module, so feel free to ignore.) But I do think that it should at least be split up into smaller components, like various sample generators and various mappings so that people can mix and match appropriately. And if those components were built-ins, then it would be at most two nodes to get the same result as the single node in this PR.
The problem for me is that I just don't know why a more general kind of random rotation operation is needed.
The case @nathanvegdahl ' describe is more like ray tracing node group. Or cases where you initially generate different euler angles (as a more geometric view) of rotations to randomize the model parts.
But if reduce all variations to simple noise, then I simply do not see the need for more control.
The generation of a vector can, in theory, be split as well, since its components can have different patterns or distributions in their ranges.
So I would take it simply as the most simple and fast function.
For pure white-noise-style random numbers, you probably don't. In that case I suspect(?) the different mapping methods make no meaningful difference.
Where the different mapping methods definitely do make a difference is when you start using something like a blue noise distribution or other point generation methods. And for a lot of applications (including, I suspect, in many geometry node set ups) a more evenly distributed set of points like that is often exactly what you want.
To clarify: I referenced path tracing since that's the field I learned these things from. But it has nothing to do with ray tracing. It's just about generating point samples (of which rotations are an example) in various useful ways.
Geometry Nodes: Add Quaternion data type to Random Value nodeto Geometry Nodes: Add Random Rotation node@HooglyBoogly I've updated this to make the Random Rotation a separate node. It is still done in native code, as I really think that Random Rotation is equally as foundational and in the same mental category as generating a Random Vector, which is also a native operation at this moment.
I also tried converting this algorithm to a node group, but I don't think it's even possible because the algorithm requires temporary variables to be stored, and the order of the noise samples is important. The only way to store temporary variables is within Geometry attributes, but that would be incredibly inefficient.
I'm still left with the idea that this operation is simple enough to be part of a common random node. This also corresponds to the idea of separating nodes not by types, but by operations.
Here's an implementation of that algorithm:
One issue is that exposing the ID input of the random value node causes it default to zero instead of the implicit ID field, making all values uniform:
For reference, I previously created a similar node Add Random Spherical Distribution node which had controls to limit the radius, angles. (See https://archive.blender.org/developer/D12746). This was abandoned at the last minute in favour of a more generic approach and shipping it as a node group.
As a result a task was created Nodes to convert between cartesian/spherical coordinates by @SimonThommes (See https://archive.blender.org/developer/T94722). I picked this up (see https://archive.blender.org/developer/D13772) before it was picked up again by @guitargeek (see https://archive.blender.org/developer/D15653).
Hopefully it would be good to see a built in solution soon.
Euler based distribution example.
After
20d8f27ed2
we have all the tools we need to add this as a node group asset, so I'll close this PR.Pull request closed