Search Unity

Realtime light not working with static geometry

Discussion in 'Global Illumination' started by caosdoar, Oct 29, 2016.

  1. caosdoar

    caosdoar

    Joined:
    Oct 29, 2016
    Posts:
    26
    Hello,

    I might be missing something but it looks to me that (in 5.4.2p2) real-time lights are not working correctly with static geometry. The picture attached is a very simple setup:
    • Floor and walls are static but the right one
    • The sculpture is non static geometry
    • Directional light in mixed mode
    • Spotlight is real-time (red colour)
    • Pre-computed real-time and baked GI are enabled with default parameters
    • Render path is deferred with linear colours
    unity_5.4.2p2_gi_problem.png

    What I'm getting:

    The spotlight direct illumination is visible at the non-static geometry (sculpture and right wall) but not affecting the back wall that is static geometry. Bounced light from the spotlight is visible at the floor though.
    If I enable "Important GI" to the back wall the direct light is visible.

    I was expecting the spotlight to affect both static and dynamic geometry. Am I wrong and this is the expected behaviour? Am I missing something to make it work as I want to or is this a bug?
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Try the mixed mode experimental builds.
     
  3. caosdoar

    caosdoar

    Joined:
    Oct 29, 2016
    Posts:
    26
    I can make it work with the experimental build. But does that mean that is not possible to do it with 5.4? Do I have to disable baked global illumination altogether to have realtime lights?
     
  4. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Set them to realtime if you want them to be realtime.
     
  5. caosdoar

    caosdoar

    Joined:
    Oct 29, 2016
    Posts:
    26
    The (initial) problem is that realtime lights does not produce any direct lighting on static geometry.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Can you share that scene?

    (are you on deferred? Do you have more than 1 pixel light set in Quality Settings?)
     
  7. caosdoar

    caosdoar

    Joined:
    Oct 29, 2016
    Posts:
    26
    Hi,

    First thank you for your time.
    The project is on deferred (linear colours) and the number of pixel lights is set up to 4.
    I am attaching the project to reproduce it.
     

    Attached Files:

  8. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I found the issue.

    It's the directional light. It's set to mixed and that somehow interferes with the spotlight (for reasons unknown). Changing the Directional Light to Realtime or Baked, makes the spotlight work properly.

    I would suggest avoiding mixed mode in general. It was more or less completely broken and while they fixed *some* things, it still causes more issues than it solves.

    Either use the experimental mixed build if you want to use mixed mode at all, or wait for the changes to make it into the main builds (hopefully for 5.6?).
     
  9. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    I will investigate this.

    Doing our best to get it ready for 5.6 :)
     
    AcidArrow likes this.
  10. caosdoar

    caosdoar

    Joined:
    Oct 29, 2016
    Posts:
    26
    AcidArrow thank you.
    I tested it and you are right, as soon as my directional light is set to "baked" or "realtime" the spotlight works just fine.

    Kemalakay. I made a few more tests:
    It looks like the problem comes from the combination of type of light, mixed baking and having shadows enabled. Same directional light in mixed mode with no shadows works fine, but hard or soft shadows makes the problem appear. Spot and point lights with shadows in mixed mode works just fine as well.
     
  11. kemalakay

    kemalakay

    Unity Technologies

    Joined:
    Jul 12, 2016
    Posts:
    224
    Hey @caosdoar and @AcidArrow,

    Just a quick update: New light modes are now released in 5.6.0b2, you can download it from here: https://unity3d.com/unity/beta Please refer to release notes for known issues, we'll address them within the beta cycle.

    With the new shadowmasks feature, you can now use spotlight and point light to cast shadows on both dynamic and static objects. Mixed lights are now called as Stationary lights in Unity and I would like to emphasize that in new light modes, direct lighting is still calculated at run time, so materials on static meshes will retain their visual fidelity including full physically based shading support.

    We also prepared a documentation for this feature, you can read and find out the details here: https://docs.google.com/document/d/116JvLXljfbdfllOLlyzVvWmNWpbUwcYKV16blVHuS2E/

    Feel free to ask any questions or raise any problems you encounter.

    Thank you
     
    U7Games likes this.