Search Unity

Question Light switch to visible / invisible

Discussion in 'General Graphics' started by Pytchoun, May 12, 2022.

  1. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Hi.
    Do you know why sometime the light switch to visible / invisible ?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    When using forward rendering there's a limit on the number of dynamic lights that can affect a single object at a time. That limit is set in the Quality settings with the Pixel Light Count for the built in forward renderer, or hardcoded to 4 or 8 point lights for the URP (depending on the target platform).

    If you're using the built in forward renderer, you can increase that pixel light count until it stops being a problem, but the better option is to split up your ground mesh into multiple parts. If you're using URP forward renderer, splitting up the mesh is the only solution.

    The alternative would be to switch a deferred renderer. If you're using the built in renderer, this is as easy as changing the rendering path on the camera, or in the Quality settings. For the URP, if you're using 2021.2 and URP 12 it can be changed in the URP Renderer asset. Previous versions of the URP do not have a deferred renderer option.
     
  3. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    "split up your ground mesh into multiple parts" What that mean ?

    "deferred renderer" How can i know which render i should select ? What is the best ?
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    Literally what I said.

    If your ground is a single mesh renderer, break it into multiple mesh renderers so that no more than the max number of lights are effecting each one.

    There isn't one that's "the best", there's a tradeoff.
    https://docs.unity3d.com/Manual/RenderingPaths.html

    Deferred renderers handle a large number of lights better than traditional forward renderers, but don't work well on low end mobile devices, and can be more expensive to use to render simple scenes with. Deferred doesn't support MSAA, forward does. Deferred is also incapable of rendering anything that's transparent, so all transparent objects will still be rendered with the forward rendering path.

    Deferred renderers can also do things like decals much more easily and efficiently.

    Forward+ renderers (like the HDRP can be setup to use) are a good middle ground between the two, but require features of more modern GPUs that older GPUs may be very bad at or incapable of.
     
  5. Pytchoun

    Pytchoun

    Joined:
    Apr 12, 2015
    Posts:
    203
    Hard to choose