Node Expressions

by Balding Wizard in Materials, Shaders, Textures

Does this work with Eevee/Cycles/Blender Internal

Yes - the add-on works with Eevee, Cycles and Blender Internal

How about for Compositor nodes?

Not currently, no - although I'm looking to extend it to work for the compositor. However, in the compositor there is much less of a need for complicated mathematical node trees so this wasn't such a priority. However, if there is demand for this in the compositor let me know and I can look into supporting this.

Why two download files?

There are a number of incompatible differences between Blender 2.8 and earlier versions. The add-on is provided in two versions - one for Blender 2.8 and one for Blender versions 2.7x - simply choose the version appropriate to your version of Blender.

Is there a limit to how complicated an expression I can enter?

Effectively, no - only the natural limits of the Blender node editor. For a complicated example of what can be achieved, see the Fish Scale example in the documentation section.

Is there anywhere I can go for more information?

Yes - see https://baldingwizard.wixsite.com/blog/node-expressions for more information and tutorials.

What changes have been applied at each 'version'

The add-on is always evolving and being improved and each change is flagged with a "version number", visible in the filename of the installation file and add-on properties page in the Blender Preferences Add-ons page. The major differences and improvements are listed here :

1.33 27/08/2020
Make compatible with Blender version 2.83 (in particular, the new '4D' capabilities of the texture nodes (Noise, Musgrave, etc.)).

1.32 29/5/2020
Make compatible with Blender version 2.82 (some of the new Maths nodes functionality had broken the building of the expression).

1.31 19/10/2019

Add info popup for contact/feedback/acknowledgement.

1.30 04/10/2019
Drastically improve performance when adding a new node, implement 'image(...)' for Image Texture node, implement 'mix(fac, c1, c2)', improve changing types of output sockets (eg, when changing from 'Output' to 'Output[]'), improve options in some presets (eg, Hexagons).

1.29 13/09/2019

Implement 'include "TEXT:....' functionality to allow text to be imported from separate text blocks. This allows, for example, functions to be defined in a separate block and then used in your expression as a library.

1.28 04/09/2019
Implement 'inputs(...)' and 'outputs(...)' which specify which variables should be visible outside of the new group node - provided as an alternative to having to prefix 'internal' variables with '_'. Implement point(...) for Point Density function. Implement constants as "pi" and "e" quoted strings.

1.27 24/07/2019

Minor fixes to 'mix4' and 'hexagon' presets. Revamp processing of 'hidden' variables to avoid causing conflicts while simultaneously previewing/rendering - as part of this the node tree now contains labelled Reroute nodes for intermediate sub-expressions. Enhance node layout to improve with variable sized nodes. Amended documentation to fix typos in 'Special Variable' sections. Disable nodes for all materials while updating group to avoid conflicts with previewing/rendering to improve stability. Significant performance increase for laying out the nodes of very large node groups.

1.26 08/07/2019
Improved handling of small groups and value nodes.

1.25 06/07/2019
Added extended modes to 'voronoi' function (crackle, closest1, closest2, etc.) for Blender 2.8. Improve placing of newly added node by allowing it to be placed with the mouse.

1.24 08/06/2019
Improved 'undo' support and added 'colorramp(...)' function. Fix problem with negative 'default' values.

1.23 31/05/2019
Added 'musgrave(...)' and 'voronoi(...)' functions and sub-functions and allow sub-groups to be defined and used (see new Mandelbulb preset). Also added new presets for Normal Distribution, Blend and Spirals (2d and 3d).

1.22 18/05/2019
Tidy up opening of documentation window and grouping (group nodes now named based on sub-expression) and optimise tree by merging Value nodes into connected sockets.

1.21 16/05/2019
Optimise generated groups, fix bug in grouping

1.20 15/05/2019
Create a separate group per sub-expression to improve readability and efficiency.

1.19 30/04/2019
Added vmult and vdiv functions and refine selection of active node tree

1.18 26/04/2019
Added additional functions (noise, clamp/clip, vadd, vsub, vdot, vcross, vnorm, fract, ceil, floor)

1.17 23/04/2019
Fix bug in expressions for negative values (eg, "x/-y"), support 'special' input variables ('Input.XXX', etc.), fix bug in using Shift+A shortcut

1.16 23/04/2019
Add checking to presets build and fix problems with operator precedence

1.15 19/04/2019
Allow presets to include "options" where the user can decide which features to enable/disable

1.14 08/04/2019
Allow 'presets' to be imported directly into a text block for viewing/editing

1.13 06/04/2019
Implement 'presets'

1.12 06/04/2019
Refine checks to enable operators only if valid node tree

1.11 05/04/2019
Implement vector combine and split functionality

1.10 29/03/2019
Bug fixes, optimize generated node tree, allow expression to be sourced from text block

How do I work with Vectors

You can specify that an input is specifically a *vector* by adding a suffix of '[]'. For example, to set an output as a vector you could use 'MyVector[] = combine(x,y,z)'. You use the same method to indicate that an input is a vector (eg, 'DotProduct = vdot(InputVector[], Input.Normal)') or you can reference a specific 'channel' of a vector using '[x]', '[y]', '[z]' (although you can also use '[r]', '[g]', '[b]' or '[0]', '[1]', '[2]' for convenience).