Search Unity

Lightmap ignores lights with shadows turned on (in specific scene?)

Discussion in 'Editor & General Support' started by Lastair, Oct 7, 2013.

  1. Lastair

    Lastair

    Joined:
    Mar 16, 2012
    Posts:
    13
    EDIT: This thread can be deleted. Turns out that the culprit was the massive spherical skybox that was actually casting a shadow over the entire scene. It was on a layer that the light was supposed to ignore, but it didn't - turning Cast Shadows off on the skybox renderer got rid of the whole problem.

    I'm using the free version of Unity. I was working on a scene doing non-lighting stuff, and then went to re-bake a lightmap that had been previously working as expected, but the single shadow casting directional light was suddenly missing from it. I hadn't touched anything related to lighting or lightmaps.

    Everything is marked static appropriately, and OTHER lights (without shadows) do get baked into the lightmap correctly. After some testing with only that light enabled, I found out that turning shadows off for that light makes its lighting bake into the lightmap as well, but turning shadows on results in a completely empty grey lightmap. The lightmapping mode on the light is set to Auto, since I need to bake static shadows from it for level geometry and use the same light to cast realtime shadows for dynamic objects.

    For further testing, I created a blank scene, where I placed one static cube over another, created a new directional light that points straight down with hard shadows. I did Bake Selected with the same lightmapping bake settings as the other scene, and it worked as expected, with one cube casting a shadow on the other in the lightmap. I then created a prefab of this test setup with the two cubes and the directional light, and placed it in the root of my real scene, with all other lights disabled. I did Bake Selected, and got a completely blank grey lightmap again.

    Does anyone have any idea what could be going on? I could not locate any per-scene settings that would make lightmaps act out like this.
     
    Last edited: Oct 7, 2013