The Context Index Atom 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.
This node allows us to use the context information to achieve more specific and intricate results.
To visualise the 'index context', follow these steps:
Create a Type Shape.
Add a String Generator.
Set Generator to Value.
Set Precision and Padding to 0.
Add the Text Generator to a Duplicator.
On the Grid Distribution set the Count to X = 1, Y = 10.
Create a Context Index Atom.
Connect contextIndex.id > textGenerator.number.
Nothing too unexpected there. So let's take this a bit further.
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):
Add the Duplicator to a second Duplicator.
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:
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.
Set Depth on the Content Index to 2.
The numbers now represent the index coming from Duplicator2.
Combining Context Index Atoms with a Jsmath Atom can create some interesting results.
Create another Context Index Atom.
Ensure Depth is set to 1 (default).
Create a Jsmath Atom.
Connect contextIndex2.id > jsmath.array.0 (aka 0: Number - the first input).
Set the Expression to be:
0.5 + n0 * n0 * 0.01
Connect jsmath.id to both duplicator1.shapeScale.x and duplicator1.shapeScale.y.