Lightmap resolution blender to UE4

Hi all,

I am exporting models etc. from blender to UE4. I create lightmaps via the lightmap pack function. (though i have tried the other methods, smart & normal uv pack i find the best results with this so far…).
My question is, can some one explain the “mapping”/idea/comparison between blender lightmap resolution and the settings in UE4.
I.e. if i make a 4k lightmap in blender but have the settings to 512 in ue4? ie. if i have 4k in blender and 4k in UE4, and if i have 512,1024,etc in blender and 8k in ue4?

Side note i normally do like a 512 or something in blender, and the up the settings in ue4… that normally removes the evil black artifacts… but who knows if i am doing that right… hence my question

Thanks in advance,

  • blender+ue4+noob+rand()

crickets…

Hi RUWD,

I’ll preface this by saying that I do not use Blender, but the advice and documentation I point to should be valuable no matter what program you are using.

First of all the documentation here should help you in how lightmapping UVs should be setup: Understanding Lightmapping in Unreal Engine | Unreal Engine 5.1 Documentation

Now to answer your more specific question:

When you create your lightmap in any program you want to setup a UV that is specific for your lightmap UV. This isn’t a requirement, but is generally suggested because the layout of the texture UV and the lightmap UV will differ drastically! Lightmap UVs require that all UV faces be within the 0,1 space and that they are not overlapping otherwise you’ll get light bake issues/artifacts.

When you pack your lightmap UV you will typically need to target a lightmap resolution. This can be done in UE4 using the auto generated method for packing or by doing this manually yourself. I don’t know how the UV layout is setup in Blender, but in Max I cannot target a specific resolution for a UV layout. I have to setup a grid and then use the forumla 1/[Lightmap Resolution target] = some small grid space value. Once I have this value I not have the pixel grid for that target resolution and can make sure that there is at least a 2 pixel spacing between any UV islands so that there is no bleed. Sometimes you’ll need a little bit more spacing.

So as an example, if I were not sure that Blender or whatever other modeling program actually was able to space these UV islands at least 2 pixels apart based on the resolution that I put in I would make a basic UV for my lightmap that separated the faces and had it setup according to the documentation linked above and then I would let UE4 do the packing of the lightmap for me so that I would be certain it was packed correctly.

Follow the steps here to repack the lightmap and get the correct spacing. Just make sure that the source lightmap index is set to your lightmap UV (typically 1) and that the Destintation Lightmap Index is set to your Lightmap UV (Typically 1). Adjust the Min Lightmap Resolution to the value you want to use.

Now when you hit Apply it will repack the lightmap UV that you setup and have them spaced correctly. You’ll next want to go down to the Static Mesh settings and make sure the Lightmap Coordinate Index is set to 1 and that the lightmap resolution is set to the value that you targeted above for the Min Lightmap Resolution.

I hope this helps in some way.

Tim