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)?
  • 1
    $\begingroup$ it's indeed weird, never noticed this before. The margin parameter in the Lightmap Pack function produces different results from the margin parameter when you pack the islands using Ctrl + P. If you pack the islands after unwrapping with Ctrl + P and enter 0.032 in your example, does that reflect what you expect? $\endgroup$ – aliasguru Sep 11 '17 at 13:32
  • $\begingroup$ The Lightmap pack function gives predictable results (Margin = percentage of full map size) but the behavior of Unwrap and Pack Islands is the same as described above. $\endgroup$ – jeancf Sep 14 '17 at 8:20

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.