Sub topic 10
Wiring patterns into Base Color, Roughness, and other inputs
This chapter assumes you can navigate the Shader Editor and know the main Principled BSDF inputs. It also assumes you have already built a Noise or Voronoi pattern and shaped it with a Colour Ramp. The question here is what to do with that pattern. A pattern only becomes a material once its values drive inputs on the shader. Each input expects a different kind of number, so the wiring decisions matter.
One pattern, several jobs
A procedural texture produces a field of values over the surface. Each Principled BSDF input reads that field differently:
- Base Color wants a colour. Brightness differences become visible variation in the surface tint.
- Roughness wants a number from 0 (mirror) to 1 (fully diffuse). Variation shows up in how sharp or blurry reflections are.
- Metallic wants a number that should be close to 0 or 1 in nearly all places. Values in between are physically implausible.
- Normal wants a direction vector. It never takes a texture value directly.
- Emission Color, Emission Strength, and Alpha take colour, intensity, and opacity respectively.
The strongest procedural materials use one underlying pattern, usually a single mask, to drive several inputs at once. Rust is the standard example. Where the rust is, the colour is orange-brown, the surface is rougher, and the metal is gone. Because all three inputs come from the same mask, the effects line up, and the eye reads that as realism.
How values convert between socket types
Blender lets you connect almost any output to almost any input and converts the value silently. Knowing the rules helps you spot wrong results.
| From | To | What happens |
|---|---|---|
| Float (Fac, Value) | Colour | The value becomes a grey: R, G, and B all equal the float. |
| Colour | Float | The colour is reduced to a single number, roughly its brightness. |
| Float or colour | Vector | The components are filled from the channels, which is rarely what you want. |
Two consequences follow:
- You can plug a Colour Ramp's Color output straight into Roughness. A black-to-white ramp gives 0 to 1. This works, but you control the range only through the ramp's colours, which is awkward.
- Noise Texture Fac values are not spread evenly from 0 to 1. With default detail they cluster around 0.5. Plugged straight into Roughness, the result is a nearly uniform surface with barely visible variation. You must stretch the contrast first, with a Colour Ramp or a Map Range node.
Base Color: colour from a ramp or from a mix
You have two ways to colour a surface with a pattern.
Ramp as palette. Put coloured stops on the Colour Ramp and connect its Color output to Base Color. This is the quickest option and suits single-material surfaces like soil, sand, or stone. The first code example in this tutorial used it.
Mask plus Mix. Use a black-and-white ramp as a mask, and let it blend between two separate colours (or two whole sub-graphs) in a Mix node. This is better for layered materials. The mask can also be reused for other inputs, which a palette ramp cannot do cleanly.
Colour values you type into a node, such as (0.6, 0.5, 0.4), are linear. They look darker than the same numbers would in a hex colour picker. Procedural values never need a colour space setting. That setting applies only to image textures. If a procedural colour looks too dark, change the numbers. Do not look for a colour space option.
Roughness: remap with Map Range
Roughness is where most beginners get flat results. A realistic roughness map rarely spans the full 0 to 1 range. Rust might sit between 0.6 and 0.9. Worn steel might sit between 0.2 and 0.5. The Map Range node converts a 0 to 1 pattern into exactly the range you choose:
- From Min / From Max describe the incoming range. The defaults of 0 and 1 suit a mask.
- To Min / To Max describe the range you want.
- Swapping To Min and To Max inverts the pattern.
You can also use a Math node with Multiply and Add, but Map Range states the intent more clearly and exposes an optional Clamp setting.
Metallic: keep it binary
Real surfaces are either metal or not. A noise pattern ramps smoothly through grey, and a grey metallic value produces an odd mix that looks like neither. Sharpen the mask so the transition is narrow: stops close together on the ramp. In the rust example below, a ramp from 0.45 to 0.60 gives a soft but narrow edge. A Map Range node then inverts the mask so that rusty areas have Metallic near 0 and clean areas have Metallic near 1.
Worked example: rusty metal
This script builds the whole graph in the diagram. It uses Blender 4.x names. The Mix node has several sockets with the same name (A and B exist for float, vector, and colour), so the code addresses the colour sockets by index.
import bpy
mat = bpy.data.materials.new("RustyMetal")
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
bsdf = nodes["Principled BSDF"]
coord = nodes.new("ShaderNodeTexCoord")
mapping = nodes.new("ShaderNodeMapping")
noise = nodes.new("ShaderNodeTexNoise")
noise.inputs["Scale"].default_value = 4.0
noise.inputs["Detail"].default_value = 8.0
noise.inputs["Roughness"].default_value = 0.6
# Mask: black below 0.45, white above 0.60
mask = nodes.new("ShaderNodeValToRGB")
cr = mask.color_ramp
cr.elements[0].position = 0.45
cr.elements[0].color = (0.0, 0.0, 0.0, 1.0)
cr.elements[1].position = 0.60
cr.elements[1].color = (1.0, 1.0, 1.0, 1.0)
# Colour mix: A = clean steel, B = rust
mix = nodes.new("ShaderNodeMix")
mix.data_type = 'RGBA'
mix.inputs[6].default_value = (0.55, 0.55, 0.58, 1.0) # A colour
mix.inputs[7].default_value = (0.35, 0.12, 0.04, 1.0) # B colour
# Roughness: 0.25 on steel, 0.85 on rust
rough = nodes.new("ShaderNodeMapRange")
rough.inputs["To Min"].default_value = 0.25
rough.inputs["To Max"].default_value = 0.85
# Metallic: 1 on steel, 0 on rust (range inverted)
metal = nodes.new("ShaderNodeMapRange")
metal.inputs["To Min"].default_value = 1.0
metal.inputs["To Max"].default_value = 0.0
links.new(coord.outputs["Object"], mapping.inputs["Vector"])
links.new(mapping.outputs["Vector"], noise.inputs["Vector"])
links.new(noise.outputs["Fac"], mask.inputs["Fac"])
links.new(mask.outputs["Color"], mix.inputs[0]) # Factor
links.new(mix.outputs[2], bsdf.inputs["Base Color"]) # Result (colour)
links.new(mask.outputs["Color"], rough.inputs["Value"])
links.new(rough.outputs["Result"], bsdf.inputs["Roughness"])
links.new(mask.outputs["Color"], metal.inputs["Value"])
links.new(metal.outputs["Result"], bsdf.inputs["Metallic"])Assign the material to an object and render in Cycles or EEVEE to see rust patches that are rougher, darker, and non-metallic, all at the same places.
Normal and the other inputs
Normal. Do not connect a texture to the Normal input. It expects a direction, and a grey value fills the vector channels incorrectly, which produces garbage shading. Send the pattern to a Bump node's Height input and connect the Bump node's Normal output to the shader. The next chapter covers this in detail. For now, remember that the mask you built for colour is often a good height source too.
Emission. Emission Color takes a colour and Emission Strength takes a float. For glowing cracks, use a narrow Voronoi Distance to Edge mask as the Emission Strength, and set Emission Color to a fixed orange. The default Emission Strength is 0, so connecting only the colour shows nothing.
Alpha. A mask in Alpha cuts holes in the surface, such as weathered edges on a leaf. In EEVEE, also set the material's blend mode so transparency is actually drawn. Otherwise the mask appears to do nothing.
Subsurface, Coat, and Sheen. These accept the same kind of masked float. Use the same pattern with a Map Range to confine a clear coat to cleaner areas, for example.
Common mistakes
- A flat-looking roughness. The raw noise value sits near 0.5 and the whole surface gets a roughness near 0.5. Stretch the contrast with a ramp or Map Range.
- Roughness reaching 0. Fully polished patches reflect everything as a mirror and look like holes in the material. Keep To Min at 0.05 or above for natural surfaces.
- Wrong direction. If rust appears where you expected clean metal, the mask is inverted. Swap the Mix inputs, or swap To Min and To Max. Do not re-edit the pattern.
- Different patterns per input. If you add a second Noise node for roughness, its patches no longer match the colour patches. Reuse the same mask unless you want decorrelation on purpose.
- Metallic values in between. A mid-grey Metallic shows as a milky, plastic-coated metal. Narrow the ramp stops or follow with a harder threshold.
- Normal connected to a float. The shading breaks. Route it through a Bump node.
Decision guide
| Goal | Wiring |
|---|---|
| Single natural surface, no layers | Noise → Colour Ramp (coloured) → Base Color |
| Two materials in patches | Noise → Colour Ramp (mask) → Mix factor, plus Map Range for Roughness and Metallic |
| Roughness variation only | Noise → Map Range → Roughness |
| Raised or sunken detail | Mask or pattern → Bump Height → Normal |
| Glowing lines | Voronoi Distance to Edge → Colour Ramp → Emission Strength |
Exercise
A material has a Noise Texture Fac output connected directly to Roughness, and the surface looks almost uniformly medium-rough. Which two changes would give clearly visible roughness variation between about 0.3 and 0.9, and where in the graph do you put them?
Show answer
Place a Colour Ramp (with stops moved apart, for example 0.4 and 0.6) or a Map Range node between the Noise Fac output and the Roughness input. The first stretches the contrast, because raw noise clusters near 0.5. Set the Map Range To Min to 0.3 and To Max to 0.9, or colour the ramp stops with greys equal to 0.3 and 0.9. Either way the narrow band of noise values is remapped to the full roughness range you want.
Exercise
In the rusty metal script, which single edit makes rust appear where the noise is low instead of where it is high, without touching the noise or the ramp?
Show answer
Swap the two colours in the Mix node (put the rust colour in inputs[6] and the steel colour in inputs[7]). Also swap the To Min and To Max values on both Map Range nodes (roughness 0.85 to 0.25, metallic 0.0 to 1.0). The mask is then read the opposite way, and all three inputs stay consistent with each other.