Texture seam question
![shoei321](https://secure.gravatar.com/avatar/31b993fbdbdfe93da16bdd489b6a6777?&r=pg&s=100&d=https%3A%2F%2Fvanillicon.com%2F31b993fbdbdfe93da16bdd489b6a6777_100.png)
I've noticed that the G2/G3 skin textures all have a "flange" radiating outwards along the outer edge of the UV-referenced areas (see the attached pic). When I create textures that don't have these flanges I notice visible gaps in texture mapping along UV seams. So I assume these "flanges" are to address that issue.
My question -- what is the recommended best practice for how to create these flanges when creating your own textures? How far should they extend from the UV-referenced areas? And out of curiosity, why are these flanges necessary in the first place?
Thanks
![](https://farnsworth-prod.uc.r.appspot.com/forums/uploads/thumbnails/FileUpload/4c/cec23f7c0d0f36f1a8858fd9e37fb9.png)
![](https://farnsworth-prod.uc.r.appspot.com/forums/uploads/thumbnails/FileUpload/4c/cec23f7c0d0f36f1a8858fd9e37fb9.png)
tx_flange.PNG
344 x 346 - 37K
Comments
UV coordinates (and the vertex positions associated with them in the 3d mesh) are not precise. We think of them as precise, but they only have about 6-8 digits of precision. But when the calculations are done to determine where the 'edge' pixels are, some will land slightly inside or outside the 'edge' between the UV coordinates. Inside isn't usually a problem, but outside means the actual texture needs to 'extend' beyond the actual UV map by 1 or more pixels. This is mostly due to rounding errors and that some numbers just don't have binary equivalents....they're close, but not precise. So the edges can 'bleed' over a bit.
Usually textures are created and then the edge pixes at the UVs are 'smeared' out (perpendicularly from the edge) into the unused space, so that they are very close to what was adjacent to them (on the 'inside' of the map edge.) The corresponding edge (if it's a closed edge on the object) should have the same color values, and the same smeared colors.
That way, if the calculations round outside, they still get the right value..
If you are using some texture painting or baking program (like 3dcoat, for instance) there is an option to set the amount of padding that it creates. When using gimp, there is plugin named UV-Padder somewhere in the internet. Often simply filling the background of the texture map with a single color would also suffice (e.g. for leaf-textures fill everything green, for skins fill everything with a flesh tone and so on).
As much as possible. The best is to have no background at all. I.e. extend the texture areas until the next UV-island is in the way. The minimum extension necessary depends on the size of the texture and the size of the render (including some oversampling and anti-aliasing tricks and such).
A biased renderer (like 3delight) renders by doing some fixed number of operations per output pixel. This includes texture-lookups. But often the texture-images are much larger than the rendered image, so the renderer has to reduce the texture somehow. For example: i am rendering a character to a 400x400 pixel sized image. The character has a 4096x4096 pixel sized texture mapped to it. So in the average, one pixel of the render contains actually a 10x10 pixel sized area of the texture. If the shading rate is 1, for each pixel rendered, the renderer reads a 10x10 pixel sized area from the texture. If that pixel is on the edge of an UV-island, approximately half of that 10x10 area is outside the UV-island. Half of 10x10 is an area with a diameter of 5. So i would need a padding of 5 pixels to avoid having the background bleeding through. The smaller the render or the larger the shading rate, the bigger that padding has to be. (This is the reason those seams disappear when you zoom in).
An unbiased renderer, like e.g. luxrender does have this problem, because it has no fixed samples per rendered pixel, but usually it would need to render longer (take more samples) to get to the required texture/render pixel ratio (otherwise it will produce noise). Floating point truncation has practically nothing to do with all this.
It is a bit more complex than that, though...because 3Delight creates mipmapped versions of the textures. So there is the another layer where things can go wrong...when tdlmake is creating the mipmaps.
Several of the texture tutorials I've seen over the years recommend at least a 6 pixel padding...but yes, more is better, usually.