seamExpander – Texture seams suppresion

Type: Photoshop Java Script (jsx)
Name: seamExpander
Version: 1.0
Released: 2007.01.05

Target of this script is to create a quick automatic expansion of texture contours in order to eliminate problems with seams. For example, zBrush can create a texture with artifacts on seams (mainly at skewed mapping border edges) and there will be black pixels after rendering (actually, that’s the main purpose I’ve created this script to deal with).

– Purpose and Usage –

Select a layer with texture you wish to expand contours for. Run the script. New layer called seamExpand containing resulting contours will appear. Original texture won’t be modified in any way.

Now about how it works. GUI of the script looks like this:

Right away you can press Expand contours button and get a result based upon default settings. Script will search for regions of “nothing” in texture, that means, where there’s no texture data – often for textures it’s a black background. Color of this “nothingness” is defined by the left-most up-most pixel of the image (since usually it isn’t used in shell textures 🙂 ) Using this color, script makes a selection depending on one of the next modes:

Sample 1×1 pixel – non contiguous – expansion of exterior contours only. From the mentioned pixel selection will grow untill it’s closed. Since textures are usually somewhat off the borders of the image, it should select all exterior borders. Interior ones (for example, empty region of the eye or nostrils, or nails in the sample image I provide here) won’t be expanded.

Sample 1×1 pixel – contiguous – (default) expansion of all borders. Defined color will be selected in the whole image, both exterior and interior contours will be expanded (that way unwanted regions could be involved if they have the same color as the blank background. But since all results are stored in separate layer – they could be corrected by hand if necessary).

Use custom selection – expansion of custom regions, selected by user. Regions of blank background should be selected manually before running the script. Color of 1×1 pixel doesn’t matter now. It’s made for hard situations and for expansion of specific regions only. Illustration below shows manually pre-selected region of the nail in red (non-running ants are too awful to show 🙂 ) – only it’s borders are expanded.

Num pixels to expand – width of the expansion. By default – 1 – and this usually gives the cleanest result. If you need, you can run the script several times with one pixel expansion. But you can explore this setting if you wish to.

Overlap contours – overlap of expanded contours over original ones. By default – disabled – just adds new contours to the original ones, without layering on top of them. If value is set to 1 – new contour will overlap original by one pixel, if value is set to 2 – by two pixels and so on.

Illustration above shows expansion set to 2 and overlap to 1. As a result you’ll get new contours in the next region – two pixels outside and one pixel over the original ones:

Tolerance – controls the selection of color “by similarity” to the 1×1 pixel. By default – 0 – only pixels with exactly the same color will be selected. While increasing value also similar colors would fall into selection. I need this primarily for elimination of artifacts that could appear on the seams of zBrush textures. Illustration below shows rare pixels of almost-white color. I filled black background with full-white, but since those pixels are only almost-bright, script will consider them as a part of a texture during expansion if the Tolerance is set to 0. Raising Tolerance to 10 solved this issue in new contours:

Anti-Aliased – enables anti-aliasing for selection – could be useful for textures that has been scaled down with filtering and in other cases.

– Installation –

To install the script you need to place it into Presets>Scripts folder in you Photoshop directory (i.e. D:\Photoshop\Presets\Scripts\), restart Photoshop and run the script from File>Scripts>Seam Expander:

Posted on January 5, 2007 at 16:25 by · Permalink
In: Texturing · Tagged with: , , , , , ,

One Response

Subscribe to comments via RSS

  1. Written by Владимир
    on 26 September 2014 at 11:18

    Спасибо, тебе добрый человек.

Subscribe to comments via RSS

Leave a Reply