Procedural Archimedean Spirals in Blender – Part 2: Creating a node group


In a previous post I developed a material that has a spiral pattern. In this post, I convert that material’s spiral nodes into a node group. The tutorial was prepared using 2.79b but the texture will work in any version of Blender that supports the math node and node groups.

We’ll clean up the material, making it more suitable for creating a node group. We’ll create the node group. We’ll incrementally improve the interface and layout of the group. In the end we’ll have a node group that provides a wide range of control over a spiral texture.

Clean up

Magic Constants

There are math nodes that have constants as one of their arguments. It is not apparent why they have the values they do or if they are related in any way.  Programmers call such numbers magic constants. We finished part 1 with this material.

The new Math nodes as well as the multiply Math node to the left of the top added Math node all have constant values as arguments, as does the the divide Math node below the gradient Texture node. These numbers are related to each other. Changing one without changing the others will break the spiral pattern. This addition corrects that.

Now we have a single Value node that is the source of the other constants.

Bad parameter values

If we set the new density parameter to anything that is not an integer value, the spiral will stutter Here is a render with density set to 1.5 Similarly, setting the number of arms to anything but an integer will break the spiral.

We can’t fix this, because Blender has no integer only input value, but we can work around it using the round Math node.

The node ignores its second argument, so we haven’t introduced new magic constants.  Now, any value between N-.5 and N+.5 will be rounded to the integer value N.

Separating Parameters

We can make it easier to see which nodes belong in the texture node group by moving the nodes that act as values away from the nodes that will be part of the node group. Clearly this contains all of the Value nodes. The vector that it uses to calculate should also be a parameter. Moving nodes gives us

What nodes go into the node group?

We’re creating a texture, not a shader, so the Diffuse and Material nodes are clearly not to be included. Everything else that is not a parameter, except the color ramp is required to create the texture.

Do we include the color ramp?  Normally I would not, because there is no way to control a color ramp that is in a node group, except by opening the group and modifying it.  Doing that will modify every material that uses the node group.

In this case, I’ll make an exception. The color ramp has a very specific purpose that’s unlikely to change, and there is a parameter that can be used to tweak it. The node group starts out as

and our material now looks like

This is a good time to give the node group its own unique name.

Merging parameters

Creating a node group this way has the annoying feature that parameters, in this case the Vector and spacing parameters are duplicated.  Merging those gives us

Naming parameters

The node group has several “value” labels for its parameters.  Better names will make it easier to remember what each input does.

Assigning defaults and limits

Each input parameter of a node group has default values and limits. If there are specific values that make sense, use them. Here are those for the spiral node group

Spiral parameters

Vectordefault for typeminimum for typemaximum for type
Spacing.50maximum for type
Lower Bound00maximum for type
Upper Bound10maximum for type
Groove Width.50maximum for type
Density10maximum for type
Arms11maximum for type
The default and limit values of the parameters to the spiral node group

The wording “… for type” means that that parameter is set to the value it has by default when you make the input parameter.

The default value for the Vector input is a problem.  Because it is 0, if you don’t connect a Texture Coordinate node output to this input, the node group will not produce a useful result. It would be nice to use the Object output as a default, but doing so is very difficult.

All of the parameters have maximum values of “maximum” for type. This is because there is no easy to describe upper bounds for most of these values.

The default and minimum values for all except the Vector input can be selected in ways that make sense, so they are set.


It’s a bit difficult to figure out where each connecting line goes. There are various ways to make it easier to read a node group and there as many opinions about them as there are node group developers. The one that’s right is the one that makes the group most readable to you. I like the way printed circuit diagrams look so my node groups tend to end up looking like that.

Recently I started adding labels to the reroute nodes, so my final version of the node group looks like this.

Here’s a closeup of part of the reroute



Sticking to a handful of rules about how you lay out node groups in the node editor will make it easier for you to read your own node groups later when you’ve forgotten what they do. Here is a set of rules that work for me.

  • Give the node group a meaningful name.
  • Give the input and output parameters meaningful names.
  • Set the defaults and limits on parameters.
  • Center the node group.
  • Align the nodes into evenly spaced rows and columns.
    • Use the rows to indicate flow through a section of the group.
    • Use the columns to group similar operations.
  • Use frames to visually group sets of nodes that act together to perform a function.  This tutorial describes the function step by step, so doing so is left as an exercise for the reader.
  • Use reroutes to clarify the flow.
    • Minimize connectors crossing each other.
    • Minimize connectors crossing nodes.
  • Label reroutes.
  • Use a frame containing a text to document the node group. Also left as an exercise for the reader.


I have described my usual workflow for converting a group of nodes into a reusable node group. It is only one of many. It may not be the best for you, but it can serve as a starting point.

  • Fix “magic” constants.
  • Filter parameters.
  • Separate parameters from node group.
  • Determine what nodes belong to the group and create it.
  • Merge parameters.
  • Name the node group and the parameters.
  • Give the input parameters reasonable default, minimum and maximum values.
  • Lay out the nodes within the group to make it more readable.
  • Add frames to visually group nodes within the node group.
  • Add a frame with text to document the input and output parameters

I have not described how to collect node groups into files so that you can easily add them to blend files as needed. I have a method, but it doesn’t work very well. Please comment if you have one that works well for you.

Leave a Reply