Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Graphics 5.4.0b7 Light Culling Mask doesnt seem to work anymore

Discussion in '5.4 Beta' started by freekstorm, Mar 2, 2016.

  1. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    Lights set to only illuminate a selected layer are now illuminating everything!
     
  2. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Not according to our graphics tests. So it must be something that's more complicated than what we've noticed. More details about your scene/setup/...?
     
  3. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    Well I cant reproduce it in a new test scene but it happens in my upgraded scene.
    Light creates a specular reflection, even though the culling layer is set to 29 and the surface is set to terrain.
    Setting the culling to nothing causes the surface to go dark, setting it back to anything causes the specular effect.
    Tried changing material and no change.
    I cant upload the project as its too big and you haver to play part way though the game to get to it. I'll continue to look for the problem. But it didn't happen in previous versions.
     
  4. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Wild guesses: does it only happen on terrains? Does it only happen on terrains that are somehow specific? (e.g. don't have particular textures on them etc.)
     
  5. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    No the terrain has an SBSAR texture on it. But just in case I replaced it with a new empty standard material with no texture and it did the same thing.

    Its not really a terrain at all, its a flat plane.
     
  6. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    I've uploaded some screenshots to show the problem.
    1 - the problem
    2 - changing layer
    3 - the light as is
    4 - the light set to nothing and the result matches the pre upgrade version.
     

    Attached Files:

  7. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Turn warnings on in the console; if you're using deferred shading you might be running into "in deferred, there's a limit on how many layers you can _exclude_ from being lit". That is printed as a warning, but your console has warnings turned off.

    That said, this limitation has been there since forever, so it wouldn't be a regression. Unless when updating to a new unity version you also switched to deferred or something.
     
  8. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    Only 1 warning and 1 error on run:
    error: GenerateID is not allowed to be called during serialisation......
    warning: OnLevelWasLoaded was found on OVRSccreenFade
     
  9. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Hmm yeah then I'm out of ideas. Can you send a bug repro (or try to narrow it down if concerned about too big project)?
     
  10. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    Ok, so today I loaded Unity and got this error on load:
    Too many layers used to exclude objects from lighting. Up to 4 layers can be used to exclude lights, while your lights use 31: 'Default' 'TransparentFX' 'Ignore Raycast' 'Unnamed 3' 'Water' 'UI' 'Unnamed 6' 'Unnamed 7' 'terrain' 'interactive' 'player1' 'player0' 'moveable' 'breakable' 'ceiling' 'wall' 'nebula' 'gizmos' 'paintablewall' 'invisiblecharacter' 'forcefield' 'roombox' 'snapBall' 'hollow' 'xray' 'sensor' 'transparent' 'pressme' 'powerrelay' 'Unnamed 30' 'Unnamed 31'
    UnityEditor.DockArea:OnGUI()

    Its not occurred before but I guess that's what you meant. The odd thing is that, as I say, it worked in 5.3.

    The second problem is that appears now you can only exclude 4 layers from a light, but for raycasting you end up with a lot of layers, so do we have to choose between efficient raycasting and light exclusion?

    Please can you explain how this will work. There are 7 built in layers with TransparentFX, Ignore Raycast, Water and UI in them. By my reckoning if I add ANY more layers I cant exclude lights.

    Mabe its time to consider splitting render layers and object/raycast layers!?
     
  11. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    Like I said before - this limitation ("can only exclude up to 4 layers in deferred") has been there since forever, so I find it weird that it would only start in 5.3 for you. You sure did not switch cameras to deferred rendering at the same time when you switched to 5.3?

    How the deferred light layer exclusion works: you "just" have to invert the logic of what the lights should illuminate. So instead of, saying "this light only illuminates characters" (and hence setting up light to only affect Characters layer), you have to tweak it so that the light has all the layers except the ones you don't want to illuminate. As in, instead of doing "this light should illuminate X", do "this light should not illuminate Y", and uncheck these layers.

    Yes it's kind of a hassle, but this whole "light layers in deferred shading" is a tricky thing to do to begin with.
     
  12. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    I guess I still don't get what you mean. In this case the light has one layer selected for lighting, and only one object in the scene has that layer assigned. How does this differ from what you said.

    I don't want this light to effect anything else in the scene, the other lights can illuminate everything and have all the checkboxes set.

    So to be clear, all the other lights are set to everything, this light is set to a single background object.

    I have been using deferred rendering for many years on this project.
     
  13. freekstorm

    freekstorm

    Joined:
    Nov 11, 2010
    Posts:
    86
    I don't know why it appeared to work in 5.3, but I'll have to find another solution.