Node Expressions
Update 19-May-2022
Uploaded a patched version (MathsExpressionBlender28.2.02-beta_2022-05-19_3.1+.zip) for compatibility with Blender versions 3.1 and 3.2 in Shader and Compositor and Geometry node editors along with presets specific to each node tree type, test presets, and the ability to easily convert a preset node expression into a text block to allow editing.
Tangle of Nodes
Node trees can be a complicated business - especially when trying to construct complex mathematical functions. One wrong link between nodes can really ruin your day. This is where Node Expressions helps cut through the tangle of noodles - what could be finer than simply typing your mathematical expression and have the hard work of building the node tree done for you.
Fast and easy
With Node Expressions you'll no longer spend time trying to track down that incorrectly linked maths node - you won't even need to fiddle with those nodes at all. Simply add a new Maths Expression (available via the Add menu in Node Editor), type your equation into the text box and the addon creates a new node group containing all the required maths to produce that function - whether it's something simple such as a node to sum 5 inputs ("a+b+c+d+e"), a node to simultaneously return the Maximum, Minimum, Sum and Product of some inputs ("Maximum=max(Value1,Value2), Minimum=min(Value1,Value2), Sum=Value1+Value2, Product=Value1*Value2") or something a whole lot more complicated such as spirals and stars - all from simply typing a mathematical expression.
Versatile
Expressions can be 'simple' ("a+b+c") or more complex, automatically take care of mathematical precedence ("a+b*c" is equivalent to "a+(b*c)", for example), includes a wide range of mathematical functions (maximum, minimum, sine, cosine, tangent, modulo, absolute, etc.) as well as comparators (eg, "x=y", "x>y", "x<=y", etc.) - all of which can be combined into an arbitrarily long expression. Within the add-on, expressions can be edited and re-edited at the click of a button with automatic syntax and error checking. Furthermore, redundant inputs/outputs can be optionally automatically pruned and re-sequenced each time the expression is updated.
Expressions can be either entered directly (eg, "a+b > x*y") or can be placed in a Text block for easy editing. Expressions can include sub-expressions and when placed within a text block, expressions can include comments and additional spacing :
#Calculate distance from origin
_dist=(x**2+y**2)**0.5
#Calculate angle
_angle=atan2(y,x)
#Use the angle and distance to produce output
Output=sin(_angle*5)/2+0.5 > _dist*Scale-Offset
Entering the above text will auto-generate the following node group :
The sub-groups contain the nodes required to produce the specified functions (in this case '_dist') :
Here's the resultant node group and result :
Portable
Node groups created with this add-on are fully compatible with future versions of Blender - with or without the add-on - since once created, they are effectively a standard Blender node group. Generated node groups can be edited using the normal Node Editor within Blender and since only standard Blender nodes are used, all node groups are fully GPU compatible (unlike if the same functions had been created with OSL). Compatible with Cycles, Eevee, and can even be used for Blender Internal renderer.
Version History
Go 'Lite'
A cut-down version is available - excluding the presets, textblock editing and optimisations, while still allowing convenient creation and editing of expressions to generate a node tree. Ideal to let you create and edit mathematical expressions where you don't need the added features of the full-blown Node Expressions.
The Future
This add-on is currently provided as two separate intallation files - one for Blender versions up to 2.79 and another for Blender version 2.8 and later. Future enhancements are planned - such as extending the library of sample expressions and extending the functionality to support other functions - such as vector maths, texture nodes, etc. and more.
Note : Additional information can now be found on my blog at https://baldingwizard.wixsite.com/blog/node-expressions. The site also includes a number of tutorials which demonstrate the use of this add-on.
Discover more products like this
hexagon NodeTree math node group mathematical hexagonal nodes noodles Node Editor procedural nodegr