Lightmap resolutions and memory size

Hi everyone.

Was wondering if any of you is working on a level that is using baked GI using lightmass and at the same time has many objects with high resolution lightmaps. I was wondering for example if my system has 32 GB of RAM, approximately how many objects can have 4096 px lightmap size? I want this information so I can decide how many large buildings should be visible at a time and thus baked at the same rendering session.

Thanks in advance

There’s more that uses RAM, like the textures of everything and the amount of geometry.

Has anyone of you baked lighting for a level with, let’s say, 100 objects each with 4096 px lightmap? is it possible with RAM in the 32-128 GB range?

I’m saying there’s no way to know because there’s other things that can use up RAM as well, it’s not just lightmap resolution. Really you just need to take a look at the object and try to use the lowest lightmap resolution that gives you the detail you need.

100 * 4096^2 lightmaps use 9GB video memory. I can’t imagine what kind of object need that big ligthmap and same time be such many times in the level. How small are the texels with that kind of resolution?

Use the stat commands to check memory details and figure out where you are memory wise; every project is different and will require doing some profiling to determine where you are and how much headroom you have.

I would recommend doing some rendering tests, everytime you add more content/memory, profile your project and see the delta, etc.

Check this link out for more info on stat commands, there’s a ton of them, and using the right one for what you need will make a huge difference so you’re not working blind, if that makes sense:

Thanks for the replies.

Regarding the meshes in question, in fact I still don’t know the final number of these large building meshes, maybe even more than 100, and I will use level streaming mostly because not all of them should be present at one time. Actually, each of these objects is a physically large building since it’s a whole building in one mesh. Think of it like if you are modelling an old Italian town for example and you have your traditional houses next to each other. Each house is a separate large mesh which you will enter and interact with. You may wonder why not each house is made into smaller parts, well. it’s much much easier for me to model/import/export this way and less time consuming. I model the whole wall/floor/ceiling model as a single mesh and then export it to UE4. Then I attach smaller models with smaller lightmaps (64, 128, 256, 512 px) on the main frame mesh such as window frames and doors, furniture, etc. However, I found since the main building mesh is large I am only getting good shading quality with the highest lightmap sizes. Even 2048 is not sufficient for most meshes. I even sometimes do cut a large mesh into 4 portions in 3ds max and give each of them the 4096 resolution in order to get the good shading result. This is my current work flow.

It seems I will definitely have to use level streaming. So, the purpose of my question was actually trying to know:

  • how large a playable area at one given time can be (means how many buildings a level can have) since this is limited to the system RAM at the time of lightmass building and video RAM at gameplay time.

I think I have to do some tests with these large meshes and see how far can I go.
Now if I start to hit the limits of my system, will level streaming solve my problem by allowing me to divide the world into separate playing areas and baking each separately? What if at a certain time in the game you should be able to view the whole town from above, will that work with streaming?

Can you post some screenshot of buildings that need 4096 lightmaps. Also I would like to see what kind of lightmap uv’s you have. Our biggest lightmap in our game is 2048 and that includes whole castle that has town inside of it. One 4096 lightmap is bigger than full nintendo 64 game. Do each bulding actually need that kind of detail?


First image is the large building which even 4096 is not enough to provide good shading. I have to slice it into 2 or more separate meshes each with 4096. The second image is a smaller building which I am getting excellent shading results with 2048.

Can you show in game shot? What kind of lighting setup you are using?

Nothing fancy, one direct light for the sun and a skylight with fog. baking the rendered image above took 35 minutes on my humble FX 8350 but gave good results.

Automatically flattened UVs in 3ds max. Doing by hand is too too much time consuming. Happy with the result this automatic mapping gave.

Building screenshot 005.jpg UVs for the larger mesh. See? it’s actually huge!

You may want to simplify those meshes a little bit, since they’re so large they’re not going to be culled that easily and 484k polys is a little high. I would either split it into smaller meshes or try and get that polycount down some. It’ll help with your light baking as well when you do, since lightmaps are calculated per-object, right now that entire building is only being calculated on one CPU thread. You may also be able to get the lightmap resolution down if you turn up the dynamic shadows around the camera even though it’s baked everywhere else, since it’ll get significantly sharper where you really need it.

Thanks for the tips

Hi again. Today I tried rendering the scene with 5 actors with a lightmap resolution of 4096 px each. The RAM usage went berserk, using all 32 GBs I have. Page filing was active to compensate for the missing RAM, slowing the whole process, as is the case with most normal Windows applications. Now would adding more high-res objects to a certain limit crash the whole process? or if there are enough page file space the process won’t crash? some advice please?

“You may also be able to get the lightmap resolution down if you turn up the dynamic shadows around the camera even though it’s baked everywhere else”

Ey Daniel, how do you do that? it will keep the Baked GI onto the lightmaps but use Dynamic ligthing and shadows while you are close to the camera?

Cheers

I think he meant that if you use dynamic for the meshes in the main area around your player or camera, then no need for high resolution lightmaps, and for the area beyond the play area it can be low res lightmaps, because you know that dynamic puts more stress on the system resources at time of gameplay. In short I think he meant to use dynamic for the main lighting method if using hi-res lightmaps is making problems.

Ive been researching baked lighting in unreal for a week or two and still have not found a solid answer to the most basic questions. How does unreal determined the baked light map sizes? Sometimes they end up 8k then others end up 64 pixels. And they are included in the same baked results. Sometimes i end up with 4 light maps and then other times i end up with almost 100. Im not really changing my assets although I am really going in on the lightmap density and minimum light map resolution to make sure they are fairly detailed. Im aiming for and orange color.

What is the internal process for combining these geometries into a single 8k texture vs. a 64 pixel texture? I believe that none of my meshes are using such a small light map resolution.

Second, its impossible to tell where this 64 pixel lightmap is used in my scene. I cant imagine that All of the light is properly baked into 1 8k texture, because I have 1500 + meshes in my arch viz scene. Its incredibly difficult to to see the lightmaps and how it relates to the actual scene. The maps simply dont make sense.

That being said Im getting decent results, but it really defeats the purpose if i cannot understand what it is actually doing and how to control it.

Ok So I’m really sorry if I’m not understanding your question but I hope I can help! This tutorial has a bit about lightmaps and how to get accurate shadows. It is well worth your time because you really should never have a lightmap that large and if you do something has probably gone wrong and you might need different models or LOD?

Light maps for individual assets can be created in unreal and tend to work fine but chances are you need more of them not higher quality ones. The tutorial also goes over how to make your own light maps. Light maps basically say is this flat face in the light or in the shadow and how much. They don’t need a lot of space to be good quality generally. It sounds like you might have to make your own light maps and set the resolution yourself in the editor?
Also sorry again if this info/tutorial isn’t helpful I’m not entirely sure I’m understanding your question right! ^_^;

Because multiple objects are being packed into one lightmap atlas. You cant control it.