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:
The exercise files for this tutorial includes the following .max scenes compatible with Max 2011.
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.
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.
Segment Counts
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.
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:
(XSplineLength/Input1)*(SegmentYCounter-1)+SegmentXCounter
This can then be used with the equations illustrated above to get the material IDs for 1s,10s, and 100s, for example:
Mod(((XSplineLength/Input1)*(SegmentYCounter-1)+SegmentXCounter)/100,10)+1
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.