Overlapping UV question

Hello, as the title says I am having issues with overlapping uvs on my meshes. The issue I am having is the meshes are pretty complex and inorder to accuratly texture them I have hand to split of the mesh in peices and assign material IDs to peices so the uv maps for each peice wont have extremely low resolution textures. In unreal the engine can not distinguish the different martial IDs and slapps them all ontop of one another. I have not been able to find a solution through rgenerating the light map uvs or adding two uv mapps through 3Ds max. The only solution I have come up with is going through each model and seperating each one out according to their uv map and reimporting them as seperate meshes. But that would take an extrememly long time to do that for every single mesh as there are over a hundred meshs roughly. Is there a way to avoid spending countless hours going down that path and changing setting so there are no overlapping uvs for the light map so the lighting work correctly?

For an object you need to have a UV channel where the UV’s aren’t overlapping if the object is going to be using a lightmap.
If your UV’s are fine but just overlapping then you need to copy them to a new UV channel and pack them so that they aren’t overlapping. You can do that all with the Unwrap UVW modifier in 3ds Max.
When you import to UE4 make sure to turn off Generate Automatic Lightmap UV. Set up your mesh so that the first UV channel is for your material, and the second is for the lightmap. By default 3ds Max will assume that the second UV channel is for the lightmap and will set the mesh to use it for that.

Also, while you can use multiple materials on an object, for performance you want to avoid that and if it seems reasonable that you could put it all into one material for that object then you should try to do that. There’s something called Draw Calls, which are commands by the CPU to render something on the GPU, and each material on an object adds a draw call. Performance drops with more draw calls.

Based on that, it sounds like because of the way the models are set up I will need to seperate the peices so the mesh matches the UVs unfortunately.

Make a multi-sub-material in 3ds Max and assign it to the object you want to create. Give the first material ID1, the 2nd Material ID2 and so on. You can make the UVs overlapping. Here is a box I did that with overlapping UVs. Make sure they are all in UV Channel 1 in 3ds Max and make also sure that the sub-materials are actually different to each other (or they will be combined), When you import the mesh do not import the textures and material with it and do not auto-create a lightmap.

After assigning the materials in Unreal you can create a light map. Go to the Build section and expand it. Set the parameters like marked in the below image and then hit Apply Changes. (The button is disabled but when you make a change to the settings it will come alive)

The scroll down to the general settings and set the same Lightmap Resolution. Finally set the Lightmap Coordinate Index to 1 and you’re done.

So, normal UVs can overlap but lightmap UVs can not overlap. You’re limit for the size of the mesh in 3ds Max would be the lightmap size. I usually combine the interior and the ceiling of the entire apartment and then give it a lightmap resolution of 1024. It works in most cases because the walls are really simple shaped.

If you want razor sharp shadows under a spot light for example you may need to set the light to stationary. Just be aware that more than 2 overlapping stationary lights will hit performance really hard.

It seems to be more difficult to add an image to this forum proper than to create lightmaps :wink:

This combined with some other tutorials helped me figure out the issue. Thank you very much for your help!