Sub topic 3
Layering patterns with Mix and Math nodes
This chapter assumes you know the Shader Editor, the Principled BSDF node, and the Noise and Voronoi outputs. Both produce grey values from 0 to 1. Mix and Math nodes combine those values so one material can use several patterns at once.
Layering patterns with Mix and Math nodes
A Math node with the Multiply operation multiplies two float values. Multiplying a Noise factor by a Voronoi distance gives a pattern where both effects show, such as cracks that only appear in darker patches. A Mix node blends two colours or values using a Factor input between 0 and 1.
Wiring patterns into Base Color, Roughness, and other inputs
Send colour patterns to Base Color. Send grey patterns to Roughness, because Roughness reads only the first channel of a value. Keep Roughness values between about 0.3 and 0.9 for natural surfaces. Values outside that range often look like plastic or glass.
Adding surface relief with the Bump node and displacement
A Bump node (a node that fakes small surface detail by changing how light reflects) reads a grey height map from its Height input. Its Normal output goes to the Principled BSDF Normal input. Displacement moves real geometry instead, so it needs a subdivided mesh and a setting in the material options that enables it.
Building the same graph with Python
The following script builds the graph above in a new material. Run it in Blender's Scripting workspace.
import bpy
mat = bpy.data.materials.new("LayeredRock")
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
bsdf = nodes["Principled BSDF"]
coord = nodes.new("ShaderNodeTexCoord")
noise = nodes.new("ShaderNodeTexNoise")
noise.inputs["Scale"].default_value = 6.0
vor = nodes.new("ShaderNodeTexVoronoi")
vor.feature = 'DISTANCE_TO_EDGE'
mult = nodes.new("ShaderNodeMath")
mult.operation = 'MULTIPLY'
bump = nodes.new("ShaderNodeBump")
bump.inputs["Strength"].default_value = 0.5
links.new(coord.outputs["Object"], noise.inputs["Vector"])
links.new(coord.outputs["Object"], vor.inputs["Vector"])
links.new(noise.outputs["Fac"], mult.inputs[0])
links.new(vor.outputs["Distance"], mult.inputs[1])
links.new(mult.outputs["Value"], bsdf.inputs["Roughness"])
links.new(noise.outputs["Fac"], bump.inputs["Height"])
links.new(bump.outputs["Normal"], bsdf.inputs["Normal"])Troubleshooting stretched, banded, or slow procedural materials
| Symptom | Likely cause | Fix |
|---|---|---|
| Pattern looks stretched | Object coordinates on a scaled object | Apply the object scale (Ctrl+A) or use Generated coordinates |
| Pattern is too large or too small | Scale value too low or high | Adjust Scale on the Noise or Voronoi node, or use a Mapping node |
| Visible rings or steps | Colour Ramp stops too close together | Spread the stops or use smooth interpolation |
| Slow preview | High Detail value or many noise nodes | Lower Detail in the viewport and raise it for the final render |
:::
Exercise
In the script above, what changes if you set the Math node operation to ADD instead of MULTIPLY?
Show answer
The Roughness value becomes the sum of the noise and distance values, so areas where both are high become rougher, and the pattern no longer hides the cracks in dark noise areas. Values above 1 are clamped, so the surface can look uniformly rough.