Sub topic 10
Mapping, Interpolation and Extension Settings
Earlier chapters connected an image to a material and unwrapped a mesh. This chapter covers the controls that decide what happens when the UV coordinates and the image pixels don't line up exactly. That happens whenever a UV leaves the 0 to 1 range, whenever a pixel on screen covers more or less than one image pixel, and whenever you want the texture tiled, rotated or projected without a UV map.
It assumes you can add an Image Texture node to a material and connect it to Base Color. It also assumes you know what a UV map and a UV island are, and can work in the Shader Editor. The settings described here are in Blender 3.5 and later, because the Mirror extension mode was added in that release.
Where each setting lives
An Image Texture node has four settings in its body and one input socket:
- Interpolation controls how the node blends neighboring pixels.
- Projection controls how a 3D position becomes a 2D lookup.
- Extension controls what is returned outside the 0 to 1 UV square.
- Vector is the input socket that supplies the lookup coordinate.
If nothing is connected to Vector, the node uses the active UV map. That is why a freshly added image texture already works on an unwrapped mesh. Connecting a Texture Coordinate node and a Mapping node in front of it lets you change the coordinate before the lookup.
The order in the diagram is the order in which the values are applied. The Mapping node changes the coordinate first. The projection turns it into a 2D position, the extension handles positions outside the image, and interpolation picks the final color.
The Mapping node
The Mapping node applies a transform to a vector before the image is sampled. It has three inputs: Location, Rotation and Scale. Its Type menu has four options:
| Type | Behavior |
|---|---|
| Point | Transforms the coordinate as a point. The usual choice for textures. |
| Texture | Applies the inverse transform. Moving the node's location moves the texture the way moving an object would. |
| Vector | Transforms as a direction. Location is ignored. |
| Normal | Transforms as a normal and renormalizes it. |
For image textures, use Point. Its effect on the image can seem backwards:
- Scale 2 makes the image appear half the size and repeat twice, because the coordinate runs from 0 to 2 across the surface.
- Scale 0.5 zooms in, showing only the lower-left quarter of the image if the extension is not Repeat.
- Location X 0.25 shifts the image toward negative X by a quarter of its width. The lookup position moved right, so the picture slid left.
Rotation has a gotcha. UV space has its origin at the bottom-left corner of the image, and the Mapping node rotates around that origin, not around the image center. A Z rotation of 45 degrees swings the image around the corner and usually pushes the useful part off the surface. To rotate around the center, move the pivot first: set Location to (0.5, 0.5, 0), rotate, and offset back, or put a second Mapping node before the first to subtract 0.5. Many people avoid the problem by editing the UVs in the UV Editor instead.
The Mapping node changes only how the image is read. It does not move UV islands, so it can't fix stretching in the unwrap. It also affects every object that uses the material, while UV edits affect only one mesh.
Texture Coordinate sources
The Texture Coordinate node offers several outputs, and the one you choose decides whether the UV map is used at all.
- UV is the active UV map, the output used throughout this tutorial.
- Generated is an automatic 0 to 1 coordinate based on the object's bounding box. It needs no unwrap but stretches with the object's proportions.
- Object is the position in the object's local space, in scene units.
- Camera, Window, Normal and Reflection are view-dependent. They are rarely right for color textures.
Use UV for hand-painted or baked textures that must sit in particular places. Use Generated or Object only when the texture is procedural-like, such as tiling concrete, and an unwrap would be a waste.
Projection
The Projection menu has four modes: Flat, Box, Sphere and Tube.
Flat uses the first two components of the incoming vector as X and Y, so UVs map directly to image positions. It is the right mode for UV workflows.
The other three modes build their own 2D coordinate from a 3D vector. They are meant for Generated or Object coordinates.
- Box projects the image along the three axes and blends where faces turn from one axis to another. The Blend slider sets the width of that blend. At 0 you get hard seams, and at 1 a wide fade.
- Sphere wraps the image around the object like a world map, with pinching at the poles.
- Tube wraps it around a vertical cylinder, with no cap handling.
Box projection is the most useful. It texturizes rocks, terrain and other organic shapes without seams or an unwrap. The cost is that the texture is not painted to the model. If the mesh deforms or rotates, a box projection driven by Object coordinates rotates with it, but one driven by world-aligned coordinates would swim.
Interpolation
Interpolation decides what color you get when the lookup position falls between pixel centers. This always happens, because UV positions are continuous and pixels are discrete.
| Mode | Behavior | Typical use |
|---|---|---|
| Linear | Blends the four nearest pixels. | Default. Good for photos and painted color maps. |
| Closest | Takes the single nearest pixel with no blending. | Pixel art, lookup tables, masks with hard IDs. |
| Cubic | Smoother blend using a wider neighborhood. | Close-ups of low-resolution images. |
| Smart | Cubic when the image is magnified, linear when minified. | A balanced choice for general use. |
Closest gives a blocky result when you look closely, which is exactly the goal for pixel art. It is also the correct mode for an image that stores IDs or flags, since blending 1 and 3 should never produce 2.
Linear is a safe default, but magnified low-resolution images look soft. Cubic sharpens that, but it can produce faint ringing, a halo near high-contrast edges, because the curve overshoots.
Interpolation also affects UV padding. Linear and cubic filtering read pixels beyond the sample point, so a color from a neighboring island can leak across an island border. The margin you set when packing islands exists to prevent this. If you see thin colored lines along seams on the model, increase the margin or pad the image, instead of changing the interpolation. Closest sampling needs much less padding because it reads only one pixel.
How a renderer filters minified textures, meaning those far from the camera, depends on the engine. EEVEE uses GPU filtering. Cycles applies its own filtering, and its Texture settings can change this. If a distant checker pattern flickers in one engine and not the other, this is the first place to look.
Extension
Extension defines what the node returns when the coordinate is outside the 0 to 1 square. UV islands normally sit inside the square, but the mapping node, tiled UV layouts and overlapping geometry can push coordinates outside it.
| Mode | Result outside the image |
|---|---|
| Repeat | The image tiles endlessly. |
| Extend | The edge pixels are stretched outward. |
| Clip | Transparent black, with alpha 0 outside. |
| Mirror | The image tiles with every other copy flipped. |
- Repeat is the default. It suits seamless materials such as brick or fabric. The image must be authored so its left edge matches its right edge, or the tile boundary shows.
- Extend suits decals and labels. A sticker slightly bigger than its image won't wrap and repeat.
- Clip is better for decals that need transparency. Connect the node's Alpha output to a Mix Shader factor or the BSDF's Alpha input to make everything outside the image disappear.
- Mirror hides tile seams when the image is not seamless, at the cost of visible symmetry in the pattern.
With Repeat, a UV island that sits at U 1.0 to 2.0 shows the same pixels as one at 0.0 to 1.0. This is how UDIM-like layouts are faked with a single image. It is also a classic accident: an island dragged out of the UV square in the UV Editor still looks right in the viewport under Repeat, which hides the mistake until you bake or paint.
Setting everything from Python
All of these options are properties on the node and can be set from a script. This example builds a plane, gives it a generated UV grid, scales the lookup so the grid repeats three times, and sets the node options.
import bpy
bpy.ops.mesh.primitive_plane_add(size=2)
obj = bpy.context.active_object
img = bpy.data.images.new("MappingTestGrid", width=1024, height=1024)
img.generated_type = 'UV_GRID'
mat = bpy.data.materials.new("MappingDemo")
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")
mapping.vector_type = 'POINT'
mapping.inputs["Scale"].default_value = (3.0, 3.0, 1.0)
tex = nodes.new("ShaderNodeTexImage")
tex.image = img
tex.projection = 'FLAT'
tex.extension = 'REPEAT'
tex.interpolation = 'Linear'
links.new(coord.outputs["UV"], mapping.inputs["Vector"])
links.new(mapping.outputs["Vector"], tex.inputs["Vector"])
links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])
obj.data.materials.append(mat)The valid strings are:
projection:'FLAT','BOX','SPHERE','TUBE'extension:'REPEAT','EXTEND','CLIP','MIRROR'interpolation:'Linear','Closest','Cubic','Smart'
Note that interpolation uses capitalized words while projection and extension use all capitals. A misspelled string raises a TypeError that lists the accepted values.
Common errors
- The texture looks half the size after adding a Mapping node. Scale values above 1 shrink the image on the surface. Use values below 1 to enlarge it.
- A rotated image slides off the model. The rotation pivot is the UV origin. Rotate in the UV Editor, or offset the location.
- Thin lines of the wrong color along seams. The filter is reading neighboring islands. Increase the pack margin, or use Closest for data that must not blend.
- A decal repeats where it should stop. Set the extension to Clip or Extend instead of Repeat.
- Box projection looks smeared. The Vector input is still the UV map. Switch the Texture Coordinate output to Object or Generated.
Exercise
A tileable stone texture is applied to a wall with the UV map and the default node settings. You want the stone to appear twice as large on the wall, and you want to avoid seams from filtering at the edges of a decal logo on a second image node. Which Mapping scale value do you use for the stone, and which extension mode do you pick for the logo?
Show answer
Use a Mapping scale of 0.5 on X and Y for the stone. Values below 1 magnify the image, so the same pixels cover twice the area. For the logo, use Extend if you want the edge pixels held, or Clip if you want everything outside the image to be fully transparent. Either one stops the logo from repeating, which Repeat would do.
Exercise
You paint a 32 by 32 pixel image of block colors for a stylized prop. In the viewport the colors look blurry at the block borders. Which setting do you change, and on which node?
Show answer
Set Interpolation to Closest on the Image Texture node. Linear blends the four nearest pixels, which softens the borders. Closest returns exactly one pixel, so the blocks stay sharp.