island margins? in what units is it?

Hello,

when you UV unwrap, you specify island margin. I wonder in what units is it?
What formula to use to make it pixel perfect? Let’s say i have 1024 texture and want margins to be 2px. What should I specify in island margin field?

Thanks

1 Like

Now, that’s just an awesome question. I’d like to know it too.

not sure but most tutorials say to set it to 0.001

this tutorial I believe tells what the measurement is

He sets it to .09 and gets this

so noone has a formula to convert pixels to margin unit equivalent used in blender?

I just tried using the same margin value with different objects and the results were always different. It really depends on the shape and size of the islands and finding a formula would be only useful if you never should manually rearrange the islands. Thus, I don’t see any meaning in further investigating this.

If blender knew even little about pixels, there would not be leaking islands at all.

In what software don’t you need texture padding? Honestly, I’m interested.

If you Smart UV cube you can clearly see that this value has nothing to do with pixels at all (set it 1 or 0.5 e.g.): this is some thing relative to island’s size. Mathematically correct number. For the convenience.

I think substance painter don’t use them when painting / in the program itself, but when you export the textures, it will generate something around the islands to make other software / game engines work better with the textures. Tell me if I’m wrong. Blender’s uv and texture tools will generate a lot of frustration to me. :confused:

What SP generates around the islands is a margin so that MIP maps look correctly. That’s the same as Blender does, the difference is that Blender only creates the margin to a given number of pixels while SP goes as long as it can. But if you don’t leave enough space between UV islands, not even SP can help you, your model will look screwd up in the distance when colors from the other islands bleed in where they shouldn’t. So even if you use SP, you have to leave enough space between the islands. What enough space means depends on the rendering engine.

I guess SP also does most of the settings automatically, but in Blender you have to click around some buttons.

Does SP rescale the islands to leave enough space for a given amount of padding or it just leaves them as imported? Or you can even unwrap in SP?

Apparently you can’t unwrap in Substance Painter. In an official tutorial, the Substance employee is doing that part in Maya: Substance Painter Tutorial - Model Preparation 01: UV Mapping and Texel Density by Substance on YouTube.
If you want to unwrap in Blender and solve the original problem, use Pack Islands after Smart UV Project, instead of using the Island Margin parameter for Smart UV Project, a parameter which is essentially broken (as @eppo mentioned, Island Margin seems to be relative to the island size, which really doesn’t help anyone). In contrast, Pack Islands uses a fraction of the image size as expected (if you want about 1/128 of the image size to be the spacing, use 0.01, rounded up from 0.0078125). There are “sweet spots” where there is less wasted space: 0.01 leaves less space on the top and right than 0.008 in my case). You can also do Pack Islands after using Unwrap (which requires manually setting seams, which is better than Smart UV Project in many cases, if you make enough seams and islands to prevent overlap).

With Textools you can set padding in pixels. “Island margin” is a relative value around each island. You can eyeball it, but won’t precise values. What Substance is doing, when you gonna export, is a bleeding / extending of colors into the island margin for Mipmapping and to reduce streaking(?)(dunno if there is a word for it).

Just in case someone’s still wondering what the margin units mean, or finds this one day -

It’s a percentage of the normalized UV space coords. So a value of 0.01 is 1% of the distance from the left to the right edge of the UV space. It’s set up this way so that it doesn’t depend on your texture’s resolution.

If you want to input say a 16 pixel margin and you have a 2048x2048 texture, in the text field just input 16/2048, and press enter. You can enter any python expression in Blender’s input fields this way.

Note that this applies only to the “Fraction” method.

6 Likes

I tried the expression within the normal unwrap margin field, as well as in the pack uv margin field. Using any of this divisions will set the field to 1.0 in 2.79.

I just tested it to make sure there’s no bug or some such.

I’m sorry, but you must be doing something wrong. It does work, in both 2.79 and 2.8.

Nevermind, i divided texture resolution with padding -.-
Works fine now :slight_smile: