Welcome to another instalment of our regular tips and tricks episodes. After a run of in-depth 30 minute tutorials, this time we’re going to return to something a little more concise as we share time saving graph-snippet for mapping segments and randomizing them with individual tiles or bricks from textures..
In the RailClone 2.4 feature tour we showed how the UVW XForm operator can be used with a Random Offset and Step parameter to grab individual tiles from a texture. The problem here is that while you can enter offset values separately for both the U and V offset, there’s only one step parameter that is used for both axes. This is great as long as the texture has an equal number of tiles, but if the number of tiles is different on each axis then the textures won't align with the segments correctly. In this tutorial we use multiple UVW XForm operators to separate the controls for the U and V axes. In addition, we’ll automatically adjust the segment's UVWs so that they scale to fit an individual brick to save you from having to manually adjust the UVW coordinates on the source geometry.
Building on this concept, we finish with a more advanced example that calculates the offset required to extract textures from a running bond pattern automatically. This is useful for bricks, which are often found on texture sites in this format.
As well as learning more about the UVW XForm operator, this tutorial will also provide a helpful introduction to exporting parameters and creating arithmetic relationships between properties.
By the end of this tutorial you should be able to:
The exercise files for this tutorial includes the following .max scenes compatible with Max 2010 and V-Ray
Values in RailClone can either be cumulative or non-cumulative. Non-cumulative values are always overwritten by the node wired last in the chain, whereas cumulative values are additive and the final outcome is the sum of the relevant values in all the nodes wired to the generator's input.
For example, in this node tree there are two Transform operators wired one after another. If you set a Left Padding value of 10cm in Transform operator 1, and a Left Padding value of 20cm in Transform operator 2, then the actual padding value used is 20cm. The second value overwrites the first because padding values are Non-Cumulative
On the other hand if you set a X-Fixed Transform value of 10cm in Transform operator 1, and a value of 20cm in Transform operator 2, then the actual value used is 30cm. The second and the first values are added together because transform value are Cumulative.
This tutorial exploits the fact that the values contained in the UVW XForm operator are cumulative, so we can use two or more UVW XForm operators to control the U and V offsets, step values and more separately.
Non - Cumulative
In the first example in this tutorial we’ll extract the tiles from a texture that is 4 tiles across by 13 high:
However, rather than hard code these values, we’ll make them editable from the Parameters rollout so that other textures can be used without expecting the user to open the style editor and understand the graph. To do this we export parameters and wire them to Numeric nodes. Whenever a Numeric node is added to a graph, an entry is created in the Parameters rollout so that a value can be entered outside the style editor by the user. Let's try this:
If you've followed this successfully you now have a style that allows you to add a texture with tiles or bricks in a stack bond pattern and extract individual textures, with controls to adjust the offset and scale so that you can clip our the grout or mortar. You can check it works by applying a different material making sure you adjust the "# Tiles on U" and "# Tiles on U" values to match the new texture. The segment's UVs should be automatically recalculated to match the new bitmap. In the next section we'll adapt this idea to use a texture that has the tiles in a running bond pattern.
To extract individual brick images from a texture with a running bond pattern, we just need to extend this idea further by adding different settings to grab the bricks from even rows and different settings for odd rows.
In the image above we can see the texture used in this tutorial. The first row is offset by half a brick so we need to move to texture coordinate half the step distance along the U axis to compensate (shown in red). Because this coordinate change will only work when the bricks are offset, we double the V Step value to pick only the odd rows. This means you now have only whole bricks, but we're missing the even rows show in green. To get the textures from the even rows, we need to create a separate UVW XForm map that moves the UV coordinates up one brick on the V axis. Because it's still using the same step value as the odd rows, this will also sample two rows apart and grab the bricks from the all even rows.
Let's put this idea into practice:
That completes the setup, this node tree looks confusing at first site but it's a good demonstration of how you can use arithmetic operators to create complex relationships between nodes in RailClone. The good thing about this setup is that you only have to do it once. Now you have this node graph you can copy and paste it into any style where you might want to sample parts from a tiling texture. And because we've exported so many parameters, it's easy to adjust them directly from the modify panel without needing to open the style editor and alter the graph.
Using these technique you should be able to use the UVW XForm operator to help extract regularly spaced elements from tiling textures and minimise the amount of work you have to do slicing and preparing your maps in Photoshop. Of course for some uses you don't need to use step values at all, and you can randomise within the full range of the UV Offset and Rotation values for each segment to create nearly limitless variation. This is much simpler, often requiring only a single node, to see how it's done, check out the RailClone 2.4 features tour video for an example.
Stay tuned for future training, or for more information about many aspects of RailClone's features please see our reference section or visit the