Sub topic 2
Metallic and Roughness: plastic, metal and in between
This chapter assumes you can open the Shader Editor, select a mesh object, and read UV coordinates in Blender 4.x.
Metallic and Roughness
Metallic sets whether a surface behaves like metal (1.0) or like a non-metal such as plastic, paint or wood (0.0). Values between 0 and 1 are physically rare, but they help with partly worn or coated surfaces.
Roughness sets how blurred reflections look. A value near 0 gives a sharp mirror highlight. A value near 1 gives a matte finish.
| Surface | Metallic | Roughness |
|---|---|---|
| Glossy plastic | 0.0 | 0.3 |
| Brushed aluminum | 1.0 | 0.4 |
| Matte paint | 0.0 | 0.8 |
IOR and Specular controls
IOR (index of refraction) is the number that describes how much light bends entering a material. Most non-metals fall between 1.4 and 1.6. The Specular input controls reflection strength for non-metals. Its default of 0.5 matches an IOR of about 1.5. Adjust one of them and leave the other at its default.
Image textures and color spaces
An image texture is a bitmap mapped onto a surface through UV coordinates. Color maps should use sRGB. Metallic, Roughness and normal maps store numbers, not colors, so set their color space to Non-Color. Otherwise Blender applies gamma correction and the values come out wrong.
import bpy
mat = bpy.data.materials.new(name="TexturedMetal")
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
bsdf = nodes.get("Principled BSDF")
color_tex = nodes.new("ShaderNodeTexImage")
color_tex.image = bpy.data.images.load("//textures/metal_color.png")
links.new(color_tex.outputs["Color"], bsdf.inputs["Base Color"])
rough_tex = nodes.new("ShaderNodeTexImage")
rough_tex.image = bpy.data.images.load("//textures/metal_roughness.png")
rough_tex.image.colorspace_settings.name = "Non-Color"
links.new(rough_tex.outputs["Color"], bsdf.inputs["Roughness"])
bsdf.inputs["Metallic"].default_value = 1.0The // prefix is relative to the .blend file. The script fails if the image files do not exist at those paths.
Adding detail with Normal Map and Bump
A Normal Map node makes a flat face look bumpy by changing how light reflects. The geometry does not change. Connect a normal map image to a Normal Map node, then connect the node's Normal output to the Principled BSDF Normal input. The Bump node uses a grayscale height image and is less accurate, so prefer Normal Map for most work.
Putting together a PBR texture set
A PBR (physically based rendering) texture set is a group of maps for one surface. Name the files consistently, then assign each map with the correct color space:
- Base Color: sRGB
- Metallic: Non-Color
- Roughness: Non-Color
- Normal: Non-Color, through a Normal Map node
Exercise
A roughness map looks wrong: the surface reflects like a mirror when it should look matte. Which color space setting is the most likely cause?
Show answer
The roughness map is set to sRGB. Set it to Non-Color so Blender reads its values as data.