## Select Faces By Index

3ds Max ships with some Graphite tools to select face patterns, but there is no procedural (and animatable) way to do this out of the box.

Genome provides the ability to produce dynamic selections using mathematical rules. Especially with primitives where the faces and vertices are ordered, this can lead to some amazing results.

### Select Every Nth Face By Index

In the following example, we will use the Index channel to select a sub-set of faces.

- Create a
**Teapot**with**10**segments. - Add a
**Genome**modifier, set to**"Faces"**Iteration mode, make sure**"Remove Degenerate Faces"**is**unchecked**. - Press
**Ctrl+[O]**to create a new Output node. Set it to**FaceSelection**channel. - Press
**SHIFT+[I]**to create a new**Index**InputChannel - Press
**[A]**and then**[M]**to insert an Arithmetic >**Modulo**operator. - Press
**[2]**to connect an Integer InputValue to the Divisor input slot. - Check the
**"Expose"**option.

**RESULT:** Every second face is now selected (left image).

Increasing the Divisor produces new patterns, the next images show the results with values of 3, 5 and 7:

### Inverting The Selection

Right now, we are selecting all faces EXCEPT the ones whose Index Modulo produces a value of 0. To invert this, we can simply use a LogicalNot operator!

- Select the
**Modulo**operator and press**[L]**and then**[N]**to insert a**LogicalNot**operator.

**RESULT:** The selection is now inverted, selecting only the faces wholse Modulo value produces 0. Below are the results with Divisor of 3 and 5:

### Face Count Influence On The Pattern

The patterns produced by the modifier depend strongly on the topology of the geometry. In the case of the Teapot primitive, the result depends mainly on whether the Segments value is Even or Odd.

- Change the
**Segments**parameter from 10 to**11** - Set the
**Divisor**value to**3**

**RESULT:** The same modifier now produces a very different pattern:

### Selecting Two Consecutive Faces

So far, we selected/deselected only one of multiple faces. Let's expand our flow to always select two consecutive faces before skipping the rest.

- Select the
**Modulo**operator and press**[L]**and**[E]**to insert a Logical > Equal operator. - Switch the Default type from Float to
**Integer**and make sure it is set to 0 - Select the
**Modulo**operator, hold down**Ctrl**and click the**Equal**to select both. - Press
**Ctrl+[C]**to**Copy To Clipboard**and then**Cltr+Alt+[V]**to paste while preserving connections.

**RESULT: **The new cloned Modulo and Equal operators will be connected to each-other and the Modulo will be still connected to the InputChannel and InputValue nodes.

- Change the second socket's default value of the new cloned
**Equal**operator to**1**. - Select the first Equal operator (the one connected to the LogicalNot) and press
**[L]**and**[I]**to insert a LogicalOr operator. - Connect the output of the new copied
**Equal**operator to the**LogicalOr**.

**RESULT:** Now a pair of faces with a Modulo result of either 0 or 1 will be deselected, while the rest will be selected.

The left image shows Divisor of 4 with a 10 segments Teapot, righ right image shows 11 Segments:

Here is the Teapot with 10 segments using Divisor of 8 and 10, respectively:

### Selecting and Deselecting Equal Groups Of Faces

A different approach to selecting using the Index channel would be to divide the faces in equal groups - for example, select 4 and skip 4.

- Save the flow as MAXScript file using
**File>Save Flow As MAXScript** - Select the second
**Modulo,**both**Equal**operators as well as the**LogicalOr**and press**[<-Backspace]**to remove them while preserving connections. - Select the
**InputChannel**node and press**[/]**to insert a**Divide**operator. - Connect the existing
**Integer**InputValue to the**Divide**operator. - Select the wire from the
**Integer**to the**Modulo**operator and delete it by pressing**[Del]**. - Make sure the second input's default in the
**Modulo**is set to**2**.

**RESULT:** Now the modifier will select N faces (specified by the InputValue), then skip N faces.

The following images show a Teapot with 10 segments and a Divisor of 3, 6, 10 and 16:

And here are some results from a Teapot with 11 Segments, 6 and 22 Divisor value: