How to set a given Island margin for UV? I am building assets in blender for use in UE4. 

For UV maps and light maps I need to have 2 texels spacing around each island (i.e. 4 texels minimum between islands). To calculate what spacing I need in 0-1 space I use the formula 1/[lightmap size]*2 (e.g. 1/64*2 = 0.032 for a 64x64 map) to convert.

At first I naively plugged this value into the "Margin" parameter of the Unwrap function but this gave me a much too small margin in 0-1 space. Actually, A value of 1 (the maximum) for "Margin"  translates into a margin of 0.111 in 0-1 space. Hmm.

2 questions:


What is the math behind the "Margin" parameter of the Unwrap function?
What is the process to get a margin of a given number of texels (besides trial and error which is time consuming)?
From my tests, CTRL + P works fine and gives the correct pixel separation where the Lightmap pack actually seems incorrect. 

When using the Lightmap pack it seems that the separation is not based on pixels where packing it or setting it in the UV unwrap setting it seems correct to me.

Regards,
Kyle