Share

Geometry Basics

In this topic, you learn how to create a MCG geometry tool which generates a staircase.

  1. Open the Max Creation Graph Editor: Scripting > Max Creation Graph Editor

  2. Add a Output: Geometry node to the graph, either by pressing the X key, typing its name and pressing enter, or by dragging it from the Operator Depot under Outputs > Tools. This is the terminal node of the graph, which places the tool under the Create Tab > Geometry > Max Creation Graph button list.

  3. For this staircase, we'll want to control the total number of stairs with a Tool Input: Integer node (Inputs > Tools). This input will appear in the geometry's rollout as the "Count" spinner.

  4. Connect the "Count" input to a Array of Floats Inclusive operator (Array > Generation). This will generate an array of decimal values between 0.0 and 1.0 inclusively. Since our "Count" value is 16 by default, the array of floats will be the following 16 values: [0, 0.067, 0.133, 0.2, 0.266, 0.333, 0.4, 0.467, 0.533, 0.6, 0.667, 0.733, 0.8, 0.867, 0.933, 1.0].

    Tip: Generating values between 0.0 and 1.0 is usually a good way to start tools which repeat something over a given range.

  5. Next, we want to specify the overall range and height of the staircase. For that, we'll use two Tool Input: Float nodes. Connect these into a Vector from XZ (Math > Vector).

  6. To sample this vector as a sequence of intermediate values, connect it to a Multiply Vector (Math > Vector), and connect the value input to the Array of Floats Inclusive. Notice that connecting an array of floats into the Multiply Vector's value input promoted the node's output into an array. This is a "Mapped Connection", which acts as a shortcut to using the "For Each" node.

  7. Now that we have a sequence of positions from [0,0,0] to [Range,0,Height], the next task is to define a mesh which will act as a single stair in the staircase. Use a Tool Input: Vector to define the X, Y, Z dimensions of the stair, then split the vector into its components with Vector X, Vector Y, and Vector Z (Math > Vector). The stair's mesh is created using a Box Mesh Primitive (Geometry > Mesh > Primitives).

    Note: Make sure you correctly connect the X component to the width, the Z to the height, and Y to the depth.

  8. To place the mesh at each position, connect it to an Offset Mesh operator (Geometry > Mesh). Connect the vector input to the Multiply Vector's output. This mapped connection now generates an array of meshes, one for each stair.

  9. To convert the array of meshes into a single mesh, use the Attach Meshes operator (Geometry > Mesh). This lets you connect the result to the terminal Output: Geometry node.

  10. Press CTRL+S (or File > Save As...) to save the graph.

    • Set the Tool Name to "Stairs" in the Graph Properties dialog, and press Save As.

    • Save your graph to the default Tools location (your user profile /Autodesk/3ds Max 2018/Max Creation Graph/Tools folder).

  11. Press CTRL+E (or Build > Evaluate) to evaluate the tool and register it into 3ds Max. The Message Log should indicate that the tool was successfully evaluated.

  12. Go to Create Tab > Geometry > Max Creation Graph and click on Stairs. Click on the grid in the viewport to create the geometry. You can now modify and animate its values.

    Note: By default, geometry tools appear under Max Creation Graph, however you may change this by modifying the Category in the tool's Graph Properties dialog (Edit > Edit Graph Properties...). Setting a tool's category to My Tools will place it under My Tools in the Geometry drop-down.

Was this information helpful?