Unity3 Lightmapping -- Light penetrating through boxes

Way back when U3b1 came out I built a simple scene made out of Unity’s built in boxes, lights, and spheres to test the Beast lightmapper. The scene has a small building made out of four boxes with three walls and a ceiling, with one side open. Inside I placed a glowing red sphere and a green point light. Other than that there is a box for the ground plane, and a directional light to create some shadows.

When I run Beast I see light leaking through the boxes in strange and wonderful patterns:

I have tried making the boxes overlap each other on the ends (as you can seen in the pictures above), suspecting that light was leaking around the edges. I have tried aligning the boxes perfectly with each other so there is no overlap at all. And I have tried making the boxes very thick in case it is a precision problem in Beast:

In each case, the “light leaks” moved to different parts of the building, but they never went away completely.

I had hoped that with Unity beta 5 or 6 the problem would have been fixed, but I just ran the lightmapper again with U3b6 and still have the same problem. I have seen similar problems with complex scenes generated in 3DS Max.

Has anyone else seen these kinds of problems, or know a solution?

Here are my Beast settings:

I’ve posted Unity 3 beta 6 project files if anyone is interested in testing it.

Haven’t had any responses on this topic, so I am going to submit a bug report. Case # 371897

I think the interpolation is set too high in your lightmap settings. If ever in doubt about what certain settings do read the tooltips. Your bounce boost and sky light intensity are also set very high.

373677--12929--$screen_shot_2010_08_25_at_63529_pm_202.png

Well, that’s actually why I built this scene. I wanted something simple that would light quickly so I could play with the params and see what they did. I’ve tried as many combinations as I can think of, but none make the artifacts go away. But, I went back and tried adjusting the params you suggested, and tried to be more rigorous this time. Please see results below.

I haven’t found the tooltips on the lightmap settings very useful. The Unity docs add a little more insight, but as far back as Beta 1, I gave up and went over to lluminate Labs and downloaded some docs on Beast, to try to understand what all these settings do.

It would be really sweet, if in the final docs, you guys had a simple scene like this setup showing the results of varying these parameters.

Here are the results. I varied the Interpolation (Int), Interpolation Points (Pts), Bounce Boost (BB), and Bounce Intensity (BI) settings. All other settings were left the same as in the original post.

Baseline (same as original post)
Int = 1, Pts = 30, BB = 2.2, BI = 1.5

Reduced Interpolation (notice left side of box is actually worse)
Int = 0, Pts = 30, BB = 2.2, BI = 1.5

Reduced Bounce Boost
Int = 0, Pts = 30, BB = 0.5, BI = 1.5

Reduced Bounce Boost Again
Int = 0, Pts = 30, BB = 0.25, BI = 1.5

Reduced Interpolation Points
Int = 0, Pts = 15, BB = 1.0, BI = 1.0

Reduced Pts and Bounce Intensity
Int = 0, Pts = 15, BB = 1.0, BI = 0.5

As you can see, there are slight variations, but the artifacts never go away.

So, aNTeNNa, do you think I need to try making my own Beast config file and tweaking the , , or params? Maybe the defaults Unity is sending over are too tight.

I personally have used the Beast lightmapping in Unity quite a bit over the last several months and have gotten plenty of terrific results without having to tweak anything besides the parameters available in the Unity GUI.

I grabbed your project, turned down the sky light intensity, turned down the bounce boost and interpolation, and got a perfectly fine result.

But maybe you should actually try lightmapping some other scene instead of just a few cubes… try it on a real world scenario and see how it fairs.

And yes, I agree the documentation for the lightmapper needs improvement.

Can you post the settings you used, along with a render?

I have spent about three weeks of rendering time on and off with a high detailed real world architecture scene, and yet I always, somewhere in the model, see these kinds of splotchy results. Yes, there are a couple of sweet spots in the N-dimensional hypercube of params, but there are always splotches somewhere.

Without knowing the numbers you actually used, I have tried “turning down” the three parameters you mentioned. It is still splotchy.

Here are my results:

Since my sky intensity started out at 1.0, turning it down to 0.5 and 0.25 is a huge decrease. If I go any lower the scene gets too dark to see.

A couple of questions:

  1. Are your rendering on a Mac or a PC?
  2. Did you use U3b6 or some newer internal version?

If you could, please post the numbers you used and I will run them on my copy.

Hi there!

I had some strange errors a while back too, but I solved it by doing some magic with the beast .xml file. If you could send me the file, I would love to give it a look.

Cheers,

Roald

Hi BrokenPoly

I would appreciate it if you could take a look. The attached settings file matches the original settings I showed at the top of the post.

377052–13057–$beastsettingsxml_211.zip (843 Bytes)

It occurs to me that I need to try recreating this simple geometry in Max, export an FBX file, load it into Unity, and use that geom instead of Unity boxes. That would eliminate whether it is a Unity box problem.

I am confused. I created the Beast XML file using the “Generate Beast Settings file” drop down, but the file it creates doesn’t have my settings it it. It appears to be mainly just default values.

When I render using that XML file, everything is really really dark.

I expected the XML file to match my current settings when I generated it. That is what it is supposed to do, right?

I just tried Unity 3 beta 7 (Mac version), with the original Beast settings. I still see the same artifacts.

Has anyone else tried the project files I posted (at the bottom of the original post) and seen if they have the same results?

I tried U3b7 on the PC also, same problems.

I just built an equivalent model in Max, exported it as an FBX, and used that in the scene to replace Unity’s built-in boxes. I set the importer to generate lightmap UV’s for the FBX geometry. The lightmaps are cleaner, but still show the same mapping errors. This eliminates Unity boxes as the source of the problem. It must be Beast.

I can’t get Beast to work cleanly on simple scenes like this, or on buildings with 300K+ polys. I’ve tried adjusting all the params aNNtENNa suggested. I’ve tried both PC and Mac, from U3b1 to U3b7. Unless someone can prove me wrong, I officially give up.

Hi there sorry for the late reply!

Our main Beast guy Robert will be back in the office today, so I`ll ask him about this. If you could make a package of your file and send to me as well, that would be great.

Cheers,

Roald

Looks like your bake settings were completely off, which really confuses Beasts adaptive sampling used for final gather.

So in the thick walls case it was easy enough to just change the contrast threshold and rays to more sensible values (I just changed them to defaults ;).

Thin walls were a bit more tricky, because apart from getting artifacts from the final gather sampling going bonkers with those bake settings, there was also some fg leaking through the thin walls. So I just made the walls a tiny bit thicker and adjusted the bake settings as in the screenshot.

If you would really want to keep those thin walls, you would have to play around with fgCheckVisibilty and friends via the xml file, which adds to the render time, but you make sure fg doesn’t bleed through thin walls. There are no docs on this just yet, but I’m hoping to finally make decent lightmapper docs this week.

Hi Robert, I repent. I ran your numbers and it does produce clean results.

Looking at your numbers, the only parameter you changed different from the tests I had run was the Contrast Threshold. Playing around with it on the thick walled scene, there is a very sharp point between 0.15 and 0.2 at which the artifacts start to appear.

So it appears that Contrast Threshold is the most critical param for getting good results.

You referred to using the XML file to tweak the fgCheckVisibility settings, but have you noticed that the “Generate Beast File” menu item does NOT create an XML file equivalent to the current settings of the GUI. This makes it very difficult to use the XML file, since I’m not sure what you are mapping all the GUI variables to when you send your settings to Beast directly. Is there anyway to fix this?

Generating the xml file from the actual settings is one of those details that didn’t make it into 3.0.

There’s only a handful of settings though, most of them have matching names and the exact mapping will be documented in the manual that will come with 3.0 :slight_smile:

OK, as long as the docs allow us to match the settings you use internally. Thank you for your help.