Search Unity

Pixel Light Count has no effect anymore

Discussion in 'VR' started by derdimi, Jan 4, 2018.

  1. derdimi

    derdimi

    Joined:
    Mar 6, 2017
    Posts:
    33
    When I started my current HoloLens project, I've set the quality settings to "Fastest". This unfortunately didn't let me render pixel lights until I found out about the "Pixel Light Count" property in the quality settings. Adjusting it worked as expected. Because of another problem (https://forum.unity.com/threads/hololens-spotlight-horizontal-clipping-issue.507593/) I've moved to work on other issues first.

    Coming back to it now surprised me with the Pixel Light Count having no effect anymore. I can place a lot of spot lights in the scene and all of them are rendered on my simple quad object. My pixel light count is set to zero and I am using Forward Rendering. My Unity version is 2017.1.2p1.
     
  2. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
    Hi derdimi, sorry for the late response.

    Pixel Light Count will only work if the pixel light count is >0. When it is not, then it will fall back to vertex lighting which sounds like what you are seeing. This is expected behavior. Try a value of 1 or more and let us know if it's still not working for you.
     
  3. derdimi

    derdimi

    Joined:
    Mar 6, 2017
    Posts:
    33
    Thanks for the response. You are correct about the vertex lightning fallback although that wasn't my problem. I actually just figured it out.

    I did not see any vertex lightning. I saw all pixel lights individually. The reason is that I switched the Render Mode from Auto to Important on each spotlight. Apparently, the Pixel Light Count option in the Quality Settings is then ignored for that spotlight. That obviously makes sense. I would like to see that dependency information added to the Pixel Light Count tooltip, though.
     
  4. JasonCostanza

    JasonCostanza

    Unity Technologies

    Joined:
    May 23, 2017
    Posts:
    404
  5. Lobolopez

    Lobolopez

    Joined:
    Feb 26, 2018
    Posts:
    25
    Maybe you can help me here, I don't quite get that (setting to zero = vertex lights) working as you'd think.
    In my tests that's only true for non directional lights. Even setting the value to zero calculates the first light (the base pass) per pixel (looking at the enabled #defines in the shader). Feels like that setting is more like "number of per pixel lights added not counting with the base if it is directional". Could that be true?
     
  6. derdimi

    derdimi

    Joined:
    Mar 6, 2017
    Posts:
    33
    Try to change the render mode of your directional light to "Not Important" and you will see it switch to vertex lightning. Deactivate the environment/ambient lighting in the global lighting settings to see it more clearly.
     
  7. Lobolopez

    Lobolopez

    Joined:
    Feb 26, 2018
    Posts:
    25
    No, sure, setting to non-important makes them part of the vertex ligthing.
    Still, for an auto light you'd think setting the pixel light limit to 1 would mean "from all the lights, take the most significant one for this object and run it analitically, the rest make part of the SH" or somesuch
     
  8. Noxury

    Noxury

    Joined:
    Mar 8, 2015
    Posts:
    22
    Pixel Light count limits ther number of pixel light sources, that is if I set it to 1, only the brightest Light that has its render mode to Auto gets rendered in pixel light. NotImportant will always render light per vertex, while Important forces to use fragment lighting ignoring the limit.

    1. I still dont understand why Auto and NotImportant still give different results when pixel light count is 0, that means that both options should render the light sources per vertex.
    However, Auto will make the illumination darker, but add drawcalls, while NotImportant illuminates the scene twice as bright and spotlights will also illuminate the back.
    Depending on the scene, the result of DrawCalls will rise exponentionally when set to Auto. So why are different vertex lighting modes and what is causing it?

    2. If all have equal intensity, a random pixel light source is choosed, can there be a future builtin option to handle this by the closest to camera as second priority?
    Just like the query in database: SELECT LIGHT FROM LIGHTS ORDER BY BRIGHTNESS DESC, DISTANCETOCAMERA ASC A workaround is to handle this manually by script
     
    Last edited: Aug 21, 2020