Search Unity

  1. We want you to join us at GDC this year! Take a peek at all of the events we will be hosting during the week of GDC.
    Dismiss Notice
  2. Tell us about your experience here and you’ll get early access to the 2018 Game Studios report + more goodies.
    Dismiss Notice
  3. Unity 2017.3 has arrived! Read about it here.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  5. We've closed the job boards. If you're looking for work, or looking to hire check out Unity Connect. You can see more information here.
    Dismiss Notice

Unity 5.3.1p2 Light Probe issue: dark spot in the opposite direction of the directional light

Discussion in 'Global Illumination' started by andrei-ichim, Jan 8, 2016.

  1. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    I can't figure out why I get the dark shadow on the opposite side of the directional light. See image.
    The light probe that is in the shadow of the cube doesn't get that shadow. As soon as the probe moves out of the cubes shadow it does that.
    What am I missing?
     

    Attached Files:

  2. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    Made a new screenshot that displays the issues (the first one was a little confusing).
    [​IMG]
     
    HG_Kim likes this.
  3. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    129
    did you bake your lightmap?
     
  4. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    i have same issue in Unity 5.3.
     
  5. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    Yes. The cube and the plane are Unity primitives set as Static. They cast shadow and receive shadow. The directional light is set to Baked. Unity is generating LightingData and Lightmap-0_comp_light files.
    In Lighting, I checked Baked GI and unchecked Precomputed Realtime GI. General GI Directional Mode is set to Non-Directional.
    These are the only changes I made to a default Unity scene. It's very easy to reproduce.
     
  6. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    129
    Oh, that's sad. I'm in trouble baking lightmap on static LODs right now... hell, it won't bake even if I put plenty of light probes around them!!
     
  7. SkaarjSlayer

    SkaarjSlayer

    Joined:
    Oct 10, 2013
    Posts:
    108
    Running into the same issue here, would like a Unity answer on this!
     
  8. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Noticed the same issues, and it's not only with directional lights, but tests show it seems to happen to any light, that is not very weak. Have tested with both emissive, directional and point lights. I have reported a bug on it, but it's not yet made it to the issue tracker.

    We're discussing it in the on-going (now quite old) lightprobe thread here. I'm not sure, but I think this particular artifact appeared when the lightprobes were updated due to being overexposed? (Towards the bottom of the first page.)
    http://forum.unity3d.com/threads/need-help-light-probes-appear-way-too-bright.137680/
     
  9. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
  10. HG_Kim

    HG_Kim

    Joined:
    Dec 4, 2013
    Posts:
    2
    Strange...
    I have same problem in 5.3.2f1. but it's OK in 5.3.1f1 .
    So.. 5.3.1f1 was fine. and after 5.3.1p1, lihgt probes have problem.

    • GI: Light probes and ambient (everything with SH calculations) match ground truth more closely now. (754898)

    Found release note on 5.3.1p1 and 5.3.2f1 . Maybe fix of 754898 have caused the problem.
     
    Last edited: Feb 5, 2016
  11. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    Unity replied to my bug report:
    "We have been able to reproduce this bug and have sent it for resolution with our developers."
     
    NGC6543 likes this.
  12. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    @HG_Kim The light probes earlier had different problems than this dark spot. Basically the light wrapped almost all the way around the probe to the backside, giving them no dark side. This bug was resolved and I believe this is when the dark spot appeared. Something probably went wrong in the calculations. I saw you and some others mention this doesn't happen with indirect lighting, but I think it's actually that indirect lighting is usually not strong enough to trigger the effect.


    Here's an animation of the dark spot appearing with only indirect light, though strong enough to burn the shadow side. LightProbeBounce.gif

    Top-down view so you can see the light doesn't directly hit the sphere. It does not hit the probes the sphere
    uses at the end either. (That only moves the darkspot to face away from the spotlight.)
    BounceSceneSetup.png

    @andrei.ichim Have you gotten an issue for it? Our bugs are probably the same. Some kind of wonky math gotten into the lightprobes.
     
    HG_Kim likes this.
  13. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    Here's the issue: 760786
     
    Last edited: Feb 19, 2016
  14. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Hi! This is expected output when strong light is included in the light probes. Spherical Harmonics will exhibit ringing artifacts like this. 5.2 output looked smoother but it was wrong. 5.3 output matches external reference implementations.
    If you light is fully baked, we have to include the direct lighting in the light probes or your lightprobe lit objects will appear too dark.
     
  15. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    @KEngelstoft The effect is very noticable even without strong lights. This is a 0.54 intensity directional light. Left sphere shows lightprobe. The right sphere for baked reference. The baked sphere getting light bounced off the ground, while the lightprobes seem to not capture this, and instead get the dark artifact.

    Lightprobes.png
     
  16. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    @KEngelstoft Here's an animated gif of a default scene in unity with the original directional light with an intensity of 1. There are no other lights in the scene. It's still wrong even with a lower intensity, but less obvious because everything is darker.

    http://gph.is/1QLU9pa

    Set up a scene with a floor, a cube to cast a shadow and a few light probes and you will see that something is wrong.
     
  17. Kocosephia

    Kocosephia

    Joined:
    Jan 14, 2016
    Posts:
    1
    Just adding in my voice that this is a real problem. We're getting black shadowing all over characters in our scenes even in the presence of strong ambient light.
     
  18. bigbrainz

    bigbrainz

    Joined:
    Jul 21, 2015
    Posts:
    60
    It's causing significant problems with all our levels. We're watching this thread eagerly. I see bug report was closed as "By Design." Really needs to be re-opened!
     
  19. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    I see now that the bug I reported on this, and yours @andrei.ichim, has been set to "Status: By Design". Does this mean that there's no intention to fix this problem?
    https://issuetracker.unity3d.com/is...-match-lighting-on-static-lightmapped-objects
    https://issuetracker.unity3d.com/is...ect-sun-light-are-not-receiving-bounced-light

    @KEngelstoft I understand some implementations can have artifacts and inaccuracies, but this is a bit much to be considered a viable solution. What was used for the lightprobes in 4.x where this wasn't an issue? And is there a reason this solution won't be used in 5.x?

    Unity 4.7, no blackspots opposite lightsources, bounced light and light levels matches static geo very nicely.
    I loaded the same scene in 5.3 and baked it there, it's a huge step backwards.
    Simple scene, boxground, static and dynamic sphere. Default Directional light and ambient.
    LightProbeComparison6.png
     
  20. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    I was playing around more with the scene where I had this bug and I noticed that if I set the directional light to blue, the bounce to 0 and the ambient color to white I get yellow on the opposite side of the light probe.
    Is this by design? If I pick another color I will get the opposite color on the light probe's dark side.

    [​IMG]

    Edit: It's a little more obvious with 0.5 ambient intensity
    [​IMG]
     
    Last edited: Feb 18, 2016
  21. Owers

    Owers

    Joined:
    Jul 7, 2012
    Posts:
    30
    @KEngelstoft It's a lot more noticeable when you're using emissive surfaces.

    With a bright green emissive source the indirect light turns magenta. Change the emission colour to magenta and the indirect light turns green:
    [​IMG]

    Change the emission colour to blue and the indirect light turns yellow. Change emission to yellow and indirect light turns blue:
    [​IMG]

    Change the emission colour to red and the indirect light turns cyan. Change emission to cyan and indirect light turns red:
    [​IMG]

    In fact, indirect light colour always seems to be the polar opposite of the direct light source colour. This could be a symptom of colour values being subtracted, either in the shader or due to light probes containing negative values. I don't know how this stuff works exactly, but it's what I've figured from my tests.

    Even if there are inaccuracies when light probes are calculated the result is still blatantly unacceptable, and literally dismissing this bug as a feature is a huge oversight. Please consider looking into this issue more seriously.

    I have uploaded the project here for all to look at (5.3.2f1):
    https://dl.dropboxusercontent.com/u/52401794/Test-Lightprobes.zip

    The results you see above are using Real-Time GI, switch the Directional Light to mixed or baked and you'll still see similar results.
     
    Last edited: Feb 19, 2016
    NGC6543 likes this.
  22. andrei-ichim

    andrei-ichim

    Joined:
    Oct 10, 2013
    Posts:
    22
    Last edited: Feb 19, 2016
  23. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Hi! We do intend fixing this. The reason 4.7 didn't have this problem, is because Beast was able to bake out L2 Spherical Harmionics for light probes. Enlighten isn't able to do this at the moment (only L1 coefficients are supported) but we are working with Geomerics to add L2 support.
    We have reopened your bug and we will either fix it by getting L2 support into Enlighten or by implementing L2 baked coefficients for direct light in light probes.
    Thanks you for reporting the issue and stay tuned for the fix.
     
    Hjeldnes and Futurerobot like this.
  24. Aceria_

    Aceria_

    Joined:
    Oct 20, 2014
    Posts:
    60
    Is there a rough ETA on the fix? We're currently at the point where we have to make the call to go back to 5.2 unless this issue is fixed within the next week or so, otherwise we might end up having to delay our launch.
     
  25. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    @Aceria_ It will be a few days more I think... We got a new version of Enlighten now that supports baking L2 coefficients and indirect lighting looking allright, but there is still an issue with the direct part.

    If you don't depend on the ambient probe (and your target platform has a powerful GPU), you can try this workaround in your UnityCG.cginc but you also have to remove all calls to the L2 SH evaluation:

    Code (CSharp):
    1.  
    2. half r(half3 normal, half4 coeffs)
    3. {
    4. // Let L0 be the scalar part and L1 the vector part.
    5. half L0 = coeffs.w;
    6.  
    7. // Undo multiply by 2 from expand L1 to L2.
    8. half3 L1 = coeffs.xyz * 0.5;
    9.  
    10. half modL1 = length(L1);
    11. if (modL1 == 0.0)
    12. {
    13. return L0;
    14. }
    15.  
    16. // Let q = (1 / 2)(1 + L1.n)[half - Lambert]
    17. // to form q[half - Lambert term] the dot product is with normalize(L1),
    18. // ie just with the *direction* of the L1 vector. (All the other terms take account of the length of L1.)
    19. half q = 0.5 + 0.5 * dot(normal, normalize(L1));
    20.  
    21. //Let r = | L1 | / L0 be the ratio of the vector
    22. half r = modL1 / L0;
    23.  
    24. return r;
    25. }
    26.  
    27. // Reconstruct using new recommended model from Geomerics:
    28. // This model has correct energy, dynamic range, no negative values, and significantly lower
    29. // RMS error from ground truth than old skool Ramamoorthi - Hanrahan linear reconstruction.
    30. // TODO optimize for performance.
    31. half NonlinearL1ComputeChannel(half3 normal, half4 coeffs)
    32. {
    33. // Let L0 be the scalar part and L1 the vector part.
    34. half L0 = coeffs.w;
    35.  
    36. // Undo multiply by 2 from expand L1 to L2.
    37. half3 L1 = coeffs.xyz * 0.5;
    38.  
    39. half modL1 = length(L1);
    40. if (modL1 == 0.0)
    41. {
    42. return L0;
    43. }
    44.  
    45. // Let q = (1 / 2)(1 + L1.n)[half - Lambert]
    46. // to form q[half - Lambert term] the dot product is with normalize(L1),
    47. // ie just with the *direction* of the L1 vector. (All the other terms take account of the length of L1.)
    48. half q = 0.5 + 0.5 * dot(normal, normalize(L1));
    49.  
    50. //Let r = | L1 | / L0 be the ratio of the vector
    51. half r = modL1 / L0;
    52.  
    53. //Let p = 1 + 2r
    54. half p = 1.0 + 2.0 * r;
    55.  
    56. //Let a = (1 - r) / (1 + r)
    57. half a = (1.0 - r) / (1.0 + r);
    58.  
    59. //Then irradiance = a + (1 - a)(p + 1)q^p
    60. return L0 * lerp((1.0 + p) * pow(q, p), 1.0, a);
    61. }
    62.  
    63. // normal should be normalized, w=1.0
    64. half3 SHEvalLinearL0L1 (half4 normal)
    65. {
    66. //unity_SHA* coefficients are in { x, y, z, DC } order.
    67. x.r = NonlinearL1ComputeChannel(normal, unity_SHAr);
    68. x.g = NonlinearL1ComputeChannel(normal, unity_SHAg);
    69. x.b = NonlinearL1ComputeChannel(normal, unity_SHAb);
    70. return x;
    71. }
    72.  
     
    Futurerobot likes this.
  26. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    216
    Any word on this fix? This lightprobe bug is a major buzz kill for our team
     
  27. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    Unity 5.3.3f1.... same bug.
    Really a BIG problem here...
     
  28. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Still working on it...
     
  29. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    143
    I don't get where Unity is going. They are working in a new Light Probe grid feature but a really simple case is broken.
    Please stop adding features and fix all the broken things. Please!
     
    IgorAherne and Skolstvo like this.
  30. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    We are several people working in the same area, so the probe grid is not distracting me from fixing this important bug.
     
  31. Haagndaaz

    Haagndaaz

    Joined:
    Feb 20, 2013
    Posts:
    216
    Glad to hear :)
     
  32. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    Any chance to get this fixed in 5.4 ?
     
  33. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Yes, we will fix it in both 5.3 and 5.4 and future versions.
     
    Hjeldnes and crudeMe like this.
  34. Stephen-MF

    Stephen-MF

    Joined:
    Apr 14, 2015
    Posts:
    10
    Today two new versions of unity was released. Witch one should I get to have this issue fixed?
     
  35. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    In Unity 5.4 now you can exclude directional lights from lightprobe... this solves partially this issue.
     
  36. Stephen-MF

    Stephen-MF

    Joined:
    Apr 14, 2015
    Posts:
    10
    Tried both. 5.3.4 and 5.4.
    No change in my scenes.
    Still bad lightprobes.
    upload_2016-3-16_11-53-34.png
    Stephen
     
    IgorAherne and Bravo_cr like this.
  37. Bravo_cr

    Bravo_cr

    Joined:
    Jul 19, 2012
    Posts:
    143
    - "We did a huge amount of new feature improvement in 2015, but we realize that some of this was at the expense of stability," said CEO John Riccitiello, promising that 5.3.4 is a "fully stable release" .

    "Fully stable release" != "working simple features"
     
    Skolstvo likes this.
  38. Xanthius

    Xanthius

    Joined:
    Aug 20, 2012
    Posts:
    28
    5.3.4 and it is broken still. This is killing our production.
     
  39. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Hi! The fix didn't make it in, before the cutoff for the GDC build. We will get it into a patch release soon.
     
    crudeMe likes this.
  40. Xanthius

    Xanthius

    Joined:
    Aug 20, 2012
    Posts:
    28
    Will there be a patch for 5.3 and it fixed in release of 5.4?
     
  41. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    Thank you, can't wait for it. :D
     
  42. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    882
    Yes, both 5.3 and 5.4 will get the fix.
     
    popMark and Dee Va like this.
  43. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    78
    Any idea when the patch will be released?
     
  44. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    78
  45. Argenzio

    Argenzio

    Joined:
    Apr 27, 2014
    Posts:
    198
    Really would like to know this too...
    I only hope that "no news" aren't "bad news".
     
  46. MvdLaar

    MvdLaar

    Joined:
    Dec 27, 2012
    Posts:
    15
    Tinovdk likes this.
  47. forestrf

    forestrf

    Joined:
    Aug 28, 2010
    Posts:
    48
    I am also having the problem. That dark spot is problematic
     
  48. Reanimate_L

    Reanimate_L

    Joined:
    Oct 10, 2009
    Posts:
    1,941
    Which version of enlighten 3.03 or 3.04?
     
  49. Pixeldamage

    Pixeldamage

    Joined:
    Sep 6, 2010
    Posts:
    52
    Really need this fix too. I opened up the Blacksmith demo for reference (as I know that uses light probes too) but it uses precomputed realtime which doesn't suffer this issue. Any updates on when we can expect a patch release that solves this? (on either 5.3 or 5.4)
     
  50. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    386
    Hi guys.

    I think I have a similar problem with my project, but I'm not 100% sure about it.

    moved.png

    This is my scene after I instantiated some prefabs from assetbundles. You can see that the shadows on the front of the tent are clearly wrong. Could it be that this the same bug?