What's dimensions is the UnwrapParam.packMargin property in?

I am using Unwrapping.GenerateSecondaryUVSet (mesh, unwrapParam) to generate lightmap uvs for my meshes. The provided unwrapParam variable of type UnwrapParam has a parameter called packMargin. This parameter is extremely useful, as it helps greatly with reducing bleeding light edges when baking lighting. However, it is a complete mystery to me what dimension this parameter is in. If I put 0.1, I see roughly 11 texels of separation between islands in a 1024x1024 lightmap at 16 texels per unit lighting resolution. Halving the lighting resolution halves this to about 5 texels as one would expect. What I do not know is if object size affects this as well. What exactly is this value?

After some testing, it appears this value applies to the object’s lightmap uv space, where the coordinates are still in the range [0,1]. Quoting the docs on lightmapping, “The final resolution will be proportional (Scale in lightmap) * (Object’s world-space surface area) * (Global bake settings Resolution value)”: because we cannot predict the used width/height of the generated uvs, evaluating this formula is useless: we would know the expected used area, but not its dimensions in the generated uvs. It could be 1 by 1, or 1 by 0.1. To make it worse, there are small unknown, but non-negligible terms in the scale calculations done by the lightmapper, making it even harder to figure out what the scale is going to be. Because of this, it is not possible to predict how many texels a given packMargin value will evaluate to. One can only make an educated guess for its ideal value of 2 texels of uv island-spacing to be at most about 2 * sqrt((Scale in lightmap) * (Object’s world-space surface area) * (Global bake settings Resolution value)) / (Lightmap width). A possible hack could involve unwrapping with a packMargin of 0, peeking at the mins/maxs of the generated uvs, using them and hoping they won’t change too much upon unwrapping again. Other than that, unfortunately trial and error is required.