These nodes interact with the Blender project to get materials from the project (blend file), or change material slots of an object.

Screen Shot 2018-02-20 at 11.19.21

Example Usage of the Materials Nodes.

The “Materials From Project” Node has the following input:

  • Search String (Text)

Enter text here to search for materials in the project. The materials selected will start with the search string. The Following Outputs are given:

  • First/Single Material
  • Material(s)

The node will also display a notice of how many materials match the search string, if no search string is added, all project materials will be in the list. The first output will be the first, or only, material as a Generic Item, the second output is a Generic List of materials. Be careful where you plug these in, as Generic sockets are used, there being no material sockets in AN yet.

The “Materials Output” Node has the following inputs:

  • Object (Object)
  • Material Slot (Integer)
  • Input (Float)
  • Trip (Float)
  • Material 1 (Generic)
  • Material 2 (Generic)

The Object socket expects a single object of any description capable of having a material. The Material Slot socket expects a integer telling the node which material slot you wish to affect. So enter 0 here for the first slot. The Material 1 sockets expects a material from, for example the “Materials From Project” node. If these are the only three sockets linked, the node will simply assign the chosen material to the chosen material slot. If the object has no material slots, a new one is added and the material assigned to it.

The Input sockets expects a float number, the Trip socket also expects a float number. If the node also has a second material plugged into the Material 2 socket, the node will change the material slot from the first material to the second material, if the Input value is equal to, or exceeds the Trip value. If the Input is less than the Trip value, the first material is assigned to the given slot.

As you can see from the image above, a whole series of slots can be managed using a Loop Sub-programme. I am feeding the slots as a list of Integers; 0,1,2,3 – these could be put in as 3,2,1,0 – in which case the materials will be changed in reverse order. This loop has the effect of moving a different colour along a series of polygons to represent a “moving slice” effect, fed as it is by my “Multi-Channel Sequencer” Node, which is feeding the slot values at 4.6 frame intervals starting from frame 708 – more on this node in the “Generators” page.

Incidentally, the sphere in the image above has six material slots, but I am only changing the first four. The change progressively alters each socket from white to red so it looks like four equally spaced red stripes are moving around the sphere. Here is a shot from the project:

Here is a short video using the Materials Nodes to change the material slots of the disc rotating under two “mirrors” set at 60 degrees apart: