The MCG tool set in 3DS Max allow users to create plugins of several different types. In this example we are creating a simple clone modifier.
When the modifier is added to an object the mesh is cloned n times using the Count integer value and the offset of each mesh is controlled using the Scale, Rotation and Translation spinners in X, Y and Z.
The UI (User Interface) is generated automatically when the MCG graph is evaluated but can be customized via Max Script.
Far more complex tools can be created using MCG and it is a great way to develop quickly for any type of production.
Changsoo Eun has a extensive tutorial on getting you started with installing and network deployment of MCG tools.
Lets have a deeper look at how this graph works.
The Count group contains two nodes that control the amount of cloned meshes.
Tool Input: Integer
Creates a spinner with the user can input the amount of clones.
Array of Floats Inclusive
This nodes creates an array of float values from 0 to 1. If the input integer is set to 5 it would create an array that looks like 0.0, 0.25, 0.5, 0.75, 1.0. This array can then be used to multiply positions of the cloned meshes to spread them out.
The Scale group has just the input for adjusting the overall scale of the clones.
Tool Input: Vector
The vector input creates three spinners in the UI to control X,Y and Z. The default value is set to 1,1,1 since it is a multiplier.
The rotation group controls the overall rotation of the clones.
Tool Input: Vector
Creates three spinners to control the rotation input for the meshes and outputs a Vector 3 value.
Constant value is being used to convert the vector rotations from angles to radians. You can also break the rotation into the three axes using Vector X, Y and Z nodes and then using Degrees to Radian nodes and then combining them back together again using a Vector node. This takes a lot more nodes how ever then just multiplying by 0.0174444.
The Multiply Vector node takes a Vector 3 value and multiplies it by a Float and out puts a Vector 3.
Quaternion from Euler
Converts Euler angles to a Quaternion to build a matrix with.
The Translation group controls the position of each cloned mesh.
Creates three spinners in the UI for inputting the position offset on each axis.
Array of Value
Creates an array of values vector values using the Count Integer input. The idea is we create an array of values before creating a an array of meshes.
This node isn’t needed as the Multiplier node after it could be the Multiply Vector node instead but I included it to show other methods. This node takes three inputs, X, Y and Z and outputs a Vector 3 value.
Multiplies the array of input vectors and the array that was created from 0 to 1 in the Array of Floats Inclusive and returns a new array of Vector 3 values.
The Mesh group is where the meshes are created.
Returns the mesh from the modifier stack. At this point this is a single mesh.
Translation Rotation Scaling Matrix
Builds the resulting Transform Matrix array from the Scale, Rotation and an array of Translation values. Nodes in MCG are mapped, meaning they automatically loop through if one of the inputs is an array. An array of Transform Matrix values is returned.
The Transform Mesh node takes two inputs, the incoming mesh and a Transform Matrix. In this case there is only one mesh coming in but an array of Transform Matrices. Once again the node is mapped and loops through all the array of matrices and builds a mesh for each one.
Attach All Meshes
Since the modifier can’t return multiple meshes we need to attach them all together before returning the final result.
Outputs the final mesh to the modifier stack.