Random Number node #91373

Closed
opened 2021-09-13 13:32:04 +02:00 by Jacques Lucke · 10 comments
Member

Since we remove the Attribute Randomize node, we need a viable alternative to generate random numbers based on a seed. This node might replace or extend the Random Float node.
It's unclear whether we want different nodes for different data types or a single node for all data types.

Other related topics:

  • Should the node itself have a seed? Then the same input seed can be used in different nodes to generate different numbers. Without this, the user often has to manually change seeds.
  • How does this relate to the White Noise texture node?
Since we remove the `Attribute Randomize` node, we need a viable alternative to generate random numbers based on a seed. This node might replace or extend the Random Float node. It's unclear whether we want different nodes for different data types or a single node for all data types. Other related topics: * Should the node itself have a seed? Then the same input seed can be used in different nodes to generate different numbers. Without this, the user often has to manually change seeds. * How does this relate to the White Noise texture node?
Author
Member

Added subscriber: @JacquesLucke

Added subscriber: @JacquesLucke

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific
Member

Added subscriber: @CharlieJolly

Added subscriber: @CharlieJolly
Member

Some thoughts:

  • Rename Random Float to Random Number and base on the legacy Attribute Randomize node
  • Keep as a single high level node with Data Types from legacy Attribute Randomize node (Vector In > Vector Out etc)
  • Remove Operation menu from Attribute Randomize, this is no longer needed in fields (use Math node instead)
  • Add a checkbox for Auto seed which hides seed value (uses a seed based on some derived value)
  • Add alternative distribution options from D10459
  • Port White Noise (hash) shader node and keep as a separate and alternative node for unsigned random values (assume this is implemented with a different hash function)
Some thoughts: - Rename Random Float to Random Number and base on the legacy Attribute Randomize node - Keep as a single high level node with Data Types from legacy Attribute Randomize node (Vector In > Vector Out etc) - Remove Operation menu from Attribute Randomize, this is no longer needed in fields (use Math node instead) - Add a checkbox for Auto seed which hides seed value (uses a seed based on some derived value) - Add alternative distribution options from [D10459](https://archive.blender.org/developer/D10459) - Port White Noise (hash) shader node and keep as a separate and alternative node for unsigned random values (assume this is implemented with a different hash function)
Contributor

Added subscriber: @Eary

Added subscriber: @Eary
Contributor

In #91373#1220171, @CharlieJolly wrote:

  • Add a checkbox for Auto seed which hides seed value (uses a seed based on some derived value)

I like the checkbox but not sure about hiding the seed value. I previously discussed this in the devtalk thread:
https://devtalk.blender.org/t/fields-and-anonymous-attributes-proposal/19450/148?u=eary

I also mentioned a checkbox for making it output a field instead of a constant, but the reason for this thought was "connect the index to the seed is actually not ideal, since you just lose the control over the seed by doing that." For example, you want two different random floats but their max and min are the same range, you would still need to manually change seed, and if you hide the seed value, that's more of a pain in this situation.

I would suggest instead of hiding the seed value after checking the box, simply change the value from the seed itself to a "Seed Offset" after "Auto Seed" is checked, so it would be a field output that would have different seed based on the index, and the user can still control the seed's offset in an intuitive way.

If you think the naming to be confusing, then we can have the logic of seed offset under the hood but have the UI be, like the seed input would jut stay being displayed as seed, the checkbox can be named "Field", or if you are not comfortable exposing the field term in the interface, maybe "Constant" and have it checked by default. Once you uncheck it, the node will auto seed it under the hood and outputs a field. The seed input would just stays the same in the UI while actually being an offset of the actual seed. If you don't like the checkbox to be named "Constant" then we can figure something else but the central idea is the seed offset.

> In #91373#1220171, @CharlieJolly wrote: > - Add a checkbox for Auto seed which hides seed value (uses a seed based on some derived value) I like the checkbox but not sure about hiding the seed value. I previously discussed this in the devtalk thread: https://devtalk.blender.org/t/fields-and-anonymous-attributes-proposal/19450/148?u=eary I also mentioned a checkbox for making it output a field instead of a constant, but the reason for this thought was "connect the index to the seed is actually not ideal, since you just lose the control over the seed by doing that." For example, you want two different random floats but their max and min are the same range, you would still need to manually change seed, and if you hide the seed value, that's more of a pain in this situation. I would suggest instead of hiding the seed value after checking the box, simply change the value from the seed itself to a "Seed Offset" after "Auto Seed" is checked, so it would be a field output that would have different seed based on the index, and the user can still control the seed's offset in an intuitive way. If you think the naming to be confusing, then we can have the logic of seed offset under the hood but have the UI be, like the seed input would jut stay being displayed as seed, the checkbox can be named "Field", or if you are not comfortable exposing the field term in the interface, maybe "Constant" and have it checked by default. Once you uncheck it, the node will auto seed it under the hood and outputs a field. The seed input would just stays the same in the UI while actually being an offset of the actual seed. If you don't like the checkbox to be named "Constant" then we can figure something else but the central idea is the seed offset.
Member

Added subscriber: @SimonThommes

Added subscriber: @SimonThommes
Member

Following the outcome of the design discussion:
I didn't have a chance to participate myself and am largely happy with what was decided.
There is one thing I do want to point out though that I would really change about the node and that is the naming of the seed inputs.
The decision was to call them Seed 1 and Seed 2, while seed 1 is prepopulated with the Index field as default.

  • because of this difference in the default the two inputs (while holding the same potential functionality) are semantically different, in my opinion
  • there is a good reason why the first seed is using the index seed as a default and it is very useful to communicate this reason with appropriate naming
  • due to the fact that the first seed is using the Index field by default it will look and behave differently in the UI, as it is marke as a field socket and has no input slider
  • most users that are not very experienced with procedural systems or programming will have a hard time making the direct connection between a
  • it is argued that the Stable ID naming of the point distribute node output makes its functionality clear enough to not default to a stable id in the random value node. the same naming logic should apply here, in my opinion

For all of those reasons I propose to call the first seed input ID instead. That marks it clearly as an identifier, which it is. Same ID results in same random value. And it does not narrow it down do be an index or an integer, so it is general enough. But it communicates much more clearly how it is utilized (by default).

Following the outcome of the design discussion: I didn't have a chance to participate myself and am largely happy with what was decided. There is one thing I do want to point out though that I would really change about the node and that is the naming of the seed inputs. The decision was to call them `Seed 1` and `Seed 2`, while seed 1 is prepopulated with the Index field as default. - because of this difference in the default the two inputs (while holding the same potential functionality) are semantically different, in my opinion - there is a good reason why the first seed is using the index seed as a default and it is very useful to communicate this reason with appropriate naming - due to the fact that the first seed is using the Index field by default it will look and behave differently in the UI, as it is marke as a field socket and has no input slider - most users that are not very experienced with procedural systems or programming will have a hard time making the direct connection between a - it is argued that the `Stable ID` naming of the point distribute node output makes its functionality clear enough to not default to a stable id in the random value node. the same naming logic should apply here, in my opinion For all of those reasons I propose to call the first seed input `ID` instead. That marks it clearly as an identifier, which it is. Same ID results in same random value. And it does not narrow it down do be an index or an integer, so it is general enough. But it communicates much more clearly how it is utilized (by default).
Contributor

In #91373#1224666, @SimonThommes wrote:
The decision was to call them Seed 1 and Seed 2, while seed 1 is prepopulated with the Index field as default.
...
For all of those reasons I propose to call the first seed input ID instead. That marks it clearly as an identifier, which it is. Same ID results in same random value. And it does not narrow it down do be an index or an integer, so it is general enough. But it communicates much more clearly how it is utilized (by default).

I like it. So there will be an ID input that has Implicit index field, and a Seed input with a slider. This sounds good.

> In #91373#1224666, @SimonThommes wrote: > The decision was to call them `Seed 1` and `Seed 2`, while seed 1 is prepopulated with the Index field as default. > ... > For all of those reasons I propose to call the first seed input `ID` instead. That marks it clearly as an identifier, which it is. Same ID results in same random value. And it does not narrow it down do be an index or an integer, so it is general enough. But it communicates much more clearly how it is utilized (by default). I like it. So there will be an `ID` input that has Implicit `index` field, and a `Seed` input with a slider. This sounds good.
Author
Member

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Jacques Lucke self-assigned this 2021-10-15 15:15:20 +02: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 project
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#91373
No description provided.