Search Unity

Need help: Light-probes appear way too bright

Discussion in 'Global Illumination' started by MissedIsland, May 28, 2012.

  1. MissedIsland

    MissedIsland

    Joined:
    Sep 1, 2009
    Posts:
    13
    Hey guys,

    Thanks for reading this. I need some help with an issue.
    I've been trying to get light-probes to work. The lightmaps etc. all work fine in my scene but the light-probes don't seem to adopt the right values from the lightmap. I've tried everything for different spacing between the probes to adjusting lights, baking the probes separately etc. They seem to adopt some color information but they're pretty much all white / too bright, even in darker areas and shadows on the lightmap.

    Any idea what could cause this? Attached comes a screenshot.

    At first I thought this was normal but when I took a good look at the Shadow Gun demo scene I noticed the dark and bright differences on the probes.

    I also couldn't find a really good tutorial on how to set up lightprobes in the first place.

    Cheers,
    -Tim
     

    Attached Files:

  2. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Hey MissedIsland,
    It seems as if the base textures and main colors (both of which form albedo) on your materials are quite dark. In such a case one tends to increase light intensity to make the scene be brighter. If the intensity of the light that is gathered at the light probe position is bigger than 1 -- then when shown on the sphere visualising the light probe it clamps to white, hence you can't see any lighting change across the surface of the sphere.

    To quickly figure out whether this is the case place a sphere game object in your scene and check the Use Lightprobes checkbox on the Renderer component. Then create a new material and drag it onto the sphere and change the brightness of the main color on that material until some detail in the lighting shows up.

    A proper solution would be to keep your albedo (textures, main colors) as bright as possible as that allows the lighting to be in a more reasonable range (usually within 0-1) which is good for light probe visualisation, but also for lightmap encoding.

    If this is not the case though, you can create a new scene with a plane, a sphere and a directional light, add some light probes there, bake and make the sphere use light probes.You should be able to figure it out by tweaking the light intensity and rebaking, and changing the main color on sphere's material.

    You'll find more information about the light probe setup, usage and the difference between the single and the dual lightmap mode in the docs:
    http://unity3d.com/support/documentation/Manual/LightProbes.html

    Please let us know once you figured it out or if you still have problems.

    Cheers!
     
    NGC6543 likes this.
  3. MissedIsland

    MissedIsland

    Joined:
    Sep 1, 2009
    Posts:
    13
    Thanks a lot Kuba,

    Useful info! In my case however, the scene's ambient light somehow got cranked up to full white after the lightmap was baked, hence the white probes... stupid me :)

    It works properly now.
     
  4. Lootgear

    Lootgear

    Joined:
    Jun 18, 2012
    Posts:
    4
    One thing you might want to consider is using a light probe region editor. There's a script available on the Asset Store called "Light Probe Region Tool". It allows you to set a region for your lightprobes via script. You can control the area and density of the light probes, and make sure everything is lit evenly without going through the tedious process of setting them by hand.

    It's $5 from LOOT Entertainment.

    Best of luck with lighting your game!
     
  5. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Please remember though that the whole point of using tetrahedrons for the base structure, and not a uniform grid, is that you can make sure you have all the important light-shadow transitions covered and avoid light leaking through walls with a small amount of probes. Using a uniform grid is just not a good idea in most cases.

    Cheers!
     
  6. Memige

    Memige

    Joined:
    Oct 17, 2012
    Posts:
    1
    Actually, the Light Probe Region Tool isn't restricted to a uniform grid, it's primary purpose is to quickly populate the probes into an area so you can focus on rapidly adjusting them into the most efficient layout, rather than tediously populating them one at a time.
     
  7. SHoe

    SHoe

    Joined:
    May 13, 2013
    Posts:
    14
    I am having the same problem with Unity 5. If I set the light to "baked", the light probe objects become brighter and more flat looking comparing to the baked objects in the scene. If I set the light to "Real Time" the light probe objects match the baked objects.
    Is there a setting that I've overlooked or is this a bug?

    Thanks!
     
  8. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    Hey Shoe,
    Generally spherical harmonics (so the way lighting information is encoded in light probes) looses some fidelity when used for direct lighting compared to realtime lighting. That said, could you please submit a bug report on it, so we can make sure that what you're seeing is indeed expected?
     
  9. Polkatuba

    Polkatuba

    Joined:
    Oct 31, 2014
    Posts:
    79
    I'm experiecing the same issue too. Objects with light probes are way too bright compared to baked objects as seen in this image. All 3 spheres are using the same material (aldebo main color = 1).
     

    Attached Files:

  10. LeXuSMalus

    LeXuSMalus

    Joined:
    Aug 7, 2009
    Posts:
    8
    The same problem. Found out that this only happens when baking directional light. Spot light and Point light baking lighting normally.
     
  11. Phantomx

    Phantomx

    Joined:
    Oct 30, 2012
    Posts:
    202
    I have the same problem because my ambient is white. I need it to be white to achieve art direction, but the characters need darker probes. Why can't we bake probes only like before anymore? This would allow me to change the ambient color and bake the probes only.
     
  12. essimoon2

    essimoon2

    Joined:
    Nov 13, 2013
    Posts:
    195
    @MissedIsland Are you using Unity 4 or Unity 5?
    I noticed Unity 5 light probes seem to look way too rich in contrast compared to Unity 4 (too bright in the lights, to dark in the shadows).
     
  13. glennpow

    glennpow

    Joined:
    Jan 30, 2012
    Posts:
    56
    I also seem to see that light probes in Unity 5 sometimes appear brighter than they should be.
    Example: I have a static mesh with a PBR material and a dynamic mesh (with light probes enabled) using the same PBR material. I also have a single directional Light (set to Baked or Mixed) and a Light Probe Group, with the default 4 probes, surrounding the meshes.
    If I clear all baked lighting, then everything looks normal (discounting reflections), and the 2 objects display similar lighting to one another. If I bake, then static mesh retains it's proper lighting (via the baked lightmap), but the dynamic mesh is too bright.
    Here are images demonstrating. You can see that all I do is toggle whether the mesh uses lightprobes or the realtime (Mixed mode) directional light. The first images shows the sphere with correct lighting (no probes), and the second image shows the brighter sphere using probes.

    Any ideas what's causing this?
     

    Attached Files:

  14. SpiriTx

    SpiriTx

    Graphics QA Unity Technologies

    Joined:
    Apr 12, 2012
    Posts:
    252
    It's a bug, you can track it's status here
     
  15. barbe63

    barbe63

    Joined:
    Oct 6, 2014
    Posts:
    35
    Can we please have some feedback on the resolution of this issue? Thanks.
     
  16. Mahoney014

    Mahoney014

    Joined:
    May 20, 2015
    Posts:
    5
    I'd like to add to this thread - we are experiencing exactly the same problem where all the light probes are 'blowing out' the brightness of the realtime objects. This is definitely a bug!
     
    ksam2 likes this.
  17. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    I'm guessing there has still not been a status change on this?
    We are trying to work around it, but not managing to.
    What we are currently trying:
    Adding the lights ourselves to the probes, as a point light can be seen as a directional light if you simply pre-multiply down the intensity by the falloff. However somewhere, somehow the gamma/linear seems to be causing us issues, and we have as of yet been unable to figure them out.
     
  18. jspoto

    jspoto

    Joined:
    May 10, 2013
    Posts:
    8
    I've reproduced these results, and can validate the OP's claim.

    This means baking is broken in the general case, which is a big deal. This has been logged, but with no official comment, validation, or indication of fixes in 5.1 beta.

    What's most unfortunate, is the official response indicating things are working correctly -- they definitely are not. Someone on the rendering team needs to dig into how their SH values are being computed, because they broke in Unity 5.

    I'm more than happy to share test scenes illustrating these issues with any support staff.
     
  19. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    It is surprising that more than half a year ago, in the early closed beta was normal 0_o

    While I expected the incredible experience of Unity 5. But much time has passed, and we still can not make upgrade to U5, because they lose all the beautiful and high performance light models.
     
  20. Phantomx

    Phantomx

    Joined:
    Oct 30, 2012
    Posts:
    202
    Well it's still working fine now when in linear mode, the issue is with gamma mode. maybe this video was in linear mode.
     
  21. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Hm.. maybe. Anyway, we have broken Gamma=/
     
  22. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    And so, I also want to show that "Linear" also has some problems with the brightness, which are not so obvious, but still. Look at this.
     
  23. Phantomx

    Phantomx

    Joined:
    Oct 30, 2012
    Posts:
    202
    it's not too bad, it also depends on the setup of your lightprobes. You may want to have tetrahedron shape instead of a grid like you have.
     
  24. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Since it seemed to work in linear space but not gamma space, we tried adding our own quick linear-to-gamma conversion in our shader for dynamic objects. While I'm pretty sure it's not the correct place to do it, it might work for some until an official fix appears. It's not trivial, we were only able to do it quickly since we already had our own simple fragment shaders on dynamic objects for our game. We ran the input from lightprobes through a pow(lightprobecolor,0.454545) before applying the light to the character. (Basically the quick way to convert from linear to gamma space).

    The light levels seem more appropriate now, though the wraparound light effect is still there (light seeming to travel further around the lightprobes spheres than they should.)


    Explanation of examples, left side is normal. right side is with the linear-to-gamma conversion.
    1. Center character and K.O. character on the right side are lit by lightprobes. Both go from black
    to an appropriate light level.
    2. Both doors and character are dynamic objects. Light levels and saturation improved.
    3. Middle character is dynamic, oversaturation is gone from strong lights.


    gammadifferences.jpg
     
    bluescrn, cgnoah and Phantomx like this.
  25. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    I'm considering writing a SH generation code, specifically for light probes, beacuse going from 4.x where they were baked with Beast, (shadow's from walls ect did mask light), to unity 5 where they are plain broken in gamma mode, and have some serious artifacts and issues in linear, in addition to no longer taking into account nearly as much information as they did before........

    My question is, what interest is there for such a product?
     
  26. essimoon2

    essimoon2

    Joined:
    Nov 13, 2013
    Posts:
    195
    Yeah, I did the same for now but I'd definitely prefer more consistent results between the old Unity 4 Beast and the new Unity 5 Enlighten in terms of light probes. If it was possible to bring results closer together I'd save myself (and my whole team) a lot of work getting back the old results.
     
  27. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    At Betadwarf for our already released game Forced I did manage to get them somewhat close by adding the lights to the probes manually. However that is still not the same quality as the beast version, no matter how we tried! But if (somewhat) close is good enough, then I can give some pointers :)
     
  28. cgnoah

    cgnoah

    Joined:
    May 8, 2015
    Posts:
    3
    Futurerobot, that is a great temp fix. Thank you so much!
     
  29. Almakos

    Almakos

    Joined:
    Dec 13, 2013
    Posts:
    179
    Hey Futurerobot,
    Do you think this fix is possible with Unity's Standard shader?
    Any advice on how difficult it might be?
    Thank you
     
  30. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Almakos: The reason we could do it pretty quickly is that we already had our own custom shaders that added lightprobe colors manually. (Due to some vertex fog tricks etc. that we wanted.) In the standard shader it is done "under the hood" as far as I know, making it less straight forward. I'm sure it's possible, but I wouldn't know how. However I've seen (can't find the post) that they're aware of the lightprobe issue and working on it.
     
  31. Zicandar

    Zicandar

    Joined:
    Feb 10, 2014
    Posts:
    388
    The only solution that will give the same quality as lightprobes had in 4.x is to make a completely new baking system for them. As in the 4.x series they were baked by Beast, allowing really high quality. Now they simply add the lights, and even if you fix the gamma issues and such you get light leaking through walls and other such crap.
     
    bluescrn and Ximo-Catala like this.
  32. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    If they're really that bad/simplified, then why the heck has the 'bake probes' button been removed?!
     
  33. Benjamin.chevalier

    Benjamin.chevalier

    Joined:
    Jul 3, 2014
    Posts:
    21
    Hi there,

    Has this issue been fixed with the new Unity3d 5.3 ?

    Cheers,
    ben
     
  34. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    They claimed it to be fixed in 5.3 (albeit without L2 SH coefficients)

    Haven't tested it myself yet, but according to comments on the issue tracker, they only fixed it for realtime GI mode?!!! - leaving baked probes in gamma mode (critical for some mobile developers!) still broken?...

    (Although maybe those comments relate to beta builds?)
     
  35. Benjamin.chevalier

    Benjamin.chevalier

    Joined:
    Jul 3, 2014
    Posts:
    21
    wow that's kind of odd... thanks for the feedbacks, though !
     
  36. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Because the light probe generation depends on the precompute, so it is currently not possible to compute only the light probes.
     
  37. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    The SH coefficients are now always in linear space - also on mobile, both in baked and realtime mode. If you are seeing issues this is not the reason. We are aware of an issue with HDR images and are working on a fix.
     
  38. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Testing the Unity 5.3 release version, there are still some light probelems (couldn't resist). Basically the light wraps too far around to the dark side of the probes, causing entire objects to be illuminated by a light coming from just one side.

    Here's a picture of a test scene, lightmap settings on the righthand side. all objects use default standard material. I got pretty much the same results in gamma/linear and precomputed realtime/baked GI, so I didn't take multiple shots.

    Shot of the probelem (couldn't resist again)
    LightProbelems.png
     
    Last edited: Dec 11, 2015
    ChayChay likes this.
  39. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Confrontation, gentlemen.
    U4 vs U5.3
     
    bluescrn likes this.
  40. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Is that 5.3 screenshot using linear lighting and 4.x using gamma? - the ground plane is a lot brighter in the 5.3 shot, too
     
  41. StenCG

    StenCG

    Joined:
    Mar 26, 2015
    Posts:
    66
    Both use gamma (android platform).
     
  42. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    The brighter ground plane is due to a different bug:
    Lightmaps in Unity 5+ are baked linear even if the editor is set to gamma mode. Linear generally appears brighter since the light-falloff is "longer". While linear lightmaps are more correct, it's still a bug since the realtime lights will be gamma and won't match a linear lightmap. (Still, don't want to derail this thread with that bug, since lightprobes matching the lighting is, to many people, very important. (And also mixed lights do not work at the moment, so I guess that bug comes first in the mixing area)).

    Edit: I actually haven't tested going into the lightmap and disabling the sRGB sampling. If the lightmaps are HDR maybe the setting can make them gamma-space. I've noticed some other areas where textures are set to the wrong sampling. I think maybe it was directional lightmaps which were modified by the linear settings and caused very wonky results.
     
    Last edited: Dec 12, 2015
  43. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi, we found and fixed an issue in 5.3 where we multiplied by 2 in the wrong place. The fix is heading for a patch release asap but it is too soon to say which one. Now the probes and ambient is perfectly matching external reference tools.
     

    Attached Files:

  44. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    That looks much better!

    I'm not sure I understand the chart. Are both rightmost spheres lightprobes? What is the difference between the top and bottom one on the right side.

    Also, the top-right looks a bit vague compared to the ground proof. Is it possible to see a "light / dark" example like the image I posted above?
     
    hakankaraduman likes this.
  45. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    The point is to show how closely Unity's output is to the ground truth (lower left). The top-middle and top-right is generated in Unity. The lower-middle and lower-right is from an external reference that generates L2 and L1 spherical harmonics.
     
  46. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Hello again! Tested with the latest 5.3.1p1 patch, and got better results, but it still appears off.
    • Same testing scenario as before; one light, no ambient or bounce.
    • The lightprobed object appears brighter than the lightmapped/realtime version.
    • The light creeps a lot further around the backside of the object, about 50% further than a realtime lit or baked version (The shadow terminus position doesn't match).
    • Issues appear in both linear and gamma workflow.
    Image 1 is baked light, Image 2 has only realtime
    BakedLight.png Realtime.png
     
    Last edited: Dec 27, 2015
    HG_Kim likes this.
  47. HAWK12HT

    HAWK12HT

    Joined:
    Nov 6, 2012
    Posts:
    26
    Well issue persist in 5.3.1p2 as well. Please fix this as top priority. It is a lot worse especially when doing Arch Viz lighting similar to the Courtyard demo where you have plenty of objects set to dynamic just to save bake times.
     
    AaronC likes this.
  48. Futurerobot

    Futurerobot

    Joined:
    Jul 13, 2011
    Posts:
    179
    Yeah it's still not matching up. I did some more detailed tests, and it seems bounce lights and flat-sided objects stand out more than my previous test. Images below.

    The ones with the bouncelight I didn't bother pointing out that the boxes still are mismatched.

    @KEngelstoft I've submitted a new bugreport since the old one was closed, it contains my test scene and description: (Case: 760728)



    LightProbeTestSetup.png LightProbeIssue1.png LightProbeIssue2.png LightProbeIssue3.png
     
    StellarVeil likes this.
  49. NGC6543

    NGC6543

    Joined:
    Jun 3, 2015
    Posts:
    228
    Hey @Kuba, I have a question. Before shutting down Unity it finished baking the lightmap. But when I restart it, Unity starts rebaking and I have to wait until it finishes it. I do checked the 'Auto' but I haven't changed a thing since the last bake. I just quitted Unity and restarted it.
     
  50. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    83
    Hi!

    I'm having a similar problem when using a single directional light set to baked where the lightprobes transition from an outdoor to an indoor environment. This results in a very ugly falloff on the probes and therefore also on our in-game character. Is there any chance that this is getting patched in the 5.2.x cycle? Our release kind of depends on it as downgrading isn't an option due to certification requirements.