Genome
RSS< Twitter< etc

<< Selection Modifiers

Select Vertex By Normal

Soft-Selection By Dot Product With Object Z

The following is a very simple example of a selection modifier which is currently not available in 3ds Max.  

  • Create a Geosphere primitive with 20 segments
  • Add a Genome modifier to the stack
  • Press the "Open Magma Editor" button
  • Press Ctrl+[R] to toggle on the Auto-Reorder Mode.
  • Press Ctrl+[O] to create a new Output channel, change the channel name to Selection.
  • Select the Output node again and press SHIFT+[N] to create a Normal channel input. Note that this is the Vertex Normal channel calculated by 3ds Max from the Face Normals and Smoothing Groups.
  • With the Normal input node still selected, press the [.] (period key at the bottom keyboard row) to insert a VectorDot operator
  • With the Dot operator selected, press SHIFT+[3] to create a Vector with value of [0,0,1] 

RESULT: Since the output of a Vector Dot operation is a floating point value between -1.0 (vectors pointing in opposite directions) and 1.0 (parallel vectors), the Vertex Soft Selection channel of the Geosphere will be set to values between -1.0 and 1.0 (left image).

To visualize the effect of the Genome modifier beyond the colors of the vertices, add a Push modifier to the stack and play with the Push Value spinner. The right image shows a Push with Value of 30.0:

 

Soft-Selection By Absolute Value Of Dot Product

3ds Max does not visualize Soft-Selection values outside the 0.0 to 1.0 range, but the Vertex Weights channel that stores them supports arbitrary floating point values.

We can turn the negative values into positive ones and thus produce symmetrical selection on both the +Z and -Z side by simply adding an Abs operator. 

  • Select the VectorDot operator in the flow
  • Press [A] and then [B] for Arithmetic > Absolute - a new Abs operator will be inserted 

RESULT: The Push modifier now affects both sides of the Geosphere identically. 
The left image shows the selection without the Push. The right image shows a Push with Value of 30.0:

 

Soft Selection Using Curve

It is very easy to remap the incoming value between -1.0 and 1.0 to a different value using the Curve operator.  

  • Select the Abs operator and press Ctrl+[P] to pass through (turn it off).
  • With the Abs operator selected, press [F] and then [U] to insert a Curve operator.
  • Press the "Open Curve Editor" button - a new floating dialog with the Curve controls will appear.
  • Enter -1.0 in the Min.X spinner to operate on the whole range of the input value.
  • Insert a new Bezier-Corner point in the curve and set its X to 0.112 and its Y to 0.0
  • Adjust the other two points to approximately the positions and tangents shown in the following screenshot: 

RESULT: The Soft-Selection of the Geosphere will now be mapped from the range -1.0 / 1.0 to the values specified by the Y axis of the Curve operator. With a Push modified set to 30.0, you should get something that looks like an achorn:

Hard Selection Using Dot Product And Threshold

So far, we used the Floating Point output value of the Vector Dot Product to set the vertex Selection channel, resulting in a Soft Selection. Let's introduce a Threshold and a logical comparison to select only vertices with normal above or below a specified value. 

  • Select the Curve operator and press [<-Backspace] to remove it while preserving the flow.
  • Select the Abs operator in the flow and press Ctrl+[P] to enable it again.
  • With the Abs operator still selected, press [L] and [G] to insert a Greater Logic operator behind it.
  • In the UI of the Greater operator, press the "Convert To Float" button to insert a ToFloat operator since logical operators produce Integers but Vertex Selection expects a Float.
  • Select the Greater operator again and press Ctrl+[1] to create a 1.0 Input Value.
  • Rename the node to "Threshold" in the "Name and User Notes" rollout.
  • Click the "Exposed" checkbox in the "Input Value" rollout.
  • Play with the spinner value 

RESULT: The selection is now either On where the Dot Product is greater than the Threshold, or Off where it is less. The left image shows the selection without a Push modifier, the right image shows the effect of Push with value of 30.0:

To select only the one side of the Geosphere, you can simply select the Abs operator and press Ctrl+[P] to disable it and pass-through the Dot product result to the Greater operator.

Switching The Threshold Test Between "Greater" And "Less Or Equal"

Right now, our modifier only tests for normals whose Dot product with the Z axis vector is greater than the Threshold. Let's add an option to switch between "Greater" and "Less Or Equal" modes. 

  • Select the WIRE coming out of the Greater node and press [L] and then [W] to insert a Logical Switch into the flow. Note that selecting the Greater node itself will not insert the new node but split the flow, assuming the Greater is the control value of the Switch and not its first input.
  • Select the Greater operator and press Ctrl+[C] to copy it into the Windows Clipboard.
  • Press Ctrl+Alt+[V] to paste the node while preserving existing inputs.
  • Switch the type of the copied node to LessOrEqual.
  • Connect the output of the LessOrEqual operator to the second input socket of the Switch.
  • Select the Switch and press [0] (zero on top keyboard row) to create an InputValue:Integer with value of 0.
  • Enter "Greater" as the name of the InputValue.
  • Check the "Exposed" checkbox of the Integer input - it will be exposed as a Checkbutton in the 3ds Max Modify Panel.

RESULT: Using the checkbutton, you can now switch between LessOrEqual mode (left image, checkbutton unchecked), and Greater (right image, checkbutton checked).

 

Using Arbitrary Reference Vector

So far, we used the Vector with value of [0,0,1] to calculate the Dot product with the Vertex Normals. We could change the InputValue:Vector node to any value, but it is important to remember that the Vector Dot product operation expects Normalized vectors. 

  • Select the Vector InputValue and check the "Exposed" checkbox.
  • With the Vector still selected, press [V] and [N] to insert a Vector > Normalize operator after it.
  • Play with the 3 components of the InputValue exposed in the Modify panel  

RESULT: The reference vector is in object space and affects the result of the Dot product operation. Note that you can enable Auto Key mode and animate the value for dynamic results which is not possible using the sipping 3ds Max tools!

You can add a Relax modifier with value of 0.5 and 50 iterations to smooth out the selected and pushed out ring of vertices.

Then on frame 0, enter [1.0,0,-1.0] for the Reference Vector - you should get the result shown in the left image. Then go to frame 100, enable Auto Key and enter [0.0,1.0,1.0] in the Reference Vector - you should get the result shown in the right image:

 

Play back the animation to see the selected ring moving around the unselected sphere.

Using Helper Object Axis As Reference Vector

Instead of entering the Reference Vector in an Input Value node, we can query the Z axis of a scene object. This will make the animation of the effect even easier since we could just pick any object to acquire the value. 

  • Select the Vector InputValue used as reference and change its type to InputObject.
  • Create a Point helper in the scene and pick it as the reference object in the InputObject node.
  • Select the InputObject node and press [O] and [E] to insert an Object > PropertyQuery operator.
  • The default output is set to Pos, but we will want the object's Z axis. 
  • Enter transform.row3 in the text field below the list of outputs and press Enter.
  • Select the Pos entry and click the Remove... button - the first output will now be the Z axis.
  • Animate the Point Helper as you want 

RESULT: The Reference Vector is now taken from the Z axis of the Point Helper.

 

 

Related Video:

 

Next Topic:

Select Faces By Area