So. Many. Lightmapping. Problems. (Unity 5)

UPDATE: 8/8/15

This problem happened again and I think I have solved it. I first tried manually deleting every ounce of Gicache in my computer. When that didn’t work, I noticed that a doorknob model that I brought in from Sketchup never had its UVs made by Unity. It was around the same time that this problem reared its ugly head again. I had it generate UVs and rebaked and all of the problems went away, so far.

MAKE SURE THAT EVERY MODEL THAT YOU ARE USING HAS ITS UVS GENERATED BY UNITY IF THEY DIDN’T COME PREPARED. See if that helps. I will post here if it happens again in this model.


I have been having a few problems with lightmapping over the years. With the jump from Beast to Enlighten, I thought they would go away. Not only did the original issues not go away, more came. It's maddening and now I turn to you all for some help. I have searched the forums and have found clues and tips for some of these, but NOTHING has helped.

Background: I am taking models designed in Revit and putting them into 3DS Max using the Suite Workflow feature. I am then using the Autodesk Material Converter script to get the materials into Unity. This process works great and always has. I then generate lightmap UVs in Unity, which takes forever, but works. In the past, and currently, I use a many different settings from baked lighting only, Realtime and baked, all sorts of padding values, a range of quality values, default values...these problems still persist.

I have a wide range of lights. One directional and about 2 dozen spot. I have changed the pixel light count to 50 to ensure all of the lights are represented in the scene.

My issues.

**1-Splotchy dark spots on random geometry (black spots on vertical bronze trim)**
![2082225--135993--LM1.PNG|1043x695](upload://2TyIrHkM8lzykAh8xcOfLa8XWSY.png)
This is a particularly irritating issue as it happens at random. I can rebake and sometimes it will go away and it may, or may not, appear on another object. I often have to clear my entire lightmap and rebake and see if that does it. Upon clearing and rebaking this one WITH THE EXACT SAME SETTINGS, the problems were solved...until they came back again. The randomness is what concerns me. You can't see it in this shot, but there are three stools on the left. The one in the middle is completely covered in these spots, while the two identical ones near it are fine.

**2-Dark spots on seams of geometry**
![2082225--135994--lm2.PNG|1042x695](upload://zYfZrqqL1jnMQNghec1f2UzmWEN.png)
These spots really bother me. At first I thought it was ambient occlusion, but even at 0, they still persist. Higher resolutions make them higher quality black spots. Different padding values does nothing. I have re-generated UV maps for these objects with a wild variety of settings. Nothing fixes it. If anything, it scoots the black spots around.

**Issues 1 and 2 occurring in the same scene, at the same time, in the same view in a different part of the model.**
![2082225--135995--lm3.PNG|1039x692](upload://6JdHra7xivluE1nXsKKmwyaX6h0.png)
Hooray.

**3-Strange banding when light passes through transparent material**
**![2082225--135996--lm4.PNG|1041x689](upload://4pamXpvLdX6DeBVrSpTRV2wrxRv.png)** 
This is the only NEW issue. This wasn't a thing in Unity 4 that I ever ran into. I don't know why this is happening. The alpha channel is all the way down and the standard material is set to transparent.

**BEHOLD! MORE RANDOMNESS!!**
![2082225--135997--lm5.PNG|1040x695](upload://4Z6iSYemgKljj8bHj0M1h1C5W4l.png)
This really put me over the edge. I changed the resolution from 40 to 10 to test baking. This is the result after bake. I cleared the lightmapping and tried again. Same thing. I cleared the lightmapping completely, disabled all lights, and nothing changed. I have to restart Unity after erasing all of my lightmapping work in order to get it to display correctly, and then all of the problems in this thread start over.

My specific settings change all the time, which leads me to believe that they have nothing to do with these issues. I am on a Titan X, 3.5ghz intel CPU, 32 GB of RAM. Over the past few years, I have never been able to reliably eliminate any of these problems. They either show up or they don't.

Additionally, in Unity 5, I can select the shadow strength when I toggle a light to realtime, but the option goes away when I change it to baked. However, the value still applies in the editor and in baking. It seems that in order to change the shadow strength of a baked light, I need to change it to realtime, make the changes, and then go back. A bug or a feature?

For lightmapping issues, if anyone has any insight, I would love to hear it. If I have to bake in 3DS Max instead, I may end up doing that, however I fear that will lead to it's own set of issues.
3 Likes

Yup. Shit’s busted. Makes me wonder how they managed that awesome GI arch vis lighting promo video! Must have been a bitch to get working!

I posted stuff about the black spots as well, and how I solved it:

But… no replies. So maybe it isn’t working for anyone but me.

I have a feeling GI is gonna be busted for a while. Even once its fixed, it’s gonna take some time until everyone adjusts. The amount of settings that are tweakable in Enlighten is daunting… Bounce numbers, bounce intensity, global GI intensity, baked, unbaked, real time… it’s hard to know if a Enlighten is broken, or if we are all just using it wrong.

Yeah, I feel EXACTLY the same. I followed your instructions just before I made the thread. It didn’t seem to fix anything. Once I saw THOSE options, I felt even more like you do…is it Enlighten or is it me not knowing these millions of values and how they may or may not be used to correct a problem that I may or may not be having?

Update: things just get worse.

I thought the issue stemmed from having so many lights. This is with one directional light (the light component is turned off on all of these bulb gizmos) with unaltered lightmap settings in a COMPLETELY NEW project. Now the ceiling and some of the walls have decided to give me trouble. The randomness of these issues is the largest concern.

Since I made the post, I have solidified my workflow for attempts. It’s ridiculous.

  • Clear all lightmap data from the last failed attempt
  • Ensure that all of the lights are set to baked, not realtime
  • Ensure that the objects I want to test on are marked as static
  • Set resolution
  • Bake
  • Wait
  • Upon completion, search the scene for the inevitable NEW error
  • Cry
  • Clear all baked lightmap data
  • See that the scene has become EXCESSIVELY blown out, even with all lights disabled.
  • Save, exit
  • Re-open and see that the blown out problem is solved
  • Re-enable lights
  • Change one lightmap setting
  • Repeat

Below is the screenshot of the same scene, but with my own custom lightmap settings as outlined by Nullzero (just to see what would happen)

However, upon changing the resolution from 10 to 20, this happens:

Doing this on a completely separate computer (4 ghz, Titan X, 16GB RAM) yields the same results, albeit random.

Any updates? I’m getting the same issue.

Nothing. I was using Simplygon models originally. I went back to normal models and most of the issues went away. I covered up the offending geometry, so it’s not a real fix.

Could you please report a bug with this scene attached and post the number here?
I’d take a look

@SpiriTx I appreciate Unity’s involvement in the forums since Unity5’s release, I really do, it’s a great thing! But ‘file a bug report’ is getting a little old. I see the same issues time and time again by wave after wave of frustrated would be lightmappers. Every time I lightmap I see these issues, do you really not get them in-house testing? Is this all news to you?

Most problematic from my testing was Directional Specular, it sometimes provided artefacts, but never anything so wrong. I have a number of projects which I constantly use for baking and they look good. Problem is that Lighting is so dependant on the geometry used that we constantly get these different, sometimes corner-case, scenarios.

A lot of issues raised are caused by incorrect UVs, normals or compression, especially when Jamie mentioned that most of those issues were present in Beast too, so it’s hard for me to tell something more unless I can take a look at it myself.

You are right that we have quite a significant number of bugs right now and experience for the person using it might not be optimal, but I can assure you that we trying our best to make it better. Devs have been squashing bugs for months now, we also have a set of new docs and tutorials being prepared to ease the pains of using lightmapping.

How come we haven’t seen any significant improvement in lightmapping/GI. I think you moved a button on the UI once or something.

I agree, Directional Specular is most problematic. Will the new Docs include workflow tips, mesh preparation, ideal scenarios, limitations? When can we expect the new GI system to work correctly? You should take your whole iOS team and tell them they can’t go home until it’s done. :wink:

I also get artifacts after baking a lot lately (5.1) which is quite frustrating when there is no workaround I can come up with so far except setting the lights to realtime. Any ideas why these black patches appear are highly welcome! When do these artifacts generally appear? When switching the lights to realtime everything looks great.

2136783--140833--baking_artifacts.PNG

In the point releases (5.1, 5.2) mostly.

Yes, most of that will be in the docs or tutorials. Answers to all of the confusing topics have been gathered. Well it works correctly in a lot of scenarios already, so it mostly depends on the thing you are trying to achieve and what exactly is in your way right now.

Why iOS team?

Those look like compression artefacts. Please try unchecking “Compressed” in Baked GI section

I tried all kinds of parameter combinations but nothing seems to remove the black patches. Compression is also deactivated. Any other options you see?

Looking through the release notes of the point releases, there are dozens of iOS updates and fixes. I was joking. And yes, in a lot of cases I can get satisfactory results. And overall the system looks amazing, it’s a huge improvement over 4.x, great job! Please put loadSceneAdditive to the top of the list. Thank you!

It might be incorrect UVs or normals, please check your meshes.

LoadSceneAdditive support is almost done, I did first testing round on it last week.

1 Like

Unfortunately, this project and these assets are under NDA. Images are fine, but I can’t release the files. If I run into it again with a model that isn’t under NDA, and I can reliably reproduce, I will take the step you outlined. Thanks for the help!

Some of those issues stand out and I would be very surprised if they have anything to do with Unity:

  1. UV island too small/stretched or geometry flipped.
  2. UV seam is in a horrific place, not enough padding?
  3. Elevator definitely flipped geometry, chairs are shitty geometry/uv’s.

Revit geometry is particularly horrendous, and nothing Unity does can magically fix it.

I haven’t ever used revit but if you aren’t editing your uvs before importing the meshes in to unity then problems with normals are bound to happen. In medium scale environment applications a difference in tessellation calculations between unity and maya alone can means hours of mesh and uv repair on the front end of the production pipeline especially if you edit the mesh at all in unity with tools such as vpaint, which are rendered useless because of a difference in vertices index.

If you can enable a viewfinder setting called backface culling, and granted the material being rendered in revit is one sided, your viewport will show you which faces are reversed. Another error that can pop up in a mesh is a set of flipped uvs. Maya allows you to shade your uvs, blue for out and red for in, when viewing the uv editor window but it’s something to check.

I played with the lightmapping settings for a good 2 or 3 days in a scene with unity meshs, a custom shaderforge shader and for a control the standard unity shader before I started trying to bake actual scenes. Success came from turning all settings as low resolution as possible and slowly increasing lightmap and texel resolution until the result was satisfactory. I start any new lightmap process by switching GI Directional mode to non directional and reducing the baked resolution from the default 40 texels per unit to 4 texels per unit. Enabling a small amount of final gather and finding the right scale in the lightmap per object is important too. All our objects are made from maya, all our uvs have been touched before they see unity so we aren’t running in to problems with artifacts yet but in certain scenes the light transport stage continuously produces errors detailing that the radiosity core is corrupted. Resulting in halfbaked scenes if I’m lucky.

So consider yourself lucky that your issue is with your models and not with your shaders and plugins. Currently I’m trying to bake lightmaps using a shader with an opacity clip channel and it’s making unity do some very crazy things. ie: flipping normals and failing to find shadows.

I’m a team manager for my company and if asked I would have no problem releasing game files to Unity if it was strictly business. Unity doesn’t release these files, I would recommend requesting permission

edit- oh I also turn real time rendering off like a mofo, and do it all at once. Lights can be set to mixed so you can preview them.

1 Like