Object Count & Lightmaps

This is somewhat of a new user question and I’ve experimented with both approaches, but I’m curious on what’s a more efficient method.

So I’ve got a model that consists of 100 objects, everything is unwrapped with both texture and lightmap UV’s and it looks great coming into Unreal with default lightmap resolution (see attached). Problem is that 100 objects for one model is quite a lot (obviously).

My question is, are you better off combining smaller models together and having lots of small UV islands and raising lightmap resolutions to something much higher than default, or just stick with the high object count and low lightmap resolution. It seems like I can never get clean baking with multiple objects combined on one map, even with good spacing without raising my resolutions to at least 128-512.

Thanks guys,


128-512 is not too high of a resolution, where it gets bad is if you have to go beyond 1024

Especially for something that has that much detail. But you should be able to get good results if they’re combined if you have good UV mapping for the lightmap UV’s.

Also, having each object as a separate object increases the draw calls–each object is a draw call and then there’s an additional draw call for each object per each material, so that increases the draw call amount by a massive amount.

Ideally, an object should be 1 part, 2-3 can be okay, but 100 for one prop adds way too many draw calls. If that’s a hero asset, you could get away with 1024, but I bet you can get good results with 512 if you scale down parts that aren’t important or that you don’t really see.

Thanks for the advice, I combined my model and re-packed the UV’s. With a lightmap resolution of 512 it looks nearly identical. There seems to be a lot of bad practices out there when doing arch viz walkthroughs, thanks for clearing this up for me!

If you’re doing something just for rendering an image or if you have a beefy computer to do real-time walkthroughs then it’s not necessarily an issue, it’s just best practices method if you’re trying to keep things optimized for real-time

I have a Titan X card so I don’t really see any issues, but the clients I hand these walkthroughs to do not have anything even close so optimization is always going to be key.

I have this question too. In the official docs it clearly states (at least I understand it like this) that you should split your object into multiple objects for better lightmapping, and that you should bring down lightmapping resolution as far as possible (they say 32 and smaller). I’ve also heard this in multiple tutorials and from advanced users.
As a longterm 3D artist this seemed counterintuitive to me from the start. I have no idea how UE4 processes those lightmaps, but consider this example:
I have a single object consisting of 4 boxes. For lightmapping I have 4 sets of UVs “compressed” into one UV layer. I set a lightmap resolution of 64, which is too small, so I increase it to 128. At least with textures, 128(x128) should take 4 times the memory that 64(x64) does.
So what’s the use of splitting the object into 4 objects and leaving them at 64? Wouldn’t UE4 have to create 4 lightmaps then, resulting in the same memory usage?

If the lightmap is essentially equal if you have 4 objects vs. if they’re attached, then it would be the same memory usage. In those cases, it would be better to have the objects as a single object, because the separate objects would increase the draw call count.
In the case of a building for instance, if you have a bunch of walls that’s a lot of surface to cover, so rather than attaching all of the walls as a single object and using a really really high resolution lightmap, it’s sometimes necessary to instead split it into pieces–that essentially means you’ve reached the limit of lightmap detail within a single object and you need to split it up to be able to increase the quality by using multiple lightmaps.

Another reason to keep things separate, is to take advantage of instancing–meaning that if you use an object more than once then you can make copies of that object and it will then keep only one in memory. That’s something where you have to consider, will the game perform better if I reduce the memory usage or by reducing the number of draw calls? Usually if the mesh is very simple, then you’ll want to reduce draw calls because the memory impact isn’t a problem, but if the mesh has a high poly count then you might see more of an impact by using copies and saving on memory.

The mistake many people make is to try and build walls/ceiling/floor out of lots of pieces, when usually those meshes are very simple and you’ll get better performance by just making the full shape and taking a small memory hit.

Another thing to consider, is how UE4 generates static lighting–it gets processed on each static mesh, which means that some lightmass settings like smoothing get calculated on the individual object rather than across objects. If you have a flat surface made of multiple objects then you can end up seeing differences in the lighting between the meshes. In those cases, you either need to add detail to your mesh on the seams so that you won’t be able to tell, or you need to make those parts as a single object.

darthviper107 thanks a lot for the detailed explanation!
I’ve been searching for exactly this info for quite a while! Maybe add your text to the docs, like some general info box?

I can’t edit the documentation, that’s up to Epic people

Hey Darthviper107,

I would like to understand your point as I am also rubbing my head with the lightmaps…

You say if you have a bunch of walls you separate them instead of using a really high resolution.
then you say the mistake people make is making walls in multiple pieces instead of making the full shape.

This is confusing me because it sounds contradictory.

Do you mean, in the case of walls, it may be a good idea to bundle up some of them until a fair lightmap size is reached, then start a new piece, instead of having every single piece detached ?

I have this object I modeled, I followed everything I could find from epic’S documentation to stuff on youtube or other web posts. I know I can get rid of the shadow bleeding by craking up the lightmap, but the point is I want to understand how the system works. And until now, I thought I got it, but I still get the shadow bleed.
So i made the cleanest unwrap I could on channel 2 (3dsmax) I set the grid to be divided by 1/128 (knowing I would be using a 128 res lightmap in UE4) I snapped every vertex to grid, I left 4x4 spaces between UV’s (as epic documentation says lightmaps are calculated in 4x4 blocks and recommends leaving that as padding) I also thought of faces that would normally be in shadows like bottom of piece and got them out of the way of others that would normally be in light. And I still get this nasty line of shadow bleed along some seams. I just can’t understand how the lightmap could have put it there.

Anyway, thanks

It’s hard to say what the bleeding could be caused by without a screenshot–what usually causes it is when there’s a surface that isn’t visible (like the bottom of a wall, or a piece of floor going underneath a wall) which will cause shadows that don’t match where objects are.

The other issue in terms of modular pieces–you need to keep things like floors, walls, and ceilings as a single object as much as possible. Each object gets processed by themselves for lighting so there can be slight lighting variations which become obvious when a planar surface is next to another planar surface (like building a wall out of multiple sections). So you start by attaching as many parts together as you can, so for a building you would have the floor as one object and the walls as another. After that, you consider what would be a reasonable lightmap resolution for the mesh and if you think that the lightmap might not give enough detail due to the object having large surface area then you consider splitting it up. For walls, it’s pretty simple because you can split them on the corners. For floors, it’s a bit more complicated. You can adjust some of the Lightmass settings to improve the results, like increasing the quality setting (more lighting samples) and decreasing smoothing (which will make it more accurate but will end up noisy without more samples).
The other thing is that if you can place an object on the seam between meshes then it can help hide the lighting differences, so like a pillar or something between wall sections can help.