VertexIndex To Color Channel
This example has been updated for Genome Beta 3 to use FaceCornerIndex in place of VertexIndex
When iterating in "CUSTOM FACE VERTEX" mode, the FaceIndex channel will contain the index of the mesh/map face being processed, the FaceCornerIndex channel will count from 0 to 2 for each face in the face loop, and the Index channel will be the iteration counter which could be expressed as (FaceIndex*3+FaceCornerIndex).
This means that we could use the VertexIndex channel to assign specific values to the three vertices of each face. In the following examples, we will set the Color channel, but the same could be done with all 100 mapping channels to produce the equivalent of "Face Mapping" coordinates...
- Create a Plane primitive with a size of 100.0x100.0 units and 10x10 segments.
- Add a Genome modifier to the Plane, set to "Face Corners" iteration mode.
- Open the Magma editor and press Ctrl+[O] to create a new Output node; set it to Color channel.
- Select the Output node and press [L] and [M] to connect a Mux operator to the output.
- Set the Number Inputs option of the Mux to 4 (3 data inputs and a Selector input)
- Press SHIFT+ to connect a Red color to the first input socket.
- Press SHIFT+ to connect a Green color to the second input socket.
- Press SHIFT+ to connect a Blue color to the third input socket.
- Press [I], then [C] and select FaceCornerIndex to create and connect as the Selector socket of the Mux operator.
- Select the Plane, right-click, Object Properties, and check the "Vertex Color Display" option. Press OK to close the Object Properties dialog.
RESULT: Each face of the Plane will now show a red-green-blue color gradient.
Flipping The Color Order On Every Nth Face
We can produce more interesting patterns by flipping the color order of every second face (in cases of Primitives where faces are ordered, like with the Plane here).
- Select the Mux operator and press [L] and [W] to insert a Switch operator.
- Select the Mux again and press Ctrl+[C] to Copy to the clipboard.
- Press Ctrl+Alt+[V] to paste the Mux as a copy while preserving its input connections.
- Press Ctrl+[W] to swap the first and the second input sockets.
- Connect the output of the copied Mux to the second input socket of the Switch.
- Select the Switch and press [I], [C] and select "FaceIndex" from the list (it has no shortcut).
- Press [A] and [M] to insert a Modulo operator.
- Press  to connect an Integer InputValue with value of 2 to the second socket of the Modulo operator.
- Rename the Integer InputValue to "Pattern" and check the "Exposed" option.
RESULT: Every second face will now have the color order GREEN,RED,BLUE instead of RED,GREEN,BLUE and will produce a different pattern (left image). Changing the Pattern value to 1 (right image) produces a similar image as in the first example, but with the red colors meeting at the center of each quad:
Here is the Pattern 3 result:
Reconnecting the Mux to use only two colors - first Mux as RED,BLUE,BLUE, second Mux BLUE,RED,BLUE and setting the Pattern to 2 produces the following: