Circle Image

Pixaflux

Tutorial Random Tiles

In this tutorial you'll learn to use the Random Tiles engine. The Random Tiles engine takes a series of images, and distributes them in a seamless tileable random pattern.

Input

Material_Stack

Output

Material_Stack

The Random Tiles engine is used by two nodes:

Assets

For this tutorial we'll a set of autumn leaves from cgbookcase.com that have been combined in a grid in PixaFlux.

autumn_leaves_4x4_ab

Random Tiles

  1. Drag the autumnleaves4x4_ab.png image into the PixaFlux graph viewport.
  2. Create a Random Tiles node Layout icon Arrow Material icon. Connect the autumn leaves image to the input of the Random Tiles node.
  3. Set the number of input tiles to 4 by 4.

Grid

The default grid distribution type places the tiles in a rectangular grid pattern.

  1. Set the number of grid tiles to 5 by 5.
  2. The scale attribute scales the tiles from the size given by the distribution. Set scale to 1.5.

Random Attributes

The Random attributes randomize the individual tiles.

  1. Set mask to 0.5 to almost half of the tiles.
  2. Set rotation to 1.0 to allow the tiles to be rotated a random value from 0 to 360 degrees.
  3. Set scale to 0.1 to scale the tiles a random value between 0% and 10%.
  4. Set translation to 0.1 and 0.1 to allow the tiles to move a random value between 0 to 10% of the size of the image.
  5. Check flip to flip a few tiles in the X axis.
  6. Set Hue to 0.02, Saturation to 0.05 and Value to 0.05 to tint the tiles with a Hue-Saturation-Value algorithm.

Poisson

The Poisson distribution type places the tiles in a random pattern that guarantees that no two tiles are closer than a defined radius. The poisson radius is relative to the size of the image, and iterations is how many times the algorithm tries to find a new placement from a previous placement before discarding it.

  1. Set type to Poisson.
  2. Set radius to 0.1.
  3. Set iterations to 100.

The Poisson distribution is affected by the random seed attribute.

Iterate

The Random Tiles engine is designed to randomize the transform and color of the tiles without affecting the current distribution. Explore with different distribution and random values and find a pattern that you like.

Resize

All attributes in the Random Tiles nodes are relative, i.e. you can find a pattern you like in a low resolution image, and then increase the output size to render a better quality image. Just keep in mind to keep the same aspect ratio, which affects the Poisson distribution and the scaling of the images.

Material_Stack

Material_Stack

Material Random Tiles

The Material Random Tiles node takes as input a material and an optional height image input to distribute and randomize the tiles. The height image is used to represent the ground where the tiles are laying on, and it provides ways to blend and deform the tiles.

  1. Create a Material Reader node Material icon Arrow Material icon.
  2. Drag the autumn leaf images and drop them on the Material Reader buttons. Set the height spinner to 0.2: Material_Stack
  3. Create a Material Random Tiles node Layout icon Arrow Material icon. Connect the autumn leaves material to the input of the Material Random Tiles node.
  4. Set the input number of tiles to 4 by 4.
  5. Set the distribution, scale and random attributes.

Stack

The tiles baker engine composes the tiles using their opacity and height values, with higher tiles occluding lower tiles. This composition can produce intersections, which can be desirable or not depending on the project. You can see in the previous image how some leaves are cutting through other leaves, which would not occur in the real world.

The tiles baker engine runs a collision algorithm on the tiles and stacks them in a way that avoids intersections. The stack attribute lowers the tiles to the ground allowing the artists to control the way the tiles intersect with each other.

These images show a side view of the tiles and how stack affects the way they intersect with each other:

Stack 0.00

Stack 0.50

Stack 1.00

  1. Slide the stack attribute from 0.0 to 1.0 and observe how the leaves stack on top of each other, avoiding intersections.

Height image input

The height image input represents the ground where the tiles are laying on. In the previous section we set the height of the tiles to 0.2. We'll add as height input a Perlin noise image that ranges from 0.0 to 1.0. The tile baker will generate an image with a height value between 0.0 and 1.2.

This image shows a side view of the ground defined by the height input image, and how the tiles are positioned on this ground.

Material_Stack

  1. Set the stack attribute to 0.0.
  2. Create a Perlin Noise node and set it as the height input of the Material Random Tiles node. For best results use as height input a seamless image.
  3. Check Auto Level to completely cover the 0.0 to 1.0 range with the noise image.
  4. Set the size of the Perlin Noise node to the same size as the output of the Material Random Tiles node (512 x 512). The Material Random Tiles node will still work if the height image has a different size, but this would affect the seamlessness of the output images.

Deform

The deform attribute bends the tiles to make them conform to the ground.

These images show a side view of the deform effect:

Deform 0.00

Deform 0.50

Deform 1.00

  1. Slide the deform attribute from 0.0 to 1.0 and observe how the leave are deformed to conform the ground.

Stack and Deform

The stack and deform attributes can be combined. This will deform the tiles and push them up to avoid collisions.