Products › BaseNode Packs › Texture Lab › Tutorial: Tileable stone

Tileable stone

A cobbled floor, made the way a Substance Designer artist makes one: no photo, no sculpt, a graph of generators and filters that ends in the maps a material needs. Here the graph is Blender's compositor. The texture tiles: lay it nine times on a floor and nobody finds where one copy ends.

A courtyard floor of grey cobblestones under a low sun from the right: worn, cracked stones with pebbles in the dark gaps, long shadows, two terracotta pots against a plaster wall and a wooden bench at the back
Where we are going: one texture of 1024 pixels, repeated three by three on a floor of 6 m, displaced by Cycles. Seven steps, each one a few lines more.

You will learn

Prerequisites

This page assumes you have read Lunar ground, or know the basics of a .bn file: a graph, its nodes as calls, named outputs, the pipe |>. Knowing what a height map and a normal map are helps; no Substance Designer is needed.

Before you start

You need Blender 5, the Base Node add-on, version 0.13.1 or later, and the Texture Lab pack, sold by the author of Base Node apart from the open source project: it carries the two modules this tutorial uses. The steps are free to read and to copy; the modules they call are not, and without the pack a step does not build.

ModuleComes withWhat it gives
texture_atomsTexture LabGenerators that tile: Perlin noise and ridges read on a torus, Voronoi cells on a grid that wraps, stripes, checkers, shapes, and a tile sampler that lays a shape over a grid with a seeded random offset, size, rotation and grey per tile.
texture_filtersTexture LabFilters that wrap at the borders: blurs, warp, directional warp, slope blur, edge detection, histogram scan and range, levels, height to normal (OpenGL or DirectX), curvature, ambient occlusion from heights.

Every block below is a complete .bn file, its code beside the nodes it builds. Two ways to try a step:

The scene needs nothing in it: the graph draws its texture on a canvas of its own, 1024 pixels square. Render with F12: you see the first output of the step. To see another, Ctrl+Shift+click its node in the Compositor and look at the Viewer Node image. The pictures are made from these exact files by render.py: each output written to an EXR, then shown two by two, so that a seam would show where the copies meet.

A graph that ends in maps

A material for a game or a film is a set of images that share one surface: a height, a normal map, a colour (the albedo), a roughness, an occlusion. Painting them by hand, they never quite agree. Computing them from one height, they always do: the normal is the slope of that height, the occlusion is where it is low among high, the dirt goes where the occlusion is dark.

So most of the work is the height. It is built like a sculpture in reverse: lay simple shapes, break their regularity, wear them, cut them, then level the result. Every filter reads a pixel's neighbours, and a pixel on the right border has its neighbours on the left border: the filters of texture_filters wrap, so that what tiles at the start still tiles at the end.

1. Atoms that tile

Two generators to start, the atoms of everything that follows: a fractal noise and Voronoi cells.

step1_atoms.bn: tileable_stone

Two square panels, each a texture repeated two by two: on the left a soft grey cloud noise, on the right white Voronoi cells with dark borders; no seam shows where the copies meet
Step 1. The noise (left) and the distance to the cells' edges (right), each repeated two by two: no line where the copies meet.

2. Stones laid by a tile sampler

A cobbled floor is a grid that tries not to look like one. tile_sampler lays a shape in each cell of a grid and gives each a random offset, size, rotation and grey, from a seed.

step2_stones.bn: tileable_stone

Left, a height map of domed rounded squares in rows, small round pebbles between them; right, the same stones as flat greys, one grey per stone
Step 2. The height (left) and the grey per stone (right). Still too regular: straight sides, a visible grid.

3. Warp and slope blur

Two filters that every Substance graph uses, here to take the stones out of their grid and to wear them.

step3_erosion.bn: tileable_stone

Left, the stones with bent sides; right, the same stones with soft, crumbled borders
Step 3. Warped (left), then eroded by the slope blur (right).

4. Edges, cracks and levels

Now the height is shaped: chips on the edges, cracks across the stones, a grain on top, then levels to set where the gaps and the tops are.

step4_shape.bn: tileable_stone

  1. Chips. edge_detect is 1 on the borders of the warped stones. Times a histogram_scan of the grit, only part of the borders: there the height drops a little, as if knocked off.
  2. Cracks. The cells of step 1, at 3 across: histogram_scan keeps only what is very near their edges, a thin line. on_stone, another scan, keeps the cracks on the stones and out of the gaps.
  3. Levels. in_low: 0.08 takes the bottom of the gaps to 0; gamma: 1.6 raises the mid-tones, so that the domes flatten into worn tops.

A histogram_scan is a threshold with a soft ramp: position is where it cuts, contrast how sharply. It turns any grey map into a mask.

Top left, white outlines of the stones; bottom left, thin white crack lines; right, large, the final height map of flat-topped stones with fine cracks and dark gaps
Step 4. The edges (top left), the cracks (bottom left), and the height they shape (right). The rest of the material comes from this map.

Try: set gamma of levels to 0.8: the stones round off like river pebbles. Set it to 3.0: they become flat slabs.

5. Normal maps, OpenGL and DirectX

A normal map stores the slope of the surface in colour: x to the right in red, y in green, up out of the surface in blue. height_to_normal computes it from the height, wrapping.

step5_normal.bn: tileable_stone

Two lilac normal maps of the stones: on the left the OpenGL one, its stones light on their top sides, on the right the DirectX one, light on their bottom sides
Step 5. OpenGL (left) and DirectX (right): look at the top edge of a stone, green in one, pink in the other.

6. Curvature, occlusion, colour

The height says where the material is high; two more maps say what that means for the light and the dirt, and from those come the colour and the roughness.

step6_maps.bn: tileable_stone

Four panels: top left the albedo, grey and beige stones on dark dirt; top right the roughness, white in the gaps; bottom left the curvature, mid grey with light edges; bottom right the occlusion, white with dark gaps
Step 6. The albedo and the roughness (top), the curvature and the occlusion they are made from (bottom).

7. The maps on a floor

The last step gives the five maps a material needs, and a shader group, stone_surface, that reads them back.

step7_floor.bn: tileable_stone, stone_surface

  1. Write the maps. In the Compositor, add a File Output node, give it one input per output of tileable_stone (albedo, height, normal, roughness, occlusion), link them, pick OpenEXR, 32 bits, and render once: Blender writes the five files. render.py does exactly that.
  2. Read them back. In the material of a plane, one Image Texture per map, all on the same coordinates scaled so that a tile is 2 m. The albedo is a colour (Linear Rec.709 for an EXR); the other four are data: Non-Color.
  3. Plug them in. Into stone_surface: its bsdf to the Surface of the Material Output, its displacement to Displacement. In the material's settings, set Displacement to Displacement and Bump, and give the plane enough vertices: here a grid of 900 by 900 for 6 m.

The displacement moves the vertices by the height, depth metres high: the stones stand out against the light and throw shadows. The normal map adds what the vertices are too far apart to carry: the grain, the cracks. The occlusion darkens the albedo by ao_amount, for the dirt light does not reach even where Cycles finds it lit.

The stone floor seen from straight above, lit from the right: nine copies of the texture, white marks on the gravel around it at 2 m and 4 m where the copies meet; no seam shows
Step 7, from above. The white marks show where the nine copies meet: the stones cross those lines as they cross any other.

The hero picture of this page is the same floor, from a standing eye, in a courtyard at the end of the afternoon.

The knobs

Each filter has a few inputs; these change the floor most:

WhereInputWhat it does
tile_sampler of the stonescolumns, rows, sizeHow many stones across, and how tightly they pack.
tile_sampleroffset_random, rotation_random, seedHow far they stray from the grid, how much they turn, which floor you get.
warpintensityHow much the sides bend; and the scale of wobble, how wide the bends.
slope_blurintensityHow worn the borders are.
levelsin_low, gammaHow wide the gaps, how flat the tops.
height_to_normaldepth, directxHow strong the normals, and for which engine.
stone_surfacedepth, ao_amountHow high the displacement, how much the occlusion darkens the colour.

Try: on step 7, set columns and rows of the stones to 3, and size of the pebbles to 1.0: large flagstones in a bed of gravel. Every map follows, because every map comes from the height.

Changing texture_canvas's size to 2048 doubles the detail, and the render time; the sizes given in pixels (height_blur, height_occlusion) then cover half as much of the texture, so double them too.

Take it to Blender

The finished graph, in one file. Drag the card onto Blender and keep Import into the .blend: tileable_stone becomes the scene's compositor, if it has none yet, and stone_surface comes as a shader group. A click on the card downloads the file.

The steps before it, to start again from any of them:

The files, with the script that renders this page's pictures, are in examples/tutorials/tileable_stone/.