Whats the best lightmap resolution ?

hey guys,
I would like to know if there are any suggestions for the lightmap resolution? for big assets, for small assets, assets with a lot of polygons / triangles etc…
I know that there is no common answer to this question cause every assets it different but i guess there should be a tendency… to go not over resolution X or not to go under resolution X…

Regards
Adik

I nearly always use a lightmap resolution of 128 -> works really well for every kind of mesh :slight_smile:

Thanx for your reply… do you even use a 128 lightmap for big assets like a roof? or a big plane / wall etc… ?
I’m wondering if there is any difference using higher lightmaps… ?

Ideally, you would want to have one lightmap pixel per screen pixel. As you say this is of course very hard to achieve, and depends on your meshes, how they are UV unwrapped, which sides are commonly seen and so forth.

In the end you’ll just have to try it out: start with some value (e.g. 128, as suggested) and look closely at your meshes. Blocky / jaggy shadows? Increase the resolution! Still hi-res when you’re very close? Probably decrease, except if you want it to look really good and require high-end hardware :stuck_out_tongue:

That said, keep in mind that every GPU has a maximum supported texture size. Most GPUs should support at least 1024² pixels, but keep an eye on that if you want to support older GPUs.

It wont be so good for the performance when you just use high lightmap resolutions for all your meshes -> so as Daerst said, just choose a resolution, build the light and then check if you can see black spots or wrong shadows on your mesh

ok, many thanx guys!

Hi Adik,

I just want to add a bit more here as well. I don’t think anyone mentioned this above, sorry if I’m wrong, but one key factor that goes with your lightmap resolution is how well your UV is laid out.

Having a good layout in your UV to maximize space is key to keeping your lightmap resolution lower.

ie. if I were to model a large object and just used something like Flat Mapping in to throw down all the polys spread out without consideration, I could keep upping the resolution and still have plenty of issues. However, if I maximized my space and laid everything out well I could probably get away with a 128 or 256 () resolution.

Another consideration is targeting a specific resolution before hand for your lightmap. This is more for anything that will have hard edges or being used more for modularity.

(A lot of this info if not all can be found on World of Level Designs Lightmapping tutorials)](://worldofleveldesign/categories/cat_udk.php#lightmapping)

What I mean by choosing the resolution is that you will need to place your UV edges in your modeling software before importing into UE4.

ie. If I want my lightmap resolution to be 128 and no higher I would do the following.

You will need to set up the grid in your UV channel.

To set up the grid properly to account for the resolution you’re targeting you will need to do the following: 1 divided by # of pixels you want.

1 / 128 = .0078125 will be the spacing for your grid lines. (more info at this link specifically)](://worldofleveldesign/categories/udk/udk-lightmaps-02-uv-techniques-and-how-to-create-second-uv-channel-in-maya.php)

This may be a lot to take in but a good lightmap can really help! :slight_smile:

If you have any questions feel free to ask!

1 Like

A lot of it matters how detailed something is, even if something is big, if it’s like a big plane then you can get by with a low lightmap resolution because there’s no seams and the lightmap covers the object very well. But with more detailed things where you have to have seams and several UV islands, you need a higher resolution so it can get the details.

Thanx for your answer , thats what i alreday noticed, having a good UV map, i mean not just a simple “flatten” uv map in 100’s of parts helps a lot.
If you develop a game, is it recomended to keep the lightmap resolution small ? or is it becasue of quality or whatever to increase the resolution a bit ?

@darthviper, i also noticed that, i have some not so big assets but with a lot of polygons “UV mapping” not so much optimized, so i had to increase the lightmap.

I guess the correct answer to the question be: “Depends.”

I know it may seem like a cop-out answer but really it would come down to what fits the look you want. On “hero” objects that are going to be center pieces and larger I would want better lightmap res. On background unnoticed objects lower.

Overloading your scene with objects that have huge lightmaps would probably not be best thing.

Once you get your layout down, do some tests and see what you think looks best for your game. Having something prototyped and tested early on will help alleviate some issues you may run into later on.

If you run into issue feel free to ask! :slight_smile:

Many Thanx!

So there’s a post on reddit that says the correct math for your UV grid size isn’t 1/Lightmap resolution but actually 1/(Lightmap resolution - 2). The reason the OP states is because lightmaps in UE4 use a 1 pixel border for filtering which means you lose 2 pixels on your height and width.
So instead of 1/128 the math is actually 1/126. This sounds right to me and I’m currently testing it out but I was wondering if maybe I could get one of the technical artists from Epic to weigh in on this.

If that’s the case then it wouldn’t reduce the lightmap size, it would simply mean that the edges wouldn’t be useable–the reason for a power of 2 resolution is mathematical and it’s not something that would change.

I always use the Lightmap Density View to determine which Lightmap resolution to take. I round it to the nearest power of 2

This thread is a goldmine for me as I’ve been using the engine for 3 years but never did light baking. Have a lot catch up on.

But it would change the grid size of your UV layout. I’ve had a second artist over on polycount confirm this but he said that you don’'t have to adjust the math 1/128, you can just adjust the lightmap resolution in game so you’d use 126 instead of 128. Again I’d love to hear what one of the tech guys at Epic says for the definitive answer. Would explain why the World of level design tutorials awesome as they are, still end up with slight seams on his perfectly lightmapped mesh.

If it’s doing something on the edges it isn’t likely to be cropping the image, even then, snapping to the pixel grid isn’t hugely important since there’s many non-rectangular objects that can’t do that.

Yeah I don’t know. His logic is that it affects the middle of the lightmap. I’m way too new to lightmapping to actually weigh in with any useful information :stuck_out_tongue:

Hello , sorry to post so late in the discussion. I am a beginner at unreal and using blender as my modeling software. So about the lightmaps, I exported walls at 128 pixels. (We have the option to choose the size of the lightmap on blender while exporting) but for some reason at 128 lightmap resolution the walls will have strange shadows and seems… and can only be eliminated by choosing lightmap res as 1024.( Which is pretty high) Now what should i even do so that I don’t reach 1024… and make the wall look flawless at 128.? I am using Smart UV project option on blender which automatically lays out the UV unwrapping layout. Can you please get back to me on this? Is trial and error the only method?

Given age of thread & not knowing if you are still monitoring- but since you asked and I"ve been using video that seems well thought out and executed maybe this will aid you :

?v=3TqQH1fZAtM