Sub topic 8
Image Textures and Color Spaces
Assume you can create a material, use the Shader Editor, and understand that UV coordinates map points on a 3D surface to positions in a 2D image. This chapter shows how to connect texture maps to a Principled BSDF without changing their meaning.
Connect an image texture
An image texture node reads pixels from an image file. Its Color output can drive inputs such as Base Color, Roughness, Metallic, or Normal, depending on the type of map.
A typical color-texture connection is:
- Add an Image Texture node.
- Open the color image.
- Connect its Color output to Base Color on the Principled BSDF.
- Confirm that the object has suitable UV coordinates.
- Connect the Principled BSDF to Material Output.
The image is sampled using the object’s UV map. If the UV map is missing or badly laid out, the texture can appear stretched, repeated, or projected in an unexpected direction.
Choose the correct color space
A color space describes how numeric channel values represent light or other data. Blender must interpret each image correctly before using it in a shader.
Use sRGB for images that represent visible color, such as a painted wood or fabric color map. Blender converts this color information for shader calculations.
Use Non-Color for images that store measurements or instructions rather than visible color. Common examples include:
- Roughness maps
- Metallic maps
- Ambient occlusion maps
- Height and mask maps
- Normal maps
A roughness value of 0.2 means a smoother surface than 0.8. It must remain a data value. Treating it as sRGB changes the value and can make the material look incorrectly shiny or dull.
In the Image Texture node, select the image, then set Color Space in the node’s image settings. Set normal-map images to Non-Color before sending them into a Normal Map node.
| Map | Typical destination | Color Space |
|---|---|---|
| Base Color | Principled Base Color | sRGB |
| Roughness | Principled Roughness | Non-Color |
| Metallic | Principled Metallic | Non-Color |
| Normal | Normal Map node | Non-Color |
Build a color and roughness setup
This script creates two image textures and connects them to a Principled BSDF. Replace the paths with files relative to the saved .blend file.
import bpy
material = bpy.data.materials.new(name="TexturedSurface")
material.use_nodes = True
nodes = material.node_tree.nodes
links = material.node_tree.links
bsdf = nodes.get("Principled BSDF")
color_node = nodes.new("ShaderNodeTexImage")
color_node.image = bpy.data.images.load("//textures/color.png")
links.new(color_node.outputs["Color"], bsdf.inputs["Base Color"])
roughness_node = nodes.new("ShaderNodeTexImage")
roughness_node.image = bpy.data.images.load("//textures/roughness.png")
roughness_node.image.colorspace_settings.name = "Non-Color"
links.new(roughness_node.outputs["Color"], bsdf.inputs["Roughness"])
obj = bpy.context.active_object
if obj and obj.type == "MESH":
obj.data.materials.append(material)Check the result
If a texture is missing, pack the image into the .blend file or use a reliable relative path. If the image appears rotated or stretched, inspect the UV map. If the surface has the wrong gloss, verify the roughness image’s color space before changing shader values.
Exercise
Which color space should you use for a roughness image, and why?
Show answer
Use Non-Color because roughness pixels are numeric surface data, not displayed color. This prevents Blender from applying an inappropriate color conversion.