Float Math Functions in GN and Shaders #94899

Open
opened 2022-01-14 10:51:36 +01:00 by Charlie Jolly · 10 comments
Member

Purpose of this task is to agree on how to extend math nodes in GN and Shader nodes and support float2 when it is added.

Reason: there is currently no way to run many math operations on float3 and float2 (when it is added), D13550: Nodes: Expand Math and Vector Math functions highlighted the need that there should be a design and agreement on how to do this.

Types of math operation:

  • Operations that scale to higher dimensions by component e.g. sin(), tanh() etc
  • Operations that rely on higher dimensions and are not applicable to a single float e.g. dot(), length(), cross()

User considerations:

  • Menu size, this is a problem as selecting an operation is slow. New search functionality such as link drag help
  • Power users want access to math functions on higher dimensions e.g. sign(), power(), exponent() etc...

Domain:

  • It makes more sense that GN can support more trig based functions e.g. angles, directions, intersections

Proposal:

  • In a similar way to recent changes to Map Range and Mix Node, extend existing Math node to support higher dimensions. This remains a common node for GN and Shaders.
  • Remove functions that operate on groups of floats from Vector Math node and version these to the Math node.
  • Allow Vector Math to diverge on GN and Shader.
  • Integer Math and Boolean Math remain separate nodes.
Purpose of this task is to agree on how to extend math nodes in GN and Shader nodes and support float2 when it is added. Reason: there is currently no way to run many math operations on float3 and float2 (when it is added), [D13550: Nodes: Expand Math and Vector Math functions](https://archive.blender.org/developer/D13550) highlighted the need that there should be a design and agreement on how to do this. Types of math operation: - Operations that scale to higher dimensions by component e.g. sin(), tanh() etc - Operations that rely on higher dimensions and are not applicable to a single float e.g. dot(), length(), cross() User considerations: - Menu size, this is a problem as selecting an operation is slow. New search functionality such as link drag help - Power users want access to math functions on higher dimensions e.g. sign(), power(), exponent() etc... Domain: - It makes more sense that GN can support more trig based functions e.g. angles, directions, intersections Proposal: - In a similar way to recent changes to Map Range and Mix Node, extend existing Math node to support higher dimensions. This remains a common node for GN and Shaders. - Remove functions that operate on groups of floats from Vector Math node and version these to the Math node. - Allow Vector Math to diverge on GN and Shader. - Integer Math and Boolean Math remain separate nodes.
Author
Member

Added subscriber: @CharlieJolly

Added subscriber: @CharlieJolly
Charlie Jolly changed title from Math Functions in GN and Shaders to Float Math Functions in GN and Shaders 2022-01-14 11:07:50 +01:00
Contributor

Added subscriber: @MysteryPancake

Added subscriber: @MysteryPancake
Contributor

Maybe a data type dropdown could be added to "Math", like in Map Range and Mix:

Layer 7 copy.png

It could be used to show/hide operations which only apply to higher dimensional data, such as dot(), length(), cross(), or lower dimensional data like integer operations.

This could make it possible to merge "Vector Math", "Integer Math" and "Boolean Math", since the data type could hide irrelevant operations

Maybe a data type dropdown could be added to "Math", like in Map Range and Mix: ![Layer 7 copy.png](https://archive.blender.org/developer/F12805193/Layer_7_copy.png) It could be used to show/hide operations which only apply to higher dimensional data, such as dot(), length(), cross(), or lower dimensional data like integer operations. This could make it possible to merge "Vector Math", "Integer Math" and "Boolean Math", since the data type could hide irrelevant operations

Added subscriber: @Quver

Added subscriber: @Quver

Reposting here my little feedback: Would be good to have dynamic sockets on some math operations to be able to input multiple values into one node. This would drastically reduce node trees clutter and won't take much space on the existing nodes (definitely less than using 2 nodes itself). Here is my quick mockup how that could look: math.png
+/- buttons add and remove additional sockets.
Of course those buttons will be available only on those operations where it's possible: add, subtract, multiply, divide, maximum, minimum.

Reposting here my little feedback: Would be good to have dynamic sockets on some math operations to be able to input multiple values into one node. This would drastically reduce node trees clutter and won't take much space on the existing nodes (definitely less than using 2 nodes itself). Here is my quick mockup how that could look: ![math.png](https://archive.blender.org/developer/F12805248/math.png) +/- buttons add and remove additional sockets. Of course those buttons will be available only on those operations where it's possible: add, subtract, multiply, divide, maximum, minimum.
Contributor

In #94899#1288148, @Quver wrote:
Would be good to have dynamic sockets on some math operations to be able to input multiple values into one node.
+/- buttons add and remove additional sockets.

I like this idea too, maybe using the multi-input from Geometry Join:
image.png

> In #94899#1288148, @Quver wrote: > Would be good to have dynamic sockets on some math operations to be able to input multiple values into one node. > +/- buttons add and remove additional sockets. I like this idea too, maybe using the multi-input from Geometry Join: ![image.png](https://archive.blender.org/developer/F12805256/image.png)

This looks even better (no additional buttons) but won't allow just typing numbers into the fields :(

This looks even better (no additional buttons) but won't allow just typing numbers into the fields :(
Contributor

In #94899#1288159, @Quver wrote:
This looks even better (no additional buttons) but won't allow just typing numbers into the fields :(

Ah true, nevermind, yours is much better for editing the values :)

> In #94899#1288159, @Quver wrote: > This looks even better (no additional buttons) but won't allow just typing numbers into the fields :( Ah true, nevermind, yours is much better for editing the values :)

Added subscriber: @GeorgiaPacific

Added subscriber: @GeorgiaPacific
Author
Member

Notes from 2022-10-31 Geometry Nodes Post BCON22 Workshop
https://devtalk.blender.org/t/2022-10-31-geometry-nodes-post-bcon22-workshop/26491#math-nodes-15

Math Nodes

  • Split up the math node a bit. The ideal segmentation is arbitrary.
    • We don’t want to use a node per operation because that makes switching more complicated, but the current math node has too many responsibilities.
  • Math node
    • Does generic math operations
    • Uses dynamic types
  • Vector math
    • Only does operations that make sense on vectors
  • Compare node
    • Dynamic type, generic or type-specific comparison operations
  • Needs more discussion
Notes from 2022-10-31 Geometry Nodes Post BCON22 Workshop https://devtalk.blender.org/t/2022-10-31-geometry-nodes-post-bcon22-workshop/26491#math-nodes-15 Math Nodes - Split up the math node a bit. The ideal segmentation is arbitrary. - We don’t want to use a node per operation because that makes switching more complicated, but the current math node has too many responsibilities. - Math node - Does generic math operations - Uses dynamic types - Vector math - Only does operations that make sense on vectors - Compare node - Dynamic type, generic or type-specific comparison operations - Needs more discussion
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:44:17 +01:00
Iliya Katushenock added
Interest
Nodes & Physics
and removed
Module
Nodes & Physics
labels 2024-04-07 22:50:02 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2024-04-07 22:50:07 +02:00
Iliya Katushenock removed the
Status
Needs Triage
Interest
Nodes & Physics
labels 2024-04-07 22:50:17 +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 Assignees
4 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#94899
No description provided.