I have a problem with UV maps (Building lighting and mesh merging)

I have a model made in blender divided into parts.
Each part has its own UV maps.
I want to do it this way because I want to assign a different material and texture to each part.
(One material for the floor, another for the ceiling, another for the wall…)
There’s no problem with the materials because I make them in Unreal and they’re infinite..
But textures need correct UV size.

So when I import the model into unreal it converges meshes.
And creates a single UV map.


So far, so good. I can assign materials, and the textures are the correct size.

The problem is when I want to build the lighting. I have these errors.

So I try to fix it with the UV editor.

I use the “LayOut” function and the UVs stop overlapping.
Now building the lights is error free.

But now the textures don’t have the correct UV coordinates and are not displayed at the correct size.

How do I fix this? What is the appropriate workflow to achieve the desired result?
I want a single mesh, I want textures with the correct size, and I don’t want problems with lighting.
Help is welcome!!

Thank you so much!!

there’s an option on the importer to not “merge meshes”. maybe that helps.

i’ve have a set up where some objects are also divided in multiple meshes.

1 Like

Yes, I know, but that presents optimization problems. Draw calls cost are reduced when the meshes are converged.

Optimization is also one of my priorities. I forgot to mention that in the post.

Thank you very much for your help. @nande

I see. i don’t understand what your problem is. sounds like you have a choice to make.
i personally wouldn’t try to optimize for drawcalls to the level that it creates issues with the workflow.

afaik if you are using different materials then there’s no such thing as “merge draw calls together”. each material is a draw-call. afaik. even on nanite.
in fact in nanite meshes that are different but have the same material have some optimizations and trigger less draw calls.
there’s also instance meshes, hsim, and auto instancing which i think you might be aware of, but good to remind them for other readers.

that does not seem to be an option from my pov. that’s why i meant you have a choice and not a problem. but i don’t know a ton about uv mapping in ue, i’d assume you know more than i do.
i have an idea though.

this is an idea:
if you are authoring those models, you can, when authoring them, position the uvs with a padded size.
so that when merged, they don’t overlap. i’d need to draw it, but i think it’s clear enough.

that probably means that your textures are going to be larger. as they all will be padded.
i don’t think you can build lightmaps with overlapping uvs. i think that’s just a limitation of the technique (not even the implementation).
afaik a lightmap is a texture, so it’s ONE texture per MESH.
since you want to have ONE MESH then your uvs can’t overlap.

Look at this model:

Each color is a different material. and each rectangle is a different mesh And Each material is a draw call.

If the meshes are separated there 2 yellow materials, three pink materials, one grey material and one green material.

If the meshes are merged there is only one yellow material, one pink, one grey, and one green.
As far as I know, that’s how unreal works.

I don’t use Nanite, it’s a very low-poly model, but it has a ton of materials.

1 Like

ah ok, so you have multiple meshes with the same material, not just one mesh with multiple different materials. i did not get that from your first post.

check out auto instancing.

again, you might be trying to optimize beyond your options.

1 Like

I’ll look into that.
Thank you very much @nande

1 Like

i’d recommend using a visualization mode to make sure our assumptions about batching and draw-calls are correct. though i would assume you’ve done that already.

are you targeting mobile or vr, so that lightmaps and performance is so important?

the only issue with autoinstancing (which afaik you don’t really need to do much to use it) is that it works for same meshes only.

but the thing is, if you can reduce DC per instance, as opposed per piece, you might still consider that as a benefit. maybe that’s an ok enough boost.

otherwise you could try my idea above, but, merge ONLY the pieces that share a material. that way you need less padding. since different materials will issue a new DC anyway.

no prob, i hope it helps. sorry i can’t give you a better answer.
good luck.

this could help, i think. https://www.youtube.com/watch?v=5iFhwplAkmw

1 Like

It’s a PC game (Multiplayer game). I’ve been optimizing the game for months.

I’ve learned that the game thread and the rendering thread get bugged very easily by small, seemingly insignificant things. (The sum of very small things makes a very big problem). And every nanosecond you can earn is important.

I really have a big obsession with optimization.

Thanks so much for the link. I’ll check it out. :heart:

1 Like

nice. me too actually, i’m quite obsessed with optimization. :slight_smile:
imho there’s always a trade-off, and some optimizations will incur in extra workflow overhead.
also i believe by definition an optimization will create rigidness, and reduce your flexibility, since it usually leverages a specific situation. not a reason to not do it, but something to keep in mind, i think.

agree. that’s something i’ve learnt in my experience that happens in many if not all things.

no prob good luck :slight_smile:
if your project is public i’d love to check it out.

also if you like optimization, please check out my free open source plugin for the significance system. it allows you to do a lot of different dynamic optimization based in dynamic rules. (for example visibility/distance, tickinterval, etc).
jerobarraco/JSig: Plugin to handle significance very easily on unreal engine 5 - Codeberg.org

1 Like

It is not public at the moment, I hadn’t even thought about it. But maybe someday I’ll make it public. I’ll remember this post and let you know if I do.

Thank you very much for the plugin. I take a look at it.

1 Like