Sub topic 5
The Voronoi Texture Node: Features, Distance Metrics, and Randomness
This chapter assumes that you can navigate Blender’s Shader Editor, connect nodes, and use the Principled BSDF shader. You should also know the difference between UV coordinates and 3D coordinates. The goal is to choose Voronoi settings that produce cells, borders, spots, or cracks.
How Voronoi generates a pattern
A Voronoi Texture node divides space into regions around randomly placed points. Each point owns the area that is closer to it than to any other point. The result looks like cells, similar to paving stones, reptile skin, or a cracked surface.
The node evaluates the coordinates it receives. A Texture Coordinate node or another vector node provides those coordinates. The Scale input controls how many cells appear in the object.
A higher scale creates smaller cells:
- Scale 2 creates large, widely spaced regions.
- Scale 8 creates smaller, more frequent regions.
- Scale 0.5 creates fewer, larger regions.
The node produces several outputs. The most useful are Distance, Color, and Distance to Edge. The selected Feature setting changes what the node considers its main result.
Choosing a feature
The Feature menu determines which part of the Voronoi calculation becomes the output.
| Feature | Appearance | Useful for |
|---|---|---|
| F1 | Distance to the nearest point | Soft cellular gradients |
| F2 | Distance to the second-nearest point | Comparing neighbouring regions |
| Smooth F1 | Blended cell boundaries | Organic, less geometric cells |
| Distance to Edge | Distance from a cell border | Thin cracks and outlines |
| N-Sphere Radius | Radius-related cell information | Experimental cellular effects |
F1 is the usual starting point. Connect its Distance output to a Colour Ramp to give each cell a controlled colour. The Color output assigns a stable random colour to each cell. This is useful for testing cell boundaries, although it often looks too colourful for a finished material.
Distance to Edge is especially useful for cracks. Its value is close to zero near a cell border and increases farther inside a cell. A Colour Ramp with a narrow transition can turn those borders into thin lines.
Choosing a distance metric
The Distance input determines how “closeness” is measured. Euclidean produces familiar rounded or polygonal cells. Manhattan uses grid-like movement and produces more angular results. Chebychev measures the largest coordinate difference and can create square-like regions.
Use these settings as starting points:
- Euclidean: natural stone, cells, scales, and soft organic patterns.
- Manhattan: blocky minerals, tiles, and stylised surfaces.
- Chebychev: square or diamond-like patterns.
- Minkowski: adjustable between several distance behaviours.
The exact appearance also depends on Scale, randomness, and the coordinate space. Preview the output before choosing colours or shader values.
Controlling randomness
The Randomness input changes how far the feature points move from a regular grid. At zero, the pattern is highly ordered. Higher values make the cells less predictable.
Too much randomness can make the material noisy rather than structured. For rock or cracked earth, moderate randomness usually works better than the maximum value. The number of dimensions also matters. A 3D Voronoi pattern continues through the object, while a 2D pattern is useful when the surface should behave like a flat map.
A common workflow is:
- Connect Object coordinates to the Voronoi Vector input.
- Select F1 and Euclidean distance.
- Set Scale to match the object’s size.
- Adjust Randomness until the cells look natural.
- Use a Colour Ramp to control the final range.
Common errors
A stretched pattern often comes from object scaling that has not been applied or from unsuitable coordinates. Apply the object scale when practical, or use a Mapping node to compensate.
A pattern that changes across separate objects may be using Generated coordinates. Object coordinates usually give more consistent placement relative to each object’s origin.
Cracks that appear as broad bands usually have a Colour Ramp transition that is too wide. Keep the ramp’s transition close to the low Distance to Edge values.
import bpy
material = bpy.data.materials.new("VoronoiCells")
material.use_nodes = True
nodes = material.node_tree.nodes
links = material.node_tree.links
bsdf = nodes.get("Principled BSDF")
coordinates = nodes.new("ShaderNodeTexCoord")
voronoi = nodes.new("ShaderNodeTexVoronoi")
voronoi.feature = "F1"
voronoi.distance = "EUCLIDEAN"
voronoi.inputs["Scale"].default_value = 5.0
voronoi.inputs["Randomness"].default_value = 0.7
links.new(coordinates.outputs["Object"], voronoi.inputs["Vector"])
links.new(voronoi.outputs["Distance"], bsdf.inputs["Base Color"])Exercise
Which Voronoi settings are a good starting point for thin, irregular cracks?
Show answer
Use Distance to Edge, Euclidean distance, moderate Scale and Randomness, then pass the result through a narrow Colour Ramp.