Complex scene from 3ds Max to UE4: overlapping uvs

Hello Everyone,

I apologize beforehand since I’m sure there’s an answer somewhere already, however I could not find it yet…

I’m into UE4 since a couple of weeks, and I get stuck in the very common issue of the msg error after the lighmap build: overlapping UVs.

Let’s say I’m exporting from 3ds max. It’s an old scene, already set up, that I want to import in UE4. The fbx looks perfect after the import. However after the lightmap build I get the error. I tried to add a new UV Channel in the fbx properties (generate Lightmap uv) but no changes in the slot (there’s still only the UV channel 0, and not a new one to select). Maybe because it’s a complex volume made of many objects in 3ds max?

Should I do this in 3ds max? However there’s a twist: it’s not a single object (250 objects by the way…), so I cannot unwrap all of them and I bet that attaching all those volumes into 1 is not a good idea…

Any link or help to this problem?

Thank you guys, cheers!

You would need to split some of them off (start with splitting them by material) and then you would need to do a second UV channel for lightmaps for each object. 3ds Max has an automatic flatten UV’s option but it doesn’t give as good results as doing them yourself.

By splitting you mean not export everything in one time but multiple exports, maybe divided by material?

However there are too many objs, how do I know which one I need to separate from the others? It’s an interior scene with a complex level of detail.

Thank you so much for you quick answer btw! Cheers

If you have separate objects in 3ds Max, you can select them all and export as a single FBX file to UE4, when you import there is an option you can check that says “Combine Meshes” which if there are multiple meshes in the file it will combine them into one, you need to make sure first that option is not checked.

If it’s a single object containing many separate objects (Element sub-object level in 3ds Max) then you need to split them up in 3ds Max beforehand. I’m guessing it will have several materials applied so in Editable Poly you can go into the Polygon sub-object level and then scroll down to the Material ID’s section, it has a dropdown which can list all of the materials on the object and you can select polygons in the object by material. Then you would use Detach to separate them out to a new object.
You’ll then want to make sure that each object only has that material applied, if it originally had multiple materials applied then it will have a Multi/Sub-Object material which is basically a list of the materials and their corresponding material ID’s, you would need to drag the correct material to its own slot and apply it to the corresponding object. (there’s probably a script on Scriptspot that can do this all automatically)

To set up automatic UV’s, apply the Unwrap UVW modifier and go to sub-object level 3 (Polygon) then open the UV Editor. In the UV editor window, go to the Mapping menu and select Flatten Mapping. This will pop up the options for doing automatic UV mapping, it splits by the angle between polygons and then packs them all in the 1x1 UV space. The issue with this method is that it will split things up more than necessary, but it’s possible you can get OK results. It should end up with results where polygons are no longer overlapping. You will need to do this for each separate object. Make sure to set the UV channel for the Unwrap UV modifier to the second UV channel.

When you import to UE4, there’s an option for generating Lightmap UV’s, you want to turn this off, all it does is use the existing UV mapping seams and flattens them and packs them, it’s not a complete UV mapping tool. So by default with the generate Lightmap UV’s turned off it will assume that the second UV channel is your lightmap UV’s.

Wow, thanks in advance man! I’ll read it carefully and tomorrow I’ll try it out. I’ll let you know! Cheers

In Max you can use the XView to visualize them. Hit the ‘+’ in the top left of the viewport, -> xView -> and you get a ton of handy options, including the overlapping UVs.

Thank you both!

Ok, so the best thing according on what you say is: unwrap on 3ds max, flatten and change into map channel 2, so that Unreal will know that this channel will be used for lightmap only.

However as you said, you gotta do this for each single object in the scene. 250 times! And the scene is not so complicated as other scenes with more other objects. I couldn’t find a script for this purpose, in order to flatten every single unwrap of every single object in one time and change their channel. How come there’s not an automated way to do it for scenes with hundreds of objects?

Even in Unreal, if you generate a new UV for Lightmap, you still gotta go and change the UV Channel from 0 to 1 for each object…

Thank you again for your time!

If you already have 250 objects, and some of them are small or not complex, then you could Attach them if they use the same material, and then you would have fewer objects to deal with. I know there’s some scripts or plugins out there that have a window where you can do a one-click flatten. In UE4, as long as you have the two UV channels (the first is for your regular materials/textures) then it will automatically set the second as the lightmap channel.

I did not think to attach the same material objects, that would help al lot…thanks!

Anyway, i did a try with one obj. I unwrapped it, moved to channel 2, exported in fbx. While I put it in the scene, i still got to double click it because the default channel is the 0 and not the 1 (which is perfectly non overlapping by the way). Is there maybe an option to tell Unreal to import an object with the channel 1 and not 0 by default?

Thank you again for your tips man, you’re so helpfull!
Cheers,

Maybe I’m wrong, but the option Destination Lightmap index is always set to 1. That makes me think that the scrolling down menu, even if it shows the channel 0 by default, does not have anything to do with lightmap except just showing all the uv channels inside the geometry.

I just built the lightmap without changing it and it works!

If you have an object already in UE4 and you import it again then it will not update the lightmap UV channel if you changed the UV’s, it will only automatically assign the channel when you first import.
If you have a single UV channel that already fulfills the requirements of a lightmap (not overlapping, fits within the 1x1 UV space) then I don’t think you have to do anything extra, if it doesn’t have a second UV channel then it should use 0

In the static mesh window, it has a section for generating lightmap UV’s, which is what the Destination Lightmap Index is for, since that will tell it what channel to generate the lightmap UV’s to. Since you don’t want to use that feature just ignore it, the actual setting for the lightmap UV is in a section below that.

Thank you again! Right now I don’t get the overlapping UV msgs anymore. However when I build the lightmap i get spotchy results like this one:

I also tried to change the value of the lightmap resolution, but no changes. What could it be?

Thank you again.

That means the lightmap resolution is too, you can either use the Lightmap Override for the object in the scene or change the setting in the static mesh itself from the Content Browser. Since that’s kind of complex as an object, it will need a high resolution lightmap and if you didn’t change it from the default of 64 (64x64 pixels) then that’s definitely too low. If you’re doing archviz stuff I would just bump it up to 1024

I just did that and it improved a lot…and yes I’m doing archviz :slight_smile:

I imported the whole scene right now, and even though I’ve flattened every unwrap in the scene, I still got a few wrapping and overlapping UV in some objects, even though the UV seems perfect to me. Sometimes flatten is not enough maybe?

Sorry if I repeat myself, but thank you so much for your patience. The early days in a software education are exciting but also pretty confusing :slight_smile:

There’s a small chance that an object might still end up with overlapping UV’s. If there’s something like a quad or an n-gon and it’s a concave type shape then it’s possible that when the mesh gets converted to triangles it might do it in a way where a the triangle goes across another triangle.

In fact, it’s a pile of concave plates. And it’s only object left with wrond lightmap (wrapping UVs). What’s the best solution for a case like this?

In 3ds Max, it would help if you connect vertices across the middle so that when it triangulates it can’t put an edge in a way that makes overlapping triangles.

I’ll try that :slight_smile:

Thanks mate! Have a nice one