Baked lighting disappears and/or is very distorted on 5.2
Hello, all
I'm very new to Unity, coming to it from another game engine, and I'm having all kinds of problems with baked lighting, even in extremely simple test scenes.
If I set up a scene with the default skybox and a spotlight or point source, and all lighting set to Realtime, everything is great. The moment I try to use baked lighting for any light source, things go to hell. The baking process appears to work normally. It runs for several minutes, and the instant it finishes, one of two things happens:
All the baked lights vanish, and the scene becomes very dark, or
The surfaces in the scene -- even those where the materials have no textures applied -- are all covered with dark smudges or speckles.
I have found that the severity of the problem seems to correlate to the scaling of the objects. The assets I am importing were created with Imperial units, and so I have to apply a scaling factor of 0.0254 on the import.
All of the assets I'm testing have correct UV mapping. I was originally testing with a pro-grade asset purchased from Turbosquid, and when that became problematic I made a simple object myself in Blender with very flat surfaces and simple UV maps. My object, being scaled at less of an extreme, renders better than the purchased one, but still pretty badly.
The only thing that always renders correctly are basic objects I created within Unity, such as cubes and planes.
I'm running Unity 5.2 but had this problem in 5.1 as well. Here is a subset of what I have tried so far to resolve the problem:
I've read the lighting section of the Unity manual end-to-end to see if I was missing something obvious.
Scoured the forums and the Internet at large to see what others have done about it...most of the following items are the results of that search. A lot of people seem to have encountered similar problems, but so far I haven't found that one of their solutions worked for me.
Made sure all my objects have UV maps.
Turned "on" shadows for my light sources, since one post indicated that turning off shadows would also result in no lightmaps being generated.
Tried various settings for the size of lightmap atlases, up to 4096.
Turned off automatic bake and re-baked manually.
Created an empty test project with nothing in it but one of my asset objects and a plane with a collider so I have a place to stand, and all lighting set to default parameters except turning on baking.
I have seen the wonderful results other people get with Unity, so I have to believe this is my fault and not a software bug -- but I'm at wit's end after fighting this for almost a week.
Can anyone suggest something I haven't tried yet? Thanks!
Update 1: I think may have solved this, but after seeing what worked and then reviewing that in the documentation, I don't understand why it worked. On a whim, and lacking any better idea, I added a Light Probe Group to the test scene, and was astounded to see that the lighting immediately started working exactly as it should! When I read the documentation it seems to say that light probes have nothing to do with static objects, but rather are a way to interpolate an approximate lightmap for moving objects in realtime. Yet, here I have added light probes to a totally static scene (other than the player), and it makes an amazing difference. What am I missing here?
Update 2: I was wrong. It's fixed in my test scene but not my real project. I still cannot figure out what's wrong, even after several more hours of trying different things.
Answer by syscrusher · Oct 13, 2015 at 05:19 AM
Solved by a combination of changes:
I had both baked and precomputed GI modes active at once. That turns out to have been an unfortunate choice for performance and VRAM usage. When I switched to only precomputed realtime, things got a lot better all around.
I increased the atlas size for the lightmap UVs.
I reimported my meshes from 3DS Max with "generate lightmap UV" enabled. I had thought -- apparently mistakenly -- that leaving this off would cause lightmaps to use the embedded UVs from the model.
I switched my lightmaps from nondirectional to directional, which improved visual quality.
Your answer
Follow this Question
Related Questions
Baked GI Light Bleeding 0 Answers
Baked/Mixed light problem - turns off when baked 1 Answer
Problem with Light mapping - Enlighten 0 Answers
Getting strange artifacts(?) when baking lightmaps. 1 Answer