Learn new skills with our bite sized lessons
In this quick tips tutorial we're going to look at how to create a weave pattern using RailClone. It's a common pattern that has many applications, perhaps most usefully natural fences and baskets, but for this example we've taken inspiration from a C18 Architekten who renovated the barrel ceilings of a chapel by cladding it with woven wicker. Along the way we'll demonstrate some tricks for creating repeating patterns on the X and Y axis using sequence operators, how to mirror and reuse geometry, and how to split a style into more than one generator.
For this tutorial I'm going to borrow some terminology from cloth making. When weaving there are two types of thread or yarn Warps are vertical threads, that would normally be held in tension on a frame or loom. Woven alternately over then under these are horizontal threads called wefts. The same is true if you're weaving wicker, straw or any other materials. These two elements - warps and wefts - are what we need to simulate to create a woven style in RailClone.
As always when working with RailClone, the aim is to manually model as little as possible and for this example we could get away with only two segments, one for the horizontal weft, and another for the vertical warp. For the latter though in order to create a little more natural variation we will use 4 variations. This are very simple, created using just a spline and a Sweep modifier
For the vertical sections (warps), a simple straight spline is enough as long as there are enough edge loops so that it can be deformed to follow a curve if needed.
For different types of construction material you can easily use a different cross section with the sweep modifier, but even then this geometry is very easy to create. The only other thing to note is that the pivot on the Z axis for all the segments is positioned so that segments align correctly, and that they will tile along the X axis when mirrored and repeated.
Splines and orientation
On to the splines, as we're creating a 2 dimensional array, and because the roof will be curved on the Y axis, we need two splines. The easiest way to create splines for the A2S array is to use the top or perspective viewport. In this demo we'll create them as follows:
- Spline 1 should be straight along the X axis. This will be used to define the length of the array.
- Spline 2 should be straight along the Y axis. This will be used to define the height of the array.
The X Spline is pretty easy to understand as it defines the path of the array. The Y spline defines the shape and orientation of the array on the Y axis, and has the potential to cause more confusion. In RailClone 3 we've made this a little easier to understand - the length and path of the array on the Y axis is defined by the shape of the array as defined on the Y/Z plane. If you rotate the spline sub-object around the X axis, you will see the arrays orientation updates accordingly.
In RailClone 2 the X/Y plane was used to define the Y axis of the array and this can be a little more confusing because in order to change the orientation of the array in RaliClone 2 you would rotate the spline sub-object around the Z axis.
RailClone 3 actually has a new option that allows you to pick between the new more intuitive settings or to use the legacy behaviour if you prefer it, or you need to maintain compatibility with old styles
Creating the style
Creating warp geometry
It often makes sense to divide a style across multiple generators. In this case we'll create two, one for the vertical elements, and a second for the horizontal elements. If we were to try and combine these into a single generator the height of the warp segment would need to match the height of the weft segment which would significantly add to the number of instances produced. In addition the vertical elements would create a gap between the vertical ones,rather than allowing them to continue as though they are a single thread. By separating them into two generators, both these issues can be easily resolved.
To create the first generator:
- Create a new A2S Generator. Name it Warp.
- Create a new Spline node and wire it to the Generator's X Spline input. Go to the Properties panel, click the spline select button and pick the X Spline we just created from the scene.
- Create a second Spline node and wire it to the Generator's Y Spline input. For this one we'll pick the Y Spline.
- Create a new Segment node. Go to Properties and pick the warp object from the scene.
- Wire the Segment node to the X Evenly input. This will add vertical segments at regularly spaced intervals.
- Change the Segment's Z Alignment to Center
- The distance between warps is controlled by the Properties > Rules > X Evenly > Distance value. To make these easier to change later we can make this value accessible from the Modify panel. To do that, right-click on the generator and go to Export Parameters. Select X Evenly > X Evenly Distance and a new parameter input will appear at the bottom of the Generator node.
- Create a new Numeric node. Wire it the X Evenly Distance input and rename the node Warp Distance.If you look at the Properties rollout in the Modify panel you will see that this parameter is now accessible and can be edited without needing to open the style editor. Enter a value of 10cm for now.
Below is the finished graph for the warp elements. So far so good!
Creating weft geometry
The weft geometry needs to match the same.
- Select, copy and paste the existing generator. Because the two generators share the same spline and numeric inputs, they will always remain perfectly synced.
- Change the generator's Deform > Default mode to Scale. In this mode a single segment will be scaled between the evenly inputs.
- The warp segment is still connected to the X Evenly input. We can't just delete it because we need a segment in this input to ensure that the weft segments are scaled exactly between the evenly distances. The easy solution is to create a new Segment but don't select any geometry. We usually call these null segments and they're really useful for adding gaps or forcing RailClone to calculate certain inputs even if no geometry is present. Just wire this to the X Evenly input, replacing the existing segment.
- Create another new Segment node. To use the segment's pivot point, change the Alignment > Z property to Pivot
- You should also decide if you want the segments to deform. If X spline is straight - as in this example - I would prevent segment's from bending by going to the the Deform tab and disabling Bend. If the path is curved I would leave this enabled, but you should be aware that deformed segment's are not instanced and may increase memory usage.
- In this scene there are 4 weft objects that we'd like to shuffle. Instead of adding each one manually, right-click on the Segment and click Clone Multiple. An object picker window opens allowing you to select multiple items. Select weft 1 to 4 and click Clone. All the segments will inherit the same settings.
- To shuffle the 4 segments, create a new Randomize node and connect the segments to its inputs.
- To create the under - over - under pattern, create a new Sequence operator and wire the Randomise operator to the first input. Wire the Sequence operator to the Default input so we can see how the geometry looks.
- At the moment we're getting a stepping effect as shown below
To resolve this we need to create a version of the segments mirrored along the X axis, and then alternate between mirrored and normal versions. To do this create a new Mirror node, and wire the Randomize node to its input.
- Wire the Mirror node to the Sequence node's second input, as shown below.
- If you change the order of the inputs in the Sequence node you'll notice that the under/over pattern can be offset. This is important because we need to alternate between over and under on the Y axis as well which can be achieved by alternating between two sequence operators, one of which has had the order of its inputs swapped. To do this, clone a the sequence operator and swap the inputs. Create another new Sequence operator and wire the two existing sequence nodes to its inputs.
- Change the Increment On value for the new sequence operator to Y. Wire it to the Default input. You have no created a repeating alternating pattern on the X and the Y axis!
- Optionally you can also repeat the number of times an input is repeated. To do this, select a Sequence operator and change the Counter values, for example we can change the value to 2 for the Sequence operator that creates the pattern on the Y axis to give a different weft pattern.
- Finally you may need to adjust the Z Offset of the warp Generator to make sure it fits correctly into the gaps created by the weave pattern.
This completes the style. We can now reuse it easily by simply swapping the splines, for example to create the roof shown at the beginning of this tutorial. Fences, baskets, wicker baskets, trellis and much more can be created with this technique and the principles of combining sequence operators that increment separately on the X and Y axis really is useful for creating all sorts of repeating patterns. If you create any interesting variations on this style, or you have any renders created with these techniques we'd love to see them on our forum. Otherwise, stay tuned for our next tips and tricks installment and check out our other videos in the tutorials section of the website.