Search Unity

Lightmap error at runtime.

Discussion in 'Global Illumination' started by Avol, Aug 10, 2020.

  1. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    Code (CSharp):
    1. ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    2. Parameter name: Red color (Infinity) must be in range [0;1].
    3. UnityEngine.Experimental.GlobalIllumination.LinearColor.set_red (System.Single value) (at <2e6610ed29844f85a37924f81509fe5d>:0)
    Any idea what causes this error? Happens after upgrading to 2020.1.
    Disabling deprecated light probes doesn't solve the issue. Why does it say experimental global illumination?
     
  2. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    Hi,
    Does this happen only on a specific project, or on new, blank projects as well?
    Which OS are you on?
    If you could post a repro project, that would be very helpful, and the fastest way to find the root cause.
     
  3. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    It does only happen on a specific project. I'm on windows.
    Project is quite complex with many plugins and shaders, so finding a cause is a nightmare. Also the error doesn't repeat itself at all times, rather every few minutes for about 100~150 frames. It does not seem to be correlated to enabling / disabling ( I could be wrong, but couldn't find any pattern) some features at runtime.
    Could it be related to lux etc shaders, since I'm unsure of their linear / gamma conversion part. Project is using gamma color space. Anyhow, if it is unrelated to base unity, will have to go the hard way of finding the source :)
     
  4. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    I suspect it might be related to color temperature calculations, maybe try messing around with the color temperature settings on your lights. Without more information though, it's hard to say.
     
  5. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    Code (CSharp):
    1. ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
    2. Parameter name: Red color (Infinity) must be in range [0;1].
    3. UnityEngine.Experimental.GlobalIllumination.LinearColor.set_red (System.Single value) (at <49f4e7e791cc4fffacd88f729e2b1e4c>:0)
    4. UnityEngine.Experimental.GlobalIllumination.LightmapperUtils.ApplyColorTemperature (UnityEngine.Color cct, UnityEngine.Experimental.GlobalIllumination.LinearColor& lightColor) (at <49f4e7e791cc4fffacd88f729e2b1e4c>:0)
    5. UnityEngine.Experimental.GlobalIllumination.LightmapperUtils.Extract (UnityEngine.Light l, UnityEngine.Experimental.GlobalIllumination.SpotLight& spot) (at <49f4e7e791cc4fffacd88f729e2b1e4c>:0)
    Does indeed say it's trying to use spot light color temperature, but none of the spotlights in the project use color temperature nor any code sets it at runtime.

    both GraphicsSettings.lightsUseLinearIntensity and GraphicsSettings.lightsUseColorTemperature are set to false
    upload_2020-8-19_12-15-37.png
     
  6. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    Hmm, that is interesting, I'll try taking a look at that part of the code.
    Could you open the spotlight in the inspector and enabled debug mode (button next to the padlock icon, in the top right). That should reveal some new settings, including a "Use Color Temperature" toggle and a "Color Temperature" setting. I'm curious about what these are set to.
    I included some screenshots for clarification.
     

    Attached Files:

  7. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
  8. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    Thanks for the information, this is helpful. I'll let you know if I figure anything more out.
     
  9. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    Few more questions:
    • Which colors are your lights, is that pure white? (RGBA(1,1,1,1))
    • Does the error still occur if you change the color, for example to pure blue?
     
  10. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    They are of a few shades of red and blue. Will try pure white, will let you know if that changes anything :)
     
    Pema-Malling likes this.
  11. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    I think I solved the issue. Does not seem to throw the error during little testing that I did.
    It happens because I set light intensity to ridiculously low value such as: 7.320962E-39, while transtioning intensity from 8 to 0 exponentially. Rounding that value up to something more reasonable fixed it. Could it be the case? Something with floating point precision? Though strangely it didn't always throw the error on those values.
     
    not_Dusty likes this.
  12. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    328
    That's a good clue, thanks. I'll have to do some more digging into that code. I'm glad you solved your issue.
     
  13. momoguru

    momoguru

    Joined:
    Mar 9, 2014
    Posts:
    11
    i am having the same issue, and cannot pinpoint what object might be causing it.
     
  14. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    647
    The same problem after upgrading to 2020.3.45