Difference between revisions of "Edge padding"

From polycount
Jump to: navigation, search
(WikiName)
(clarifications)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
<!-- ## page was renamed from Edge Padding -->
 
<!-- ## page was renamed from Edge Padding -->
* [[Polycount|Main Page]] > [[2D Tutorials]] > Edge Padding
 
  
<span id="EP"></span>
 
 
= Edge Padding =
 
= Edge Padding =
 
When game models are textured using a single texture sheet (decal sheet, or texture atlas), the texture will have UV'd areas (UV shells) and blank areas between them (gutters).
 
When game models are textured using a single texture sheet (decal sheet, or texture atlas), the texture will have UV'd areas (UV shells) and blank areas between them (gutters).
  
When a game engine renders a scene it uses texture filtering to smoothly render the textures, in a process called downsampling. If the gutters have colors that are significantly different from the colors inside the shells, then those colors will "bleed" creating seams on the model. The same thing happens when neighboring shells have different colors; as the texture is downsampled eventually those colors start to mix.
+
When a game engine renders a scene it uses texture filtering to smoothly render the textures, in a process called downsampling. If the gutters have colors that are significantly different from the colors inside the shells, then those colors can "bleed" which creates seams on the model. The same thing happens when neighboring shells have different colors; as the texture is downsampled eventually those colors start to mix.
  
To avoid this, edge padding can be added to the empty spaces around each UV shell. Edge padding duplicates the pixels along the inside of the UV edge and spreads those colors outward, forming a skirt of similar colors.  
+
To avoid this, edge padding should be added to the empty spaces around each UV shell. Edge padding duplicates the pixels along the inside of the UV edge and spreads those colors outward, forming a skirt of similar colors.  
  
 
When the UV layout is created, the spacing between the shells should be done with edge padding in mind. If the gutters between the UV shells aren't at least double the width of the edge padding, neighboring shells will tend to bleed together more quickly.
 
When the UV layout is created, the spacing between the shells should be done with edge padding in mind. If the gutters between the UV shells aren't at least double the width of the edge padding, neighboring shells will tend to bleed together more quickly.
  
 +
== Filtering Examples ==
 
{| border="1" cellpadding="2" cellspacing="0"
 
{| border="1" cellpadding="2" cellspacing="0"
 
|-
 
|-
Line 25: Line 24:
 
|}
 
|}
  
<span id="MP"></span>
 
 
== Minimum Padding ==
 
== Minimum Padding ==
 
Here are suggested amounts of edge padding to use for different size textures:
 
Here are suggested amounts of edge padding to use for different size textures:
Line 35: Line 33:
 
It works best when the UV gutters are at least twice this width, and the padding is extended to fill all empty areas (or the empties are flood-filled with a similar background color).
 
It works best when the UV gutters are at least twice this width, and the padding is extended to fill all empty areas (or the empties are flood-filled with a similar background color).
  
{| border="1" cellpadding="2" cellspacing="0"
 
|}
 
  
If you want a visual guide when creating your UVs, one easy way to see the spacing is to use a checker as the background image in your UV editor, with each checker square set to the padding width. For a 4-pixel-wide checker on a 512x512 image, tile the checker image 64 times... if you calculate that the checker image has 2 checker squares across it, then the checkers bitmap should be 8 pixels across for a 512 image, and 8 pixels goes 64 times into 512, so that means it needs to be tiled 64 times across your UV square. Remember though, that if your UV space isn't square, then the checker image needs to be tiled differently.
+
<pre><nowiki>#!wiki caution
 +
'''Note:''' These guidelines apply differently depending on the engine, filtering type, and [[MipMap|mip map]] mode. With UDK for example you can create UVs with minimal shell distances because it uses anisotropic filtering. A 2048 texture would need a 4- to 8-pixel gutter instead of a 16-pixel one.
 +
</nowiki></pre>
 +
 
 +
 
 +
== Visual Packing Guide ==
 +
If you want a visual guide when creating your UVs, one easy way to see the spacing is to use a checker as the background image in your UV editor, with each checker square set to the padding width.  
 +
 
 +
For example to get a 4-pixel-wide checker on a 512x512 image, tile the checker image 64 times... if you calculate that the checker image has 2 checker squares across it, then the checkers bitmap should be 8 pixels across for a 512 image, and 8 pixels goes 64 times into 512, so that means it needs to be tiled 64 times across your UV square. Remember though, that if your UV space isn't square, then the checker tiling needs to be adjusted.
  
<span id="PT"></span>
 
 
== Padding Tools ==
 
== Padding Tools ==
 
Texture-baking tools usually have an edge padding feature.
 
Texture-baking tools usually have an edge padding feature.
Line 52: Line 55:
 
* Eric Chadwick has an Action called  [http://www.ericchadwick.com/examples/files/UV%20padding%20from%20Alpha.zip UV padding from Alpha] that adds an 8-pixel edge pad. <<BR>>The Action is slow, but it greatly reduces pixel-streaking and is non-destructive. Before running the filter, make sure you have a non-anti-aliased alpha channel, with white shells and black gutters.
 
* Eric Chadwick has an Action called  [http://www.ericchadwick.com/examples/files/UV%20padding%20from%20Alpha.zip UV padding from Alpha] that adds an 8-pixel edge pad. <<BR>>The Action is slow, but it greatly reduces pixel-streaking and is non-destructive. Before running the filter, make sure you have a non-anti-aliased alpha channel, with white shells and black gutters.
  
<<BR>>
+
----
* [[Polycount|Main Page]] > [[2D Tutorials]] > Edge Padding
+
[[Category:Texturing]] [[Category:TextureTechnique]]

Revision as of 13:01, 7 July 2010


Edge Padding

When game models are textured using a single texture sheet (decal sheet, or texture atlas), the texture will have UV'd areas (UV shells) and blank areas between them (gutters).

When a game engine renders a scene it uses texture filtering to smoothly render the textures, in a process called downsampling. If the gutters have colors that are significantly different from the colors inside the shells, then those colors can "bleed" which creates seams on the model. The same thing happens when neighboring shells have different colors; as the texture is downsampled eventually those colors start to mix.

To avoid this, edge padding should be added to the empty spaces around each UV shell. Edge padding duplicates the pixels along the inside of the UV edge and spreads those colors outward, forming a skirt of similar colors.

When the UV layout is created, the spacing between the shells should be done with edge padding in mind. If the gutters between the UV shells aren't at least double the width of the edge padding, neighboring shells will tend to bleed together more quickly.

Filtering Examples

Minimum Padding

Here are suggested amounts of edge padding to use for different size textures:

  • 128 = 2px
  • 256 = 2px
  • 512 = 4px
  • 1024 = 8px
  • 2048 = 16px

It works best when the UV gutters are at least twice this width, and the padding is extended to fill all empty areas (or the empties are flood-filled with a similar background color).


#!wiki caution
'''Note:''' These guidelines apply differently depending on the engine, filtering type, and [[MipMap|mip map]] mode. With UDK for example you can create UVs with minimal shell distances because it uses anisotropic filtering. A 2048 texture would need a 4- to 8-pixel gutter instead of a 16-pixel one. 


Visual Packing Guide

If you want a visual guide when creating your UVs, one easy way to see the spacing is to use a checker as the background image in your UV editor, with each checker square set to the padding width.

For example to get a 4-pixel-wide checker on a 512x512 image, tile the checker image 64 times... if you calculate that the checker image has 2 checker squares across it, then the checkers bitmap should be 8 pixels across for a 512 image, and 8 pixels goes 64 times into 512, so that means it needs to be tiled 64 times across your UV square. Remember though, that if your UV space isn't square, then the checker tiling needs to be adjusted.

Padding Tools

Texture-baking tools usually have an edge padding feature.

  • 3ds Max > Render To Texture > Padding
  • Maya > Transfer Maps > Fill Texture Seams
  • Xnormal > Edge Padding

Photoshop has several methods for edge padding:

  • Filter > Other > Maximum. <
    >Before running the filter, fill the empty areas with black, and make a non-anti-aliased selection of the empty areas. Beware that when the padding overlaps itself, it does so additively, over-brightening the pad colors.
  • Xnormal has a Dilation filter that works well. <
    >Before running the filter, make sure the UV shells are together on a single RGB layer, and the gutters are transparent (deleted).
  • Eric Chadwick has an Action called UV padding from Alpha that adds an 8-pixel edge pad. <
    >The Action is slow, but it greatly reduces pixel-streaking and is non-destructive. Before running the filter, make sure you have a non-anti-aliased alpha channel, with white shells and black gutters.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools