Learn new skills with our bite sized lessons
3DS Max 2011, RailClone Pro, RailClone Lite
For some styles it is necessary to create numbers that increment for each segment. In this Tips and Tricks episode we look at two ways to create sequences of numbers. The first example illustrates how to create a series of numbers by cycling through geometry. In the second part we manipulate a segment's material IDs to create numbers using multi-sub object materials.
By completing this tutorial you will be able to:
- Create increasing numbers using the sequence operator.
- Combine geometry using compose operators.
- Create expressions based on a segment's count on the X axis.
- Dynamically change a segment's material IDs.
- Use modulo to cycle a number through a set range.
The exercise files for this tutorial includes the following .max scenes compatible with Max 2011.
- counting_start.max The starting file if you want to follow the tutorial.
- counting_end.max The result of the completed tutorial
- lockers.max A locker style that counts segments in a 2D array (V-Ray only)
Counting using Geometry (RailClone Pro only)
This example illustrates how to create 3D numbers that increment on each segment along the length of a single spline. RailClone is not able to access the parametric properties of the source geometry directly, so to create this style it's necessary to create 10 number meshes that will be switched as the segment count increases. To create this style follow these steps:
The node tree for this style.
- Create ten number meshes from 0 - 9 and add them as segments to a new RailClone object.
- Wire these to a new Sequence node.
- The next steps depend on the maximum size of the number you intend to create, but we'll assume it's three digits. We need to duplicate the sequence operator so that there's one for each digit, rename them 0s, 10s, and 100s.
- Connect the three Selector nodes to a Compose operator in the order 100s,10s,1s. Wire the Compose operator to the Default or Evenly input of an l1S generator.
- Next we need to ensure the numbers at each position increment in the correct way. In the 10s Sequence operator's properties, increase the Count to 10 for all the segments.
- In the 100s Sequence operator properties, increase the Count to 100 for all the segments.
- This should give you geometry that counts up as the segments increase.
Counting using Material IDs(RailClone lite compatible)
As an alternative to using geometry, it is also possible to create numbers by controlling material IDs. For this to work it's necessary to create a Multi-Sub Object material that has the numbers 0-9 in the material ID slots 1-10.
The material setup for this style
With this done it is possible to use RailClone to change the material IDs on a segment's geometry to match its current count on the X axis. To create this effect follow these steps:
The node tree for this style.
- Create an object that has 3 material IDs (1 to 3), one for each number. UVW map the object so that each ID fits a single number map. Add this to a new RailClone object.
- Create 3 Material operators, each one targeting one of the 3 IDs created in the first step. Wire them in sequence and attach the segment to the last one. For each material node Export the From and To values and rename the nodes 1S, 10s, and 100s.
- Add a new arithmetic node and create a custom expression. For a 3 digit number we need to divide the segment's index by 1,10, and 100 to calculate the values required to reconstruct the number. For the 100s enter mod(SegmentXCounter/100,10)+1
SegmentXCounter returns the number of the current segment in an array on the X axis. It is also possible to count a segments position on the Y Axis using SegmentYCounter.
- Wire this arithmetic operator to the 100sMaterial operator's From and To inputs.
- Create a new Arithmetic operator and wire to the From and To inputs of the 10s Material node. Enter the custom expression: mod(SegmentXCounter/10,10)+1
- For the remaining material operator create a new Arithmetic node and enter mod(SegmentXCounter,10)+1 as a custom expression.
- This should give you geometry that counts up as the segments increase. If you want to start at a different number just add an amount to the equation, e.g. mod((SegmentXCounter+400)/100,10)
These lockers use the same technique to count segments in a 2d array
This tutorial outlined techniques for creating counting numbers on a linear array. The same approach can also be used to count the segments in a two dimensional array. For this to work it is necessary to work out in advance the number of segments present in a full row. This is easily calculated by dividing the length of the X Spline by the segment's width like so:
XSplineLength/[segment's width]. (there is no segment width variable, this can be hard coded or entered as a Constant or Numeric node.
Now multiply this by the segment's Y Spline count and add the current X Count value to get the segment's number in the 2d array:
This can then be used with the equations illustrated above to get the material IDs for 1s,10s, and 100s, for example:
In the downloads for this tutorial you will find a file called locker.max that uses this technique. Stay tuned for future training on expressions, or for more information about many aspects of RailClone's features please see our reference section or visit the tutorials page for more Tips & Tricks videos and in-depth tutorials.