Source Lightmap Index vs Destination Lightmap Index?

I couldn’t find an explanation on the differences between these two options on the build settings of any static mesh. When I import my meshes, (uv0 + uv1), I’m not sure if I have to set the source/destination lightmap index to 1, or if UE4 is using self generated lightmaps? I have set the “Generate Lightmap UV’s” checkbox to be unchecked, and then reimported my mesh, but now do I set the lightmap index(es) to 1, or leave them as is, at 0? I want to use the lightmap I imported from Maya, and not have a UE4 generated one! Thanks!

Hi EoinOBroin,

I want to use the lightmap I imported
from Maya, and not have a UE4
generated one!

I’ll cover this one first since you don’t want to use the auto-generated lightmap UV. If you’ve already created your second UV channel for your lightmap and set it up the way you’d like then all you have to do is uncheck the option “Generate Lightmap UV” when you import your mesh. This will forego creating any lightmap UVs.

To verify, once you import your mesh you can open it in the mesh editor and look at the static mesh settings to see that the lightmap coordinate index should be set to 1 and if you click the UV icon in the tool bar you can change to UV channel 1 to see your lightmap UV.

Source Index (UV Channel 0): This is literally the source from which the lightmap will be created. Depending on how many UVs you have setup you can specify any one that is needed. Typically there is only one UV for your texture though. All that’s happening here is that when the lightmap is created this is the UV specific channel that will be used to create the lightmap UV.

Destination Lightmap Index (Typically channel 1, but can be specified): This is the UV destination you want to specify. the default is UV Channel 1 as most models only have a single UV for their texture (UV channel 0). If you have multiple UVs, you may not want the lightmap to be assigned to channel 1 and may want to make it channel 2 or more. SpeedTrees use multiple UVs, so having the lightmap be something different would make sense here.

I hope this has helped and if you have any questions regarding lightmaps or it’s generation within the editor please let me know.

Thanks!

Tim

Many thanks for this excellent and thorough explanation! Just to make sure- assuming I uncheck the “Generate Lightmap UV’s” box on import, the Source/Destination lightmap indexes won’t apply to my model at all, as they are only used to generate a new lightmap if the model doesn’t have one?

That’s correct. You won’t have a need to use any of the in-editor generation of Lightmaps. This is almost the same feature that has been in the editor since UDK. The main difference that they are on by default now for the import options and it’s got a better algorithm for packing the UV islands.

This is mostly helpful for those new to modeling and UVs or Unreal. They would build lighting and see the lightmap error for overlapping UVs. Brian Karis re-did the lightmap process to make it a little more fluid and offer something a bit more automated to help those who didn’t want to make them or to help alleviate some of the issues that can block someone from developing more quickly.

It’s only been in the editor in this state since 4.5 so it’s still got some issues, but the bigger issues have been resolved and I can say that I honestly don’t see or answer nearly as many “how do I make a lightmap” questions now. Not that I minded them. :slight_smile:

Thanks for the help, now I properly understand how UE4 deals with lightmaps, much appreciated!

I feel stupid but I still dont understand difference between Source Lightmap Index vs Destination Lightmap Index? Why I cant put UV of lightmap and finish with it really dont get it, they complicate too much with these lightmaps and confuse me all time??? also there is no option with datasmith to uncheck auto generate maps, and it always made stupid map… so i made my in max but this indexes makes me mad. Please help

The clear and simple answer is:

If you’re doing your 2nd UV “manually” in your 3d creation software then you don’t need to care about [source lightmap index] and [destination lightmap index].

But if you’re relying on UE4 auto UV generation and lightmap creation then;

Source Lightmap Index:
It selects the UV already done externally, it should be 0 as it is the first one. ((that is UV1 in 3dsMax - aka the one used for your texture mapping)(unless you created additional UVs for specific reasons?).
That UV will be repacked by UE4, then moved to another channel, the destination lightmap.

Destination Lightmap Index= the UV channel that will be created or assigned for the lightmap. So you’re using the first UV channel (Source: 0 - in UE4) then you would be setting the destination to 1 (the second UV in UE4).


So, common setups would be:
[SourceLightmapIndex] UV:0 (the basic one used by your base color texture)
and
[DesinationLightmapIndex] UV:1 (an new independant UV “optimized” for the lightmap that doens’t mess up your the UV of your base color.

If you were using many material IDs in UV:0 then they will all be packaged into a single ID and UV channel: 1. Again, anything UV:0 or any material IDs for your base texture will be kept intact.


Also, it doesn’t help that UE4 first UV is 0, while it usually is 1 in 3d softwares like 3dsMax. So that can get confusing. Think of 0,1 etc as orders, not actual designations from your external software.

And watch out; if you search for UV parameters in the UE4 object 3d viewer search tab, then tweak values, it won’t show up the [Apply] button, therefore simply hitting [Save] won’t register your changes. Make sure to set your UV parameters by scrolling down to the parameters, don’t “search box” for them.

Otherwise: Unwrapping UVs for Lightmaps | Unreal Engine Documentation

hi there I have problem with these material…

269651-fix-error-black-twosidedmat-ue4-2.jpg

is this some sort of lightmap problem? thanks

Are you doing the 2nd UV in UE4 or in a 3d software? Either way, check your 2 nd UV.