Sub topic 11
Margin and Padding to Prevent Edge Bleeding
This chapter assumes you know how to unwrap a mesh, create an Image Texture node, and run a Cycles bake. It focuses on the space added around UV islands after baking. This space is called the margin or padding.
Why margin matters
A baked texture stores pixels inside each UV island. At the exact island boundary, some pixels belong to one surface region and the next pixels may belong to another. During rendering, texture filtering blends nearby pixels. Mipmaps also create smaller versions of the texture by averaging pixels.
Without padding, those operations can sample the empty space or a neighboring island. The result is edge bleeding: dark lines, bright halos, or colors from the wrong material appear along seams.
Margin copies or extends the baked result outward from each UV island. The copied pixels do not add visible surface area. They provide safe pixels for filtering.
Choosing a margin
Blender's Cycles Bake panel includes a Margin setting measured in pixels. The required value depends on the texture resolution, the amount of mipmapping, and the target renderer.
| Texture size | Starting margin | Typical use |
|---|---|---|
| 1024 × 1024 | 8 pixels | Small asset or close-to-default filtering |
| 2048 × 2048 | 16 pixels | General game asset |
| 4096 × 4096 | 32 pixels | Large asset or strong mip reduction |
These values are starting points, not strict rules. A margin that is too small may expose seams at a distance. A margin that is unnecessarily large reduces the empty space available between UV islands.
Set the margin before baking the normal and ambient occlusion maps. Use the same value for related maps so their edges align. The margin cannot repair overlapping UV islands or incorrect island orientation. It only extends pixels from the result that was already baked.
Preparing UV islands
Leave enough space between islands for the chosen margin. If two islands are too close, their padding regions can meet. This can cause one island's baked detail to overwrite or visually contaminate the other.
Use these checks:
- Keep islands inside the 0–1 UV square unless your target supports tiling.
- Avoid accidental overlaps.
- Give thin islands enough width to receive several pixels of padding.
- Keep hard shading splits aligned with UV seams when baking tangent-space normals.
- Inspect the bake at the final texture resolution, not only in the UV Editor.
A high-resolution bake can still fail when the texture is reduced. Test the texture in the target engine or renderer and inspect it at several distances.
Practical workflow
- Unwrap the low-poly target and arrange its islands.
- Check the island spacing at the final texture resolution.
- Select the low-poly object as the active bake target.
- Set the Cycles Bake panel's Margin value, such as 16 pixels for a 2048 texture.
- Bake the normal map and ambient occlusion map.
- Save the images and inspect seams in the material.
- If seams appear only after mipmapping, increase the margin and rebake.
Exercise
A 2048 × 2048 normal map has dark lines around UV islands after the asset is viewed from far away. What should you check first?
Show answer
Check whether the bake margin and UV island spacing are large enough for texture filtering and mipmaps. Start with about 16 pixels, then rebake and test at distance.