Adding shelves between rows.
As an option, you can also add shelves between rows. This would work well for objects like the tea pot or wine bottles that don't necessarily stack very safely! Here's how to do it:
- Select the Generator, Segment and Transform node and duplicate them using Copy and Paste. Disable and disconnect padding inputs. We don't need them for this part of the graph.
- In the copied Segment node, pick some geometry for a shelf. Make sure you enable Bend if you turned it off or the geometry won't deform around the spline.
- In order for the same number of shelves as there are objects, it should be the same size on the Y axis as the teapot. However we can tell RailClone what size to use for a segment without it actually affecting the geometry. In that way the shelf can be deeper than the teapot, but all of the calculations that determine spacing will assume that they are the same size. To achieve that, in the new Transform node, enable Fixed Size.
- Uncheck Scale Segment. This will stop the geometry being affected by the new size.
- Export the Y Size Attribute from the Teapot's Transform node.
- Export the Fixed Size > Y Parameter from the shelf's Transform node and connect it to the Y Size Attribute exported in the previous step.
- Next, we'll align the outside of the shelf to the outside of the teapots. To do this, first change the Y Alignment for the shelf to Bottom. Now the outer edge of the shelf is aligned to the spline and all we need to do is move it back along the Y axis the depth of the teapot. This might seem like an odd way of doing things, but it allows us to have a shelf that is deeper the teapots with everything still aligned automatically.
- Right-click on the teapot segment and export the Y Size attribute. Note that this is not the same as the Y Size attribute exported from the transform node. The segment Y Size attribute is the width of the geometry. The Y Size attribute on the transform node includes the padding values that we have added or subtracted.
- Export the Y Fixed Translation property from the shelf's Transform node. Add an Invert Value macro (which makes a positive number negative or vice versa) then wire it to the Fixed Translation property. Connect the Segment's Y Size attribute to the Macro.
- Nearly there! All we need to do now is add the thickness of the shelf into the existing stepping expression. To do this, first export the Z Size attribute of the shelf.
- Wire a new Arithmetic node between the existing Arithmetic node and the teapot Transform's Z Size property. Leave the mode set to addition.
- Wire the shelf's Z Size property to the second input of the new Arithmetic node. The size between each row is now the sum of the height of the teapot and the shelf.
- Finally, to move the teapots on top of the shelves, Export the teapot generator's Z Offset and wire if to the shelf Segment's Z Size, and we're done!
With all that work done, we have a very flexible style in which all the importance values are derived automatically from the geometry. This means that we can easily change the size of the teapots and change the depth and thickness of the shelves and the model adapts. Using our exported parameters we can also adjust the radius to match a different size spline and easily edit the amount each row overlaps.
It get's even more interesting though when you swap in different geometry. We could easily swap our teapots for pianos for example, and the style updates automatically. Don't want the shelves? No worries, just clear them in the segment's settings and the geometry is removed and the array closes up to compensate. You can even add multiple segments.
In this example several present models have been added simply by wiring several segments to a Random node connected to the Transform operator. The rest of the graph is exactly the same as this tutorial. The same is true of the tree made of wine bottles. They're added to a randomise node and in this example, a shelf is added as well.
This is the final tutorial of 2018 and so we'd like to take the opportunity to thank you for watching and we hope you'll stay tuned to plenty more episodes in the new year.