Struggling with Lightmaps

Hi guys,

I have spent the last 4 hours trying to figure out lightmaps.

I have created a simple wall, un-wrapped the uvs on 2 channels, and repacked with smaller spacing, however I get all sorts of bleeds all over the mesh. I have followed various tutorials, and read the official documentation, but I cannot figure it out.

I have attached a screenshot and my 3ds project for reference. 3ds project available from here

Cheers

Have you tried adjusting the lightmap resolution?

Within 3ds or ue4?

Could you post a screenshot of your UVs being used for lightmaps (LightmapCoordinateIndex) from the static mesh browser? Typically you need to leave some room between charts to avoid leaking artifacts like those (enough for ~4 texels). A chart is a group of triangles that are together in the UV space. So each wall is its own chart.

  1. increase the lightmap resolution -> in the UE4 in the static mesh editor
  2. add a lightmass importance volume
  3. build the light
  4. do you get any warnings when you build the light?

Hi, I am unable to post a screenshot, as I am in work. But the 3ds file from the first post does have this if you want to take a look.

I have increased the lightmap res to 100 from 34 in the static mesh editor, I do have lightmass (using the FPS startup project. I have also built the light in production mode. No warnings at all.

Just a thought, would this have anything to do with my lack of dedicated graphics card? I am using UE4 on my laptop, that only has on-board intel graphics.

Hi Samo8076,

There are some things you could do to improve your Lightmap to get some better results.

Here is the original Lightmap:

A corrected layout for Lightmap:

The layout in the corrected version (a rough layout mind you) is more in line with the way you would want to do a layout. The reason being that in the original layout you did not have a padding between the edges of the UV space. This would definitely cause some shadowing around the edges you were getting. While there were no overlapping faces scaling the lightmap uvs down to allow better padding is key to getting good lightmaps.

World of Level Design has a great series of tutorials and information on Lightmaps that will give you a much better understanding to getting great results with lightmaps!

If you have any questions feel free to ask!

Thanks very much for taking the time to reply .

A few questions:
If I understand correctly, having a larger space between the lightmap uvs, is better?
Does it matter if the uv for my diffuse is a different scale, position, rotation etc compared to the lightmap uv?

Within my file I created two UvUnwrap modifiers (both on different channels), is this the correct way?

Thanks again.

No problem!

You need the spacing between the UV islands to make sure that none of the shadow information that is baked into that texture is bleeding onto any other UV island. The higher the lightmap resolution that is set will help get better shadow information as well.

The two UVs are completely separate in this respect. The diffuse can be setup however you need your texture to be represented in the game. This means you can use overlapping UVs with no consequence if this is what you need for your asset. With regards to lightmaps you do not need to worry about the rotation of the object based on the diffuse texture. This UV is solely used to bake shadow information and shadows/lights that are cast onto your asset. Because this is using the scene lighting and shadow information will not directly affect your UVs layout. (ie. having a polygon rotated upside down will not cause your shadow information to be upside down on your object when it is baked)

Take a look a the World of Level Design tutorials I linked above. This will handle a lot of the concerns with Lightmaps. This will give you the basics and the best way to get a good look with lightmaps. They provide some images for different setups of lightmaps to demonstrate why certain layouts work better than others. :slight_smile:

Tip: Make sure when laying out edges that they are setup to be on a grid point (this is in one of those tutorials) because anything that falls in-between a grid space will get more shadow information.

This certainly is one way of doing it. I just use one UVWunwrap modifier though. I just switch between the two maps by choosing the channel I want to modify then choose Abandon when switching between the two. This sounds like it’s bad but it’s really just moving between the two and leaving the changes you made to the UV Layout.

Depending on my model, I typically get a general layout in my channel 1 then save the UV layout to a file so I don’t lose it. I’ll switch to channel 2 then load in that UV layout file and edit it down to what I really need to be specifically setup for my lightmap.

If you have any other questions along the way let me know!

Thanks again , I know (hopefully) have a better understanding of Lightmaps. I will try the above out tonight and let you know the outcome.

And as far as lightmap resolutions go, use power of 2 values, default is 32, which means 32x32 resolution. You would then go to 64, 128, 256, 512, etc.

Thanks for the info :smiley: