RailClone is easy to learn once you understand 3 basic principles. First of all, RailClone doesn’t construct an object from thin air, it works using a path to assemble and repeat existing modular pieces of geometry. To do this it needs a couple of things which we call base objects - a spline for the path and of course, some geometry.
Secondly, this geometry is assembled along a path using a set of rules defined using a Generator. Imagine you’re explaining to a manufacturer how to build this bus shelter, you might say: “Put a glass panel at the start and the end, add struts at 2m intervals, then fill in between with the roof and glazing. Oh and don’t forget to add regularly spaced chairs the full length of the shelter”
If you understand this, you understand RailClone.
Thirdly and finally, just like Max, RailClone has its own modifiers called Operators that are used to manipulate geometry. You can do things like switch between items, mirror geometry so you can reuse it, manipulate UVWs, randomise materials IDs or even create sequences, randomise geometry, create patterns along the spline and much much more.
To illustrate these basic principles and help new users get started with RailClone, our latest tutorial explains how to turn a stock bus station asset into a flexible and reusable parametric model.
We’ll start with a look at how to prepare geometry.
Before we get started, I want to mention that this is not a tutorial about how to create a bus shelter. The bus shelter is simply a good example to help illustrate basic principles. To get the most from this tutorial and aid comprehension I would strongly recommend trying to apply the techniques to different models. However, if you want to follow along all the scene files are available from the link on the left.
RailClone takes advantage of your existing modelling skills. Either by allowing to use custom modular parts that can be reassembled to create parametric objects, or simply by dividing up existing models.
We’ll do the latter, but before we do, one of the most important preliminary steps is to set the pivots on the source geometry. To do that, one must understand how RailClone aligns objects to a path.
Now it’s time to divide our stock model into pieces. To do this, analyse the model and ask yourself, “what’s the smallest number of repeatable pieces can I break this model into?”.
We need a piece at the Start, but probably not the end, since it is identical geometry just mirrored. I need a piece for the struts, and I need a piece to fill in between. But that’s it, three pieces for the shelter.
There’s no specific right way to divide up the model - you could either detach elements as we did in this tutorial or simply use Slice Modifiers to cut it into pieces.
Finally, I want to mention the materials. RailClone 3 requires you to have a single multi-sub object material that works for all of the geometry you add to RailClone. You may, therefore, need to consolidate the materials and update material IDs accordingly.
In the tutorial scene, you will also find a couple of other options that we’ll use later to illustrate some of RailClone’s other features. There are a couple of end variations, a couple of seat variations, and the material has some colour options for the chairs.
Lastly, you’ll need a spline we can use to determine the size and location of the new parametric version of the bus shelter.
From this point on the tutorial is split into 3 parts - one for each of the basic principles you need to understand become a RailClone ninja, starting with Base Objects
Now the fun starts as we move on to RailClone.
With the base object set up, we’re ready to create the recipe that tells RailClone how to assemble the model. To do this we need a rules Generator. The L1S, or linear generator is the simplest of the two found in RailClone, but don’t let that fool you, it’s enormously powerful! It has Six inputs named start, end, corner, evenly, marker and default that all simply identify different positions along the base spline on which geometry can be placed. Creating a parametric object is as simple as attaching the geometry to each of these inputs.
To illustrate, here’s how we’d recreate our bus shelter.
When starting out with RailClone, it is tempting to try to cram everything into one Generator, but in fact, it is often much much easier to spread out a style across multiple generators. To demonstrate, we will use a second generator to add the seats.
We could stop here, but let’s take our exploration of RailClone a little bit further and look at the third and final basic principle of using RailClone called Operators. As we’ve seen, operators are akin to Max’s Modifiers, in that they allow you to in some way process geometry. We’ve already used two of these: a Compose operator to combine segments, and the Mirror operator. Let’s take a quick look at several more of the most useful operators. To see how these work, check out the annotated RailClone object in the tutorial downloads called RC - Completed Style.
The Material operator allows you to choose a Material ID and replaces it with a new value. You can either choose to randomise between a range of IDs or loop through the IDs in a sequence to create repeating patterns.
To demonstrate the next operator we’ll add a couple more Segment nodes and pick some broken seats from the scene. With that done we can take a look at the Randomise operator which allows you to pick a random Segment. Each segment has a presence value that determines the probability of it being selected. These values are normalised so there is no need to ensure they add up to 100%.
You’ll notice an issue with those last seats, they’re not in the correct position because I forgot to set the pivot points. This is a good excuse to demonstrate the Transform operator which allows you to make global changes to padding, alignment, and transform settings for segments that flow through it. It’s really handy for making big bulk changes without having to enter the same settings for loads of segment nodes.
Let’s add an alternative Start segment to the graph and pick a piece with an advert from the scene. To make a kind of switch you use the Selector operator. Add one to the graph and drag it’s output to the bus-shelter-start node’s output. This will swap the wires. You can then wire bus-shelter-start-1 to the Selector operators first input, and bus-shelter-start-2 to the second. This gives you the ability to toggle between these two options using the index parameter in the Selector node’s properties. By copy-pasting the Selector node and wiring the new version to the mirror operator I have the ability to decide which piece I want to use separately for the start and the end of the shelter.
If you take a look at the advert on the end of a shelter you’ll spot a problem, because we mirrored the geometry, the poster's text is reversed. You can fix this using the UVW XForm operator which allows you to manipulate the mapping coordinates already applied to a segment. There are two modes available: Fixed mode which is pretty self-explanatory, or Random mode which shuffles within a range the tiling, offset and rotation of UVW coordinate to create unlimited variation. In this case we just want to fix this texture problem by setting the U Tile setting to -1. (I should mention that to get this generator to work with Corona you will need to disable the instancing engine from the Display rollout).
OK - But what if instead of a switch I want to create a pattern? For that, you turn to the Sequence operator. In this example we will create a pattern of glass panels with maps and glass panels without. Wire a Sequence operator to the Default input and wire the original Default segment to the first input. Wire the Segment called bus-shelter-default-2 to the second input. You will no have a repeating pattern. Of course, you can change that order simply by using the arrows on the Sequence operators. You can increase the count value of a particular input if you’d like it to display more than once.
That covers most of the regularly used parameters. One other thing I wanted to mention is the ability to add Numeric nodes to this graph which allow you to control properties directly from the Modify panel. For example, imagine that I want to be able to control the ends of the shelter without opening the graph. To do that you must expose the property by right-clicking on a node and picking Export Parameters. Select the parameters you’d like to export, in this case Index, and click OK. The node will now have a new input. If you create a new Numeric node and wire it to this property you can control this value without having the graph open. The numeric node has settings that allow you to control the type of number and set limits to constrain the range from which a value can be selected.
More or less any property can be exported and controlled from the modify panel in this way.
To wrap up this tutorial I just wanted to say a couple of words about deformation. At present this bus shelter is on a straight spline, but of course one of RailClone’s most powerful features is its ability to deform geometry to follow curved paths. Best of all, it’s as easy as just assigning the style to a curved spline!
There are also a couple of advanced modes you can use when the path isn’t planar on the Z axis that are worth a quick look. Imagine that this bus shelter is on the hilly streets of San Francisco, in that case, the default adaptive mode doesn’t look right. The shelter sticks our from the pavement at a strange angle and anyone trying to sit on these chairs will end up in a pile in the corner.
Each segment has 3 deformation modes that can be used. Adaptive is the default, but the second, called Vertical, is particularly appropriate for this example. It keeps the verticals upright while allowing it to skew the rest to follow the path.
When it comes to the chairs that won’t work either though. For the chairs you can use the 3rd options which disables the deformation completely and simple creates a stepped distribution.
Using the vertical/flat top and bottom settings it’s even possible to combine these two modes based on a distance from the base spline. We’ll cover these settings in more detail in a future tutorial.
In this tutorial we looked at the 3 basic principles of RailClone: Base Object, Rule Generators and Operators which corresponds to the 3 categories of nodes found in the style editor. Spread across these 3 categories there are in fact only 21 nodes in total to learn, and we went through the majority of those in this short tutorial! Don’t be deceived though, this handful of options belies the enormous power of RailClone to recreate nearly any object that features repeating geometry!