Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Inaccurate realtime GI light probes (too bright, too dark)

Discussion in 'Global Illumination' started by Lastair, Jul 31, 2015.

  1. Lastair

    Lastair

    Joined:
    Mar 16, 2012
    Posts:
    13
    Probe-lit objects are showing up noticeably too bright with lighter ambient light colors, using real time GI. Similarly with dark ambient lighting, they are too dark. The issues get more obvious in the brighter and darker areas of the environment, respectively. Essentially it's as if the "contrast" for ambient lighting on the light probes was turned too high.

    https://dl.dropboxusercontent.com/u/19949302/Unity/LightProbe/LightProbe.html

    This is an example scene I made from scratch to illustrate my problem. The lighting settings etc. are all the default 3D project settings. The non-moving spheres are static, with positions corresponding to light probe locations. The probe-lit dynamic sphere uses the exact same material as the static spheres, and you can see the significant inaccuracies in its lighting as it moves. Especially in bright areas for the white ambience, and in the dark areas for black ambience.

    I did come across some people who said they were using a darker albedo color on materials for dynamic objects to compensate for the extra brightness, but for me this is unworkable as the lighting in my actual project will change dramatically in real time - darkening the material would exacerbate the problem for dark ambience. I can imagine some carefully hand-calibrated system that dynamically uses both albedo and emission colors on the material to balance things out for both lighting extremes, but I'd rather not have to go down that route.

    Is this something I'm missing, a bug, known issue, a fundamental shortcoming of the lighting system or what?
     
  2. Potaski

    Potaski

    Joined:
    Aug 21, 2013
    Posts:
    52
    I have the same problem. The probes works best if you do a realtime lighting + GI setup and use the probes to provide indirect lighting for moving objects. If you choose to use all (most) baked lighting, it sort of works in linear rendering path. Although it will have too much contrast when the light is strong (exceed 2.0 intensity as I've tested).

    But in gamma mode, everything is wrong. The lightmap's appearance seems to be exactly like how it was lit in linear space (enlighten force calculate in linear?). The probe, however, doesn't look like linear lighting result, also far from gamma lighting. It's hard to describe it, here's image of my test.

    light_direct.jpg

    from left to right : Light Probe, Lightmap, realtime lighting(Gamma)

    You could see that it's very bad for artists, nothing is the same. I've tried bake in linear or gamma mode, both produce same result.

    Currently my solution is to save several different sets of lightprobe data in custom data format. And let artists mix and test for their desired result. It should be a 1-click-and-work situation (at least it was in unity 4), but now I have to spend time developing tools, teach the artists and spend more time tweak the results.
     
  3. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    116
    Yeah, I see the same. Gamma mode is all wrong, light probes are overbright and with distorted colors (looks like the color gets gamma adjusted when it shouldn't) and lightmapping is done in linear without the gamma adjusted color. So you end up with realtime lights, and lightmaps, and lightprobes which do not match.

    http://forum.unity3d.com/threads/lightmapper-uses-linear-color-mapping-when-set-to-gamma.336658/ here is my post. Ignored by unity support.
    It's a shame since we are forced to use gamma on mobile, and I guess we'll have to redo the lighting if/when they fix the bugs.
     
    Last edited: Jul 31, 2015
  4. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Hi! We should have a fix for the brightness difference in the probes soon. The reason the lighting wraps further around the sphere in your screenshot, is that we are using L1 spherical harmonics instead of L2. We are looking into adding L2 SH for the baked probes but that will be a separate fix in a month or two.
     
  5. Hjeldnes

    Hjeldnes

    Joined:
    Jul 22, 2012
    Posts:
    116
    That will be awesome :) What about the color difference between the lightprobe and the realtime light/lightmap. If you check the post I linked you can see that the lightprobe is much more saturated. It's not just the L1 wraparound, is it?
     
  6. KEngelstoft

    KEngelstoft

    Unity Technologies

    Joined:
    Aug 13, 2013
    Posts:
    1,366
    Since there was some gamma/linear issues in the pipeline, I hope your color differences will be addressed.
     
  7. Lastair

    Lastair

    Joined:
    Mar 16, 2012
    Posts:
    13
    Thanks for the responses and corroboration. The problem is indeed only with gamma-space - testing for that hadn't occurred to me for some reason. Switching to linear will at least let me temporarily continue with my project without getting distracted, even though its overall effect on the planned lighting is a bit undesirable. Hopefully that upcoming fix will make things right.