Genome Select By Texture Map
Another feature of the 3ds Max Vol.Select modifier is the ability to select vertices and faces based on a bitmap texture or a procedural map. It automatically produces a Soft-Selection based on the Mono output of the map, but provides no means to control the Soft-Selection falloff or to produce a hard-selection based on a threshold.
Genome can both replicate the functionality of the Vol.Select modifier and expand on it by allowing finer control over the Soft-Selection falloff or by providing a hard-selection threshold.
Soft-Selection By A 3D Procedural Map
The Vertex Soft-Selection by a 3D Procedural Map is very straight-forward.
Simply evaluate a TexmapEval operator with the desired map at every vertex Position and output the Mono color value as the Selection channel while in Vertex Iteration mode.
In the following example, a default Cellular map was used to soft-select the vertices.
In the second viewport screenshot, a Push modifier with a value of 2.0 was added on top of the Genome modifier to produce a displacement along the normals based on that Soft-Selection.
Soft-Selection By A 2D Bitmap Texture
In order to select vertices by a 2D Bitmap Texture, we would need to pass the correct Mapping Coordinates (for example the TextureCoord channel which represents UVW Mapping Channel 1) to the TexmapEval operator.
Unfortunately, a Genome modifier set to Vertex Iteration mode has no direct knowledge of the mapping coordinates at a specific vertex, mainly because a single mesh vertex can have more than one corresponding map vertex, depending on the face topology of the UVW Mapping channel.
Thus, we have to use a workaround by samping the mapping coordinate of the NearestPoint via a FaceQuery operator.
The result of this operation is exactly the same as the output of the 3ds Max Vol.Select modifier:
Soft-Selection Curve Control and Hard-Selection By Threshold
Now we can expand our Genome MagmaFlow to provide controls beyond what is available in the 3ds Max Vol.Select modifier.
We introduce a new Mux operator just before the Output node and pass the Mono output of the TexmapEval into its first socket, and into the second socket we pass the Mono output compared to a Float InputValue (the Threshold) converted to a Float.
A Function>Clamp operator inserted between the Float InputValue and the Greater Logical operator will ensure that when exposed in the Command Panel, the spinner will never exceed the range from 0.0 to 1.0.
An Integer InputValue into the 3rd socket of the Mux operator is then exposed in the Command Panel as a ListBox and allows the switching between the Soft-Selection and Hard-Selection modes. The names of the nodes connected to the first two sockets of the Mux operator will appear as the names of the ListBox items.
A Curve control can now be inserted between the TexmapEval and the first socket of the Mux to provide the Falloff control.
Soft-Selection Curve Examples
The following screenshots demonstrate various settings of the Curve control operator and the resulting vertex soft-selection:
Adding a Push modifier on top of the Genome modifier will displace the vertices according to the Soft-Selection. In the screenshot below, a Linear Curve Falloff was used:
The following screenshots demonstrate the Hard-Selection option using Threshold values of 0.0 (left image) and 0.75 (right image):
Switching The Modifier To Select Faces
The same flow can be easily modified to select Faces instead of Vertices. The following changes must be made:
- Change the Iterate Over option of the Genome modifier from Vertices to Faces.
- Change the Position InputChannel to FaceCenter. This will evaluate the texture map at the center of each face and select the face accordingly.
- Change the Output node from Selection to FaceSelection channel.
- Insert a Convert>ToInt operator between the Mux and the Output nodes since FaceSelection is expected to be an Integer and not a Float.
- If you want to select quads/polygons instead of triangle faces (left image), add a TurnToPoly modifier above the Genome modifier (right image)