Context Index

The Context Index Utility acts as an input that only exists during the computation of the nodes. Nodes that have an input connection from other nodes may choose to provide context to these input nodes to produce different results. Duplicator is one such node, and it provides an index context to all of its inputs.

Check out the Index page for some background reading on this concept.

This node allows us to use the context information to achieve more specific and intricate results.

To visualise the 'index context', follow these steps:

  1. Create a Type Shape.

  2. Set Generator to Value.

  3. Set Precision and Padding to 0.

  4. Add the Text Generator to a Duplicator.

  5. On the Grid Distribution set the Count to X = 1, Y = 10.

  6. Create a Context Index Utility.

  7. Connect contextIndex.id > textGenerator.number.

Nothing too unexpected there. So let's take this a bit further.

Context Depth

When a node provides context, it gets added to a chain of contexts. If we have a Duplicator within a Duplicator, then the chain will contain two index contexts. What the Context Index allows you to do is choose the 'depth' of those contexts provided to other nodes.

Example (continued from the previous example):

  1. Add the Duplicator to a second Duplicator.

  2. Set Duplicator2's Grid Distribution to Count X = 5, Count Y = 1. Result: The index value travels through the second Duplicator.

Duplicator1 automatically accumulates the index from Duplicator2, which is why we get numbers ranging from 0 to 49 even though we have selected a Depth value of 1. We can change this:

  1. In the Attribute Editor, right-click on Duplicator1's header and uncheck Advanced -> Use Incoming Index. Result: The numbers now represent the index from Duplicator1.

  1. Set Depth on the Content Index to 2.

  1. The numbers now represent the index coming from Duplicator2.

Bonus

Combining Context Index Atoms with a Jsmath Atom can create some interesting results.

  1. Create another Context Index Atom.

  2. Ensure Depth is set to 1 (default).

  3. Create a Jsmath Atom.

  4. Connect contextIndex2.id > jsmath.array.0 (aka 0: Number - the first input).

  5. Set the Expression to be: 0.5 + n0 * n0 * 0.01

  6. Connect jsmath.id to both duplicator1.shapeScale.x and duplicator1.shapeScale.y.

.

Last updated