Sub topic 8
Image textures and color spaces
An image texture lets you drive a Principled BSDF input with pixels instead of a single value. This chapter covers the Image Texture node, how UV coordinates decide where pixels land, and why each image needs the right color space. It assumes you can navigate Blender, know what UV coordinates are, and have a material with a Principled BSDF (covered in earlier chapters).
What an Image Texture node does
The Image Texture node reads an image file and outputs a value for each point on the surface. Its main outputs are:
- Color: the RGB value of the pixel at that point.
- Alpha: the transparency stored in the image, if it has any.
You connect Color to the input you want to control. A color map goes to Base Color. A roughness map goes to Roughness. The node replaces the slider value for that input, so the input's own number no longer matters while a link is attached.
To add one, open the Shader Editor, press Shift+A, and choose Texture > Image Texture. Click Open on the node to pick a file. A shortcut: with the Principled BSDF selected, enable the Node Wrangler add-on and press Ctrl+T to add a texture node with a mapping setup already wired up.
UV coordinates: where pixels land
A 3D surface has no built-in way to know which part of a 2D image belongs where. UV coordinates provide that link. Each vertex of a mesh stores a (U, V) position on the image, where (0, 0) is the bottom-left corner and (1, 1) is the top-right.
When the Image Texture node's Vector input is unconnected, Blender uses the object's active UV map automatically. You can also connect nodes to the Vector input to change this:
- Texture Coordinate node: choose UV, Object, Generated, or other coordinate sources.
- Mapping node: translate, rotate, and scale the coordinates. Scale values above 1 tile the image more times across the surface.
The node's Extension setting controls what happens outside the 0 to 1 range:
| Extension | Behavior |
|---|---|
| Repeat | Tiles the image endlessly. Good for seamless textures. |
| Extend | Stretches the edge pixels outward. |
| Clip | Shows nothing (transparent black) outside the image. |
| Mirror | Tiles the image, flipping every other copy. |
The Interpolation setting controls how pixels are sampled. Linear gives smooth results. Closest keeps hard pixel edges, which suits pixel art. Cubic is smoother but slower.
Why color spaces matter
A color space defines how pixel numbers in a file map to actual light intensity. Most image files, such as PNG and JPEG, store colors in sRGB. sRGB is encoded for display: it bends the values so that dark tones get more precision, which matches how people perceive brightness. A pixel stored as 0.5 in sRGB is not half as much light as 1.0. It is about 0.21 in linear light.
Blender's renderers calculate lighting in linear space, where doubling a number doubles the light. So Blender must convert sRGB images into linear values before using them. The Image Texture node does this when its color space is set to sRGB.
Some images are not colors at all. A roughness map stores a number from 0 to 1 per pixel. A normal map stores direction vectors. Converting these as if they were sRGB would distort the numbers. For this kind of image, you set the color space to Non-Color, which tells Blender to use the stored values as they are.
| Map type | Color space | Reason |
|---|---|---|
| Base Color, albedo, diffuse | sRGB | It is a color meant to be seen. |
| Emission color | sRGB | Also a visible color. |
| Roughness | Non-Color | It stores a data value. |
| Metallic | Non-Color | It stores a data value. |
| Normal map | Non-Color | It stores direction vectors. |
| Bump or height map | Non-Color | It stores heights. |
| Alpha or opacity mask | Non-Color | It stores a data value. |
You set the color space in the node's sidebar field, or in the node itself under the image name. The setting belongs to the image datablock, not to the node. If two Image Texture nodes use the same image, they share the color space.
Float and 8-bit images
Image file format affects precision. An 8-bit PNG has 256 levels per channel. A smooth gradient, such as a height map, can show visible steps. For height maps and displacement, prefer 16-bit PNG or a floating-point format such as OpenEXR. Blender's Image Texture node accepts all of these. For EXR files, the default color space is Linear, which is correct for data stored as light values.
Alpha handling
If an image has an alpha channel, the node's Alpha output exposes it. Blender can treat the image's color as either straight or premultiplied with alpha. The Alpha dropdown in the node sidebar (or Image properties) offers Straight, Premultiplied, Channel Packed, and None. If you see dark fringes around cutout edges, try switching between Straight and Premultiplied. Use Channel Packed when the alpha channel actually holds other data, such as a packed roughness map. Choose None to ignore the alpha channel.
Loading images with Python
You can create the same setup in a script. This example loads a color image and a roughness image, setting the color space on the second.
import bpy
mat = bpy.data.materials.new(name="TexturedPlastic")
mat.use_nodes = True
nodes = mat.node_tree.nodes
links = mat.node_tree.links
bsdf = nodes.get("Principled BSDF")
# Color map: sRGB is the default for 8-bit images
color_tex = nodes.new("ShaderNodeTexImage")
color_tex.image = bpy.data.images.load("//textures/plastic_color.png")
links.new(color_tex.outputs["Color"], bsdf.inputs["Base Color"])
# Roughness map: data, so set Non-Color
rough_tex = nodes.new("ShaderNodeTexImage")
rough_tex.image = bpy.data.images.load("//textures/plastic_roughness.png")
rough_tex.image.colorspace_settings.name = "Non-Color"
links.new(rough_tex.outputs["Color"], bsdf.inputs["Roughness"])
# Optional: tile both textures 4 times using one shared Mapping node
coord = nodes.new("ShaderNodeTexCoord")
mapping = nodes.new("ShaderNodeMapping")
mapping.inputs["Scale"].default_value = (4.0, 4.0, 4.0)
links.new(coord.outputs["UV"], mapping.inputs["Vector"])
links.new(mapping.outputs["Vector"], color_tex.inputs["Vector"])
links.new(mapping.outputs["Vector"], rough_tex.inputs["Vector"])The paths are placeholders relative to the .blend file. If a file is missing, bpy.data.images.load raises a RuntimeError. Pass check_existing=True to reuse an image that is already loaded instead of loading a duplicate.
Common problems
- Texture looks pink or purple: Blender cannot find the file. Use File > External Data > Find Missing Files, or pack the image into the .blend file with Pack Resources.
- Texture is stretched or smeared: The mesh has no UV map, or the UVs overlap or are badly unwrapped. Check the UV Editor.
- Colors look washed out or too dark: The color space is wrong. Base Color should be sRGB, and data maps should be Non-Color.
- Texture does not tile: Extension is set to Extend or Clip, or the image itself is not seamless.
- Image disappears after saving and reopening: Generated or edited images are not saved automatically. Use Image > Save As, or pack the image.
Summary of the working model
Each Image Texture node takes coordinates in, samples an image, and sends out a value. Two settings decide whether the result is right: the UV or Mapping setup, which decides where pixels go, and the color space, which decides how the stored numbers are interpreted. Set sRGB for anything that is a visible color, and Non-Color for everything that is data.
Exercise
You connect a roughness image to the Roughness input and leave its color space at the default sRGB. The surface looks glossier than the painted map suggests. Why does this happen, and how do you fix it?
Show answer
With sRGB selected, Blender converts the stored values to linear light before using them, which makes mid-range values darker. Because Roughness reads those values as data, darker numbers mean a lower roughness, so the surface appears glossier. Set the image's color space to Non-Color so Blender uses the stored values unchanged.
Exercise
A tiling brick texture appears once on a large wall and stretches over the whole surface. Which node do you add, and which setting do you change to repeat it 6 times in both directions?
Show answer
Add a Texture Coordinate node (UV output) and a Mapping node, then connect the Mapping node's Vector output to the Image Texture node's Vector input. Set the Mapping node's Scale to (6, 6, 1). Also make sure the Image Texture's Extension is set to Repeat.