Sub topic 10
Putting together a PBR texture set
This chapter shows how to wire a complete PBR texture set into the Principled BSDF. It assumes you can already do the following:
- Navigate the Shader Editor.
- Add an Image Texture node.
- Describe what Base Color, Metallic and Roughness do.
- Explain roughly what UV coordinates are.
The chapter covers the set of maps, the color space each one needs, the node graph, a script that builds the graph, and the errors that show up most often.
What a PBR texture set is
PBR stands for physically based rendering. A PBR texture set is a group of image files that each drive one input of the Principled BSDF. Texture sites and scanning tools export them with a shared name prefix, such as brick_color.png, brick_roughness.png and brick_normal.png.
| Map | Typical file suffix | Principled BSDF input | Color space | Notes |
|---|---|---|---|---|
| Base color (albedo) | `_color`, `_albedo`, `_diffuse` | Base Color | sRGB | Holds color. It should contain no baked lighting. |
| Metallic | `_metallic`, `_metalness` | Metallic | Non-Color | Mostly black or white. Often missing for non-metal materials. |
| Roughness | `_roughness` | Roughness | Non-Color | Some sets ship a glossiness map instead. See the gotchas below. |
| Normal | `_normal`, `_nor_gl` | Normal, through a Normal Map node | Non-Color | Check whether the file is OpenGL or DirectX style. |
| Height or displacement | `_height`, `_displacement` | Bump node Height input, or Displacement | Non-Color | Optional. |
| Ambient occlusion | `_ao` | Usually unused | Non-Color | Cycles computes occlusion itself. |
| Alpha or opacity | `_opacity`, `_alpha` | Alpha | Non-Color | Only for cutouts such as leaves or fences. |
The rule behind the color spaces
A color space tells Blender how to interpret the numbers stored in an image file.
- sRGB files hold colors. Blender converts them to linear values before shading, because lighting math must run on linear light.
- Non-Color files hold data, such as "0.35 roughness" or "this normal points left". Blender must use the stored numbers unchanged.
If you leave a roughness map on sRGB, Blender applies the color conversion to it. A mid-gray value of 0.5 becomes about 0.21. The surface looks glossier than the artist intended, and nothing in the node graph shows why.
Only Base Color (and color-like maps such as emission color) should use sRGB. Every other map in the set uses Non-Color.
The node graph
A complete graph has this shape:
Four points about this graph:
- Texture Coordinate: Image Texture nodes use the active UV map when their Vector input is unconnected. Add a Texture Coordinate node only when you want to change mapping, for example to add a Mapping node for tiling.
- Shared mapping: Every map in a set must use the same coordinates. Otherwise the color, roughness and normal detail drift apart.
- Normal Map node: A normal image stores directions as colors. The Normal Map node converts them into the vector the shader needs. Wiring the image straight into Normal gives wrong shading.
- Bump chaining: To use both a normal map and a height map, connect the Normal Map output into the Bump node's Normal input. Then connect the Bump output to the Principled BSDF. The Bump node adds fine height detail on top of the normal map.
Building it with the Shader Editor add-on
Blender ships with the Node Wrangler add-on. Enable it under Edit > Preferences > Add-ons. Then select the Principled BSDF node and press Ctrl+Shift+T. A file browser opens. Select every map in the set at once, and Blender does the following:
- It creates one Image Texture node per file.
- It guesses each map's role from the filename.
- It sets Non-Color on data maps.
- It adds a Normal Map node where needed.
- It connects everything to the Principled BSDF.
Always inspect the result. The filename guess fails when suffixes are unusual.
Building it with Python
This script builds the same graph. It guesses nothing: each map is listed by hand, so you can see what each input needs. The file names are placeholders relative to the .blend file.
import bpy
def add_image(nodes, path, non_color):
node = nodes.new("ShaderNodeTexImage")
node.image = bpy.data.images.load(path, check_existing=True)
if non_color:
node.image.colorspace_settings.name = "Non-Color"
return node
mat = bpy.data.materials.new(name="BrickPBR")
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
bsdf = nodes.get("Principled BSDF")
# Color: sRGB (the default)
color = add_image(nodes, "//textures/brick_color.png", non_color=False)
links.new(color.outputs["Color"], bsdf.inputs["Base Color"])
# Roughness: data
rough = add_image(nodes, "//textures/brick_roughness.png", non_color=True)
links.new(rough.outputs["Color"], bsdf.inputs["Roughness"])
# Normal: data, converted through a Normal Map node
normal = add_image(nodes, "//textures/brick_normal.png", non_color=True)
normal_map = nodes.new("ShaderNodeNormalMap")
normal_map.inputs["Strength"].default_value = 1.0
links.new(normal.outputs["Color"], normal_map.inputs["Color"])
# Height: data, adds fine detail through a Bump node
height = add_image(nodes, "//textures/brick_height.png", non_color=True)
bump = nodes.new("ShaderNodeBump")
bump.inputs["Strength"].default_value = 0.3
links.new(height.outputs["Color"], bump.inputs["Height"])
# Chain: normal map -> bump -> BSDF
links.new(normal_map.outputs["Normal"], bump.inputs["Normal"])
links.new(bump.outputs["Normal"], bsdf.inputs["Normal"])
# Brick is not metal, so leave Metallic at its default of 0.
obj = bpy.context.active_object
if obj is not None and obj.type == 'MESH':
obj.data.materials.append(mat)The script skips Metallic on purpose. Where a set has no metallic map, the default value of 0 is correct for non-metals. For a metal, set the value to 1.0 or connect a metallic map.
If a texture is missing on disk, bpy.data.images.load raises an error. Check the path before you run the script.
Common errors
- Washed-out or too-shiny surface: A data map, usually roughness, is still set to sRGB. Set it to Non-Color.
- Dark, muddy color: The color map was set to Non-Color. Set it back to sRGB.
- Lighting looks inverted on bumps: The normal map uses the DirectX convention (green channel points down), and Blender expects OpenGL (green points up). Many sets provide both files. If you only have the DirectX one, flip the green channel. You can do this with a Separate Color node, an Invert on the green output, and a Combine Color node placed before the Normal Map node.
- Glossiness instead of roughness: Some sets ship a glossiness map, which is the inverse of roughness. Put an Invert Color node between the texture and the Roughness input.
- Ambient occlusion map: Do not plug AO into Base Color without a reason, because it bakes dark patches into the color. If you want it, multiply it with the color using a Mix node set to Multiply, and keep its factor low. Cycles already computes occlusion from the lighting, so adding AO can double-darken crevices.
- Visible tiling: A small texture repeated over a large surface shows a pattern. Use a Mapping node to scale it, and vary the result with a noise texture or a second, differently scaled copy.
- Stretched textures: The object has no UV map or a poor one. Check the UV Editor before blaming the material.
Checking your work
A quick test catches most problems. Temporarily set Metallic to 0 and Roughness to a constant 0.5, then compare only the Base Color. Then connect the roughness map back. If the surface changes in ways that don't match the image, the color space or the connection is wrong.
Exercise
A downloaded set contains stone_color.png, stone_rough.png and stone_normal.png. After you wire it up, the stone looks like polished plastic, and the roughness map appears correct in the image viewer. What is the most likely cause, and what is the fix?
Show answer
The roughness image is still using the sRGB color space, so Blender converts its values and makes them darker, which means a lower roughness. Select the roughness Image Texture node and change the image's color space to Non-Color. The surface then shows the roughness values stored in the file.
Exercise
Your normal-mapped surface looks like the bumps are dents, and the shading seems lit from the wrong side. The file is wired through a Normal Map node and set to Non-Color. What do you check next?
Show answer
Check whether the normal map is in the DirectX convention. Blender expects OpenGL, where the green channel points up. Use the OpenGL version of the file if the set provides one. Otherwise invert the green channel before the Normal Map node.
Exercise
In the node graph, why does the roughness texture connect straight to the Roughness input, while the normal texture goes through a Normal Map node first?
Show answer
Roughness is a single number per pixel, so the image value can feed the input directly. A normal texture stores vector directions encoded as colors. The Normal Map node decodes them into a normal vector that the shader can use.