This topic describes how to create a custom box-creation tool with Max Creation Graph. You then modify the tool to position the object on the home grid. After that, you use the graph to create a compound node, which you assign to a category. You finish by packaging the tool to create a file you can distribute to other 3ds Max users.
You'll also find in this topic a number of useful tips for working with Max Creation Graph, such as how best to use folders and how to uninstall MCG tools.
Example: Get started with Max Creation Graph:
You'll start your graph at the end, with the node that generates the geometry the graph defines.
This node will generate the result of the remainder of the graph. Graphs typically flow from left to right.
Next you'll add the first node in the graph.
Parameters appear in the interface of the graph output (in this case, with the label BoxSize), and enable users of your graph to enter values in the interface. The Parameter: Single node lets the user specify a single-precision floating-point number; that is, a decimal fraction. As the designer of the graph, you can also limit user input to a specific range of values, and specify a default value.
You could keep the default value of 0.0, but it would make more sense to use a starting size that produces a visible object.
You now have the start and the end of the graph, representing input and output, respectively. All that remains is to add a processing node, and to wire the nodes together to form a graph.
The CreateBox node takes three floating-point values as inputs, and outputs a box-shaped TriMesh (triangle-based mesh) object. Thus it has three beige-colored input connectors on its left side, for the three dimensions of the box, and a single teal-colored output connector on the right side. Note that the color of the Parameter: Single node's output connector matches that of the CreateBox's input connectors, indicating that the connectors use the same type of data. Likewise for the CreateBox's output connector and the Output: Geometry node's input connector.
The result is a wire from the first node to the second. The wire uses the same color as the connectors it's wired between, and the arrow on the wire indicates the data flow direction.
The result is three wires going from the Parameter: Single node's single output to each of the CreateBox node's three inputs. This means that the one value from the Parameter: Single node will be used for all three of the box's dimensions, thus producing a cube. If you wanted to use different values, you could just add two Parameter: Single nodes and wire them separately to the CreateBox node's inputs.
The next step is to convert the raw data produced by the CreateBox node to a geometry node that 3ds Max can work with.
If you want your MCG tools to persist between 3ds Max sessions, save them in the Tools\ folder inside the Max Creation Graph\ folder. So using the preceding example, you would save it in C:\Users\Simone\Autodesk\3ds Max 2017\Max Creation Graph\Tools\.
After you save the MyBox graph, the Message Log window of the graph editor shows that validation, generation of the resultant MAXScript, and saving were all successful.
The Message Log window of the graph editor shows that validation, generation of the MAXScript file, and evaluation of the MAXScript file were all successful.
The Parameters rollout appears on the Create panel, with a single BoxSize parameter. Its default value is 4.0, which will produce a small box.
Congratulations: You've just created your first MCG graph!
To remove an MCG tool from the interface, first exit 3ds Max, use a file browser to navigate to the Tools\ folder and delete the files that use the file name for the tool. In this example, you would delete MyBox.maxtool, MyBox.ms, and MyBox.txt (the latter file is created the first time you use the tool). Copy the files to another folder outside the Tools\ folder as a backup, then delete them from the Tools\ folder and restart the program.
Create the box on the home grid:
In the preceding procedure, you learned to design a graph that creates a resizable cubic box. You might have noticed that, unlike the standard Box primitive, the procedural-content box sits not on the home grid but is centered on it vertically, so that half of it is above the grid and half is below. In the next procedure, you'll add logic to replicate the standard Box primitive creation process more closely, creating an object that sits on the grid rather than in it.
One way to reposition the box is with an offset-type node.
You'll use this node to reposition the mesh on the Z (vertical) axis.
Compounds can even be nested. The OffsetMesh graph contains another Compound: DeformMeshPoints.
At this point, you could wire the OffsetMesh node to the CreateBox and Output: Geometry nodes in two different actions, but instead you'll use a shortcut.
MCG automatically inserts the new node between the two existing ones, using the correct TriMesh connector types on both sides.
The other OffsetMesh node input (orange connector) is OffsetVector, which lets you specify the object offset in three dimensions, and thus requires a Vector3 input type. In the next step, you'll use a convenient feature to add the requisite node without having to find it in the Operator Nodes list.
A small search list opens next to the mouse cursor, with a list of nodes that have output connectors compatible with the Vector3 input connector type. Most of these have output types Any, which is compatible with most other types. In this case, we'll use a connector directly compatible with the Vector3 input.
MCG narrows down the available choices to nodes that start with "V".
The new Vector3 node appears in the graph, wired to the OffsetMesh node's OffsetVector connector.
Next you'll provide value inputs for the Vector3 node. You'll be offsetting only the Z-axis position, so you can simply set X and Y to 0.
Also, the Constant node's output connector is green, indicating that it is of type Any. This means that it can output any type of numeric value (integer, float, and so on) and is compatible with all input connectors that require numeric values.
Next you'll use a simple calculation to specify the Z value. By default, the box is positioned halfway down into the home grid, so you want to raise it by half its height. You'll calculate the offset with division, using an arithmetical node.
Divide has two inputs of type Any: X is the numerator and Y is the denominator. In other words, the output of Divide is the X input divided by the Y input. You already have the numerator: BoxSize.
You'll need another Constant node for the denominator. You can create this by cloning the existing Constant node.
At this point, your graph might be a bit messy; this is easy to fix.
This straightens up all the nodes.
This replaces the MyBox tool on the Object Type rollout of the Max Creation Graph category.
Now when you adjust the BoxSize value, the bottom of the box stays on the grid.
Create a compound node:
A compound node is a self-contained node built up from other nodes. In a sense, it's a "black box" whose inner workings are hidden, by default, from authors who use it. Once you've created a compound, you can save time by using it in graphs in the place of the graph it contains.
Because a compound doesn't work as a complete graph, it's necessary to replace two nodes.
You'll start by replacing the Parameter node at the start of the graph with an equivalent Input node. That way the input value (BoxSize) will be provided by the graph of which the compound is a part, rather than from within the compound.
Similarly, you'll replace the current Output node with one designed for sending data out of a compound node.
Next you'll save the compound using a special file format in a dedicated location. But first you'll specify where it appears in the Operator Nodes list.
The Graph Properties opens, with various fields you can use to describe the graph. The one you'll use in the next step is the Category field, outlined in the following illustration.
This adds the MyBox operator to the Geometry - TriMesh category.
A new, empty tab labeled "Untitled" opens.
The input connector uses the BoxSize label you entered in the Input: Single node.
Create, install, and uninstall a Max Creation Graph package:
A Max Creation Graph package is a self-contained software component that any Autodesk 3ds Max 2017 user can install and use without necessarily being familiar with its inner workings. For example, if you design a graph to create a particular type of procedural object, such as a chair with customizable features, you can then use this facility to distribute the graph to the rest of your team so they can create similar types of objects.
For best results, save the file in the default folder ([install drive]:\Users\[user name]\Autodesk\3ds Max [version number]\Max Creation Graph\Packages\) and have teammates to whom you distribute the package file place it in the analogous location on their machines.
In the next step, you'll simulate the process of installing a tool by a teammate. There's no need to use the graph editor for this process.
An alert opens with the information that the installation succeeded. Click OK to continue.
The SimpleBox tool appears on the Object Type rollout.
Last, you'll learn how to uninstall a package. There isn't an official "Uninstall" function, so you'll use an alternative method.
If you can't find this folder, just search your system for filenames analogous to those in the next step.
The previously installed package is no longer available. You still have the tool file, so it's a simple matter to reinstall the tool if necessary.