Lightmap Issues

Hi,
I have been having some issues with light maps in the environment I’m working on. I have read through the documentation for lightmaps here and it seems to be the same as the UE3 information.
I have been encountering lots of issues with shadow bleeding and I’m trying to understand more about why this issue exists. I have created my object and added a second UV channel for lightmap UV’s. (please see image below for the lightmap unwrap on the second channel in 3ds max) I have attempted to leave between a 3-4 texel gap between islands. Also this version of the unwrap is matching the objects smoothing groups as when I stitched larger groups of the mesh together it gave poorer results.

I have been working with a scale of 1 generic unit to one Unreal Unit in max 2014.

maxunitsetup.jpg

When Exporting meshes I have been using the following settings:

When working with the mesh I have set the lightmap resolution on channel 1 in the static mesh previewer to 64x64 pixels.
I have found that when I alter the Static Lighting Level Scale in the World Settings it has a direct impact on the quality of the light map builds. Here are range of screenshots showing the reduction in Static Lighting Level Scale with the corresponding lightmap bake.
The environment is lit using multiple static lights with shadow casting disabled for the impression of bounced light and the desks are lit using stationary lights with IES profiles assigned.

It appears that the lower the value of this scale improves the overall quality of the shadows on my static meshes. Why is this? Is the scale that I’m working with inside of 3ds max not corresponding to the default lighting scale set within World Settings? (for example should the scale be changed to cm in max or should the scale be changed to cm in the settings for .FBX export?)
Reducing the lighting scale also seems to have a direct impact on the “softness” of the edges of the shadows.
There are additional issues however with the lighting when the Static Lighting Scale is reduced, this starts to create a shadow acne on other surfaces that are primarily lit by the static lights (non shadow casting) within the scene

Any advice on this subject will be greatly appreciated, I’ve always seen light map unwraps as a “dark art” and anyone’s input on their workflow for their creation and for input to help me fully understand the relationship between lightmass/ lightmaps and the quality of the lighting render produced will be really helpful!

Cheers,

You’re note about reducing the scale actually solved a problem I was having. I was getting odd bleeds through from the other side of a wall… reducing scale got ride of the bleed. I was also getting dark spots on the edges of where my modular pieces fit together, and all I had to do was go back into my UV1 and make sure hard edges were split and packed with extra space between.

The splotchiness you’re getting on the ceiling might be resolved by overriding and increasing the Light Map Res for that object.

I’m glad it helped in some way, I am still having the same troubles with the “shadow acne” it only gets reduced if I increase the static lighting level scale again. And this results in poor bakes on the smaller scene assets.

I am hoping that someone can explain if there is a direct relationship between asset scale during export/import, lightmass, the static lighting scale and quality of lightmap bakes. Also if anyone else has any tricks or tips for improving lightmap quality.

In the past I have tried ensuring that UV islands are contained within Pixel boundries and that areas that are going to be in shadow are segregated in the 0-1 space in max.

Again any help appretiated

Hi James, thanks for your patience. We have requested our chief lighting specialist to look over your issue and provide some information.

Hi Stephen,

Thanks for looking into my issue for me, im looking forward to find out more about this!

Ok so I have resolved my issue in two different ways now. And im not entirely sure why either approach has fixed the issue.

First potential Fix, whilst considering the potential issues with scale and quality of lightmass bake I looked into the scale options at the point of export. This led me to experimenting with changing the scale to cm in the FBX export. This seemed to be scaling objects up by a scale of 2.54. The results of baking the lighting with this export were very clean with a static lighting scale of 1.0. This appeared to resolve my issue, but presented some new challenges with regards mesh scale.

The second resolution only partially worked. I found if I was to increase the texel padding between UV islands to between 4-5 texels (previously around 3 texels) . All UV islands matched the smoothing groups set on the mesh. This improved the quality of the lightmaps however there were still issues with bleed. In areas that has masses of padding. The scale in this example was was set to the original of 1 generic unit in max to 1 uu.

In the example that appears to have solved the issue with this asset, I have retained the 4-5 texel padding and smoothing group splits on uv shells. The only other change is that the geometry was altered and 90 degree edges near where bleed was occurring were reduced.

Here is the original geometry

Here is the altered geometry.

Here are the results inside of Rocket using the last example:

This appears to have solved my issue but I don’t feel I fully understand why? Any help understanding a solid approach or a set of rules for creating lightmaps for rocket would be great!

Thanks for the detailed explanation of the problem and especially images. The artifacts on the keyboard look like a combination of two things - bleeding across UV charts (which you worked around by increasing the space between those) and incorrect self shadowing by distance field shadows. Stationary lights use distance field shadow maps, but they don’t support area shadows. That causes a problem where small geometry creates a shadow larger than it, when really the shadow should be sharp as the distance to the caster is small. This is something we hope to improve but have not gotten a chance to do so yet.

The intention of StaticLightingLevelScale is to allow games which did not use the default scale to compensate, since many Lightmass settings are scale dependent. A scale of 1 with a level built at the UE4 scale (1cm == 1UU) is intended to be the right setup, however sometimes there are bugs or difficult lighting situations which prevent that. The other intended use of StaticLightingLevelScale is to improve build times when building a level with massive surface area, like something that you fly through or drive through on a fast vehicle, where the lighting quality is not so important. Smaller values of StaticLightingLevelScale cause a bug where the indirect lighting is not smoothed enough, which is what you were seeing with the splotchiness on the ceiling. You can sometimes combat this with IndirectLightingSmoothness.

Really small geometry like the keyboard is always going to be a problem for lightmaps as you’ll have a single texel spanning some very different geometry. One thing you might consider is making the keyboard a separate element in the static mesh (or separate component) and disabling shadow casting on that. You might also try increasing the resolution of the lightmap, 64 is pretty low for an object with that kind of detail.

Hi Daniel,

Thanks so much for taking the time to respond to this for me!

I now have an issue that if I increase the light app resolution the errors start to re- appear but not to the same extent as before (it’s only effecting certain areas). I will post an image of this later for you.

Is there any standard workflow you guys are using internally for light mapping? Is my current approach acceptable?

Thanks again!

The main thing with laying out lightmap UVS is to make the UVs parallel to the geometry edges (no diagonal lightmap texels), to leave enough room for padding between charts at the end resolution, and to hide seams as much as possible. It looks like you are doing these things already.

The main problem that i can see is that distance field shadows don’t handle detailed self-shadowing very gracefully, when the geometry doing the shadowing is smaller than the penumbra size or the texel size. I hope we can improve this so you can have lots of clean, detailed geometry.