Building escape, light issues

Hi all,

So I had the same issue with the light as describbed in this previous topic:

I managed to solve it in the following way:
I looked at this page: https://docs.unrealengine.com/en-US/Engine/Content/Types/StaticMeshes/AutoGeneratedLightmaps/index.html

First thing it made me realise: the options to modify a static mesh are in the “details” subnail. To access it, double clic the icon of the static mesh (opening the inspection window) and clic “details” in the “window” drop down menu.
Then I went through all the recommendations of the page, the bug came, in my case, from the fact that “Destination Lightmap Index” and “Lightmap Coordinate Index” did not match (even though I am pretty sure I never modified them in the past… spooky!).

Now I am happy, I found my solution, however, I do not really understand what happens there. Could somebody explain what are those Destination Lightmap Index and Lightmap Coordinate Index?

1 Like

Did you figure it out? I’m confused too.

When you convert CSG brushes to static mesh, it generates UV Channel 0 which is normally used for the materials, and UV Channel 1 for Lightmaps (and it also generates the actual Lightmap UVs that are stored in that channel). Unfortunately, it incorrectly sets the Light Map Coordinate Index to 0 instead of 1. My guess is that the guys at Epic probably don’t bother with lighting when at the blockout phase, or they only use dynamic lights, so that’s why that default behavior has never been fixed. You could work in unlit mode (Alt+3) for the whole blockout phase, which obviously doesn’t require you to bake lights, or you could work with dynamic lights only (Movable), which would give you the ability to visualize lighting in real-time (this is also how it works in Fortnite).

As for a more in depth explanation: if you go in the Static Mesh Editor (double click the static mesh in the content browser), you will see a big “UV” button in the toolbar. If you click on it, you can use the dropdown to visualize the content of each UV channel, as I explained in the first paragraph. You will see that channel 1 has nicely packed UVs, those are the lightmap UVs that have been generated. Lightmap UVs have some specific requirements compared to normal UVs used for materials, the most important one is that they cannot overlap. That is why static meshes often have 2 UV channels, because one can be optimized for the material, and the other for lightmaps. For example, if you have a symmetrical model, you could only UV half of the model, and stack the UV islands on top of each others to maximize the UV space and thus get higher resolution details. However, you can’t do that trick with lightmaps, because if part of your mesh would get shadowed, then the other half would automatically get the same shadow, which would obviously look completely wrong !

So basically, the trick when you set the Light Map Coordinate Index to 1 is that you are telling Unreal to use the correct UVs, the ones that have been generated specifically for the lightmaps. The setting Destination Lightmap Index is only relevant if you regenerate the lightmap UVs (if you click on the “Apply Changes” button). When you click on that button, the lightmap UVs will be generated into that specific UV Channel, that why if you are going to use that feature to regenerate the lightmaps, it needs to match with the Light Map Coordinate Index, because that’s where Unreal will be looking for to display the shadows. Finally, if you are indeed going to regenerate the lightmaps, then you might want to increase the Lightmap Resolution, as by default, the texture will be very small and will thus display very blurry shadows. 256 should be fine for most cases.

2 Likes

Hi NXGEN,

Thank you very much for the detailed answer. It makes a lot more sense now. I will try to read some more fundamentals about how these UV maps work, I find it pretty interesting.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms