Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

All lights overexposed when upgrading project to Unity 5.3

Discussion in 'Global Illumination' started by olavrv, Dec 14, 2015.

  1. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    453
    Great news! Thank you!
     
    Unity-Nikos likes this.
  2. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    What's the status of this issue in 5.4beta? I'm on 5.4b19 and everything is way overexposed (Baked GI, Directional), the only light probes I have are on my terrain trees though.
     
  3. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    87
    GoGoGadget likes this.
  4. Deleted User

    Deleted User

    Guest

  5. Unity-Nikos

    Unity-Nikos

    Unity Technologies

    Joined:
    Sep 30, 2015
    Posts:
    87
  6. thebarryman

    thebarryman

    Joined:
    Nov 22, 2012
    Posts:
    130
    Hi, I was wondering if I could have some help resolving a related issue.

    Our specular highlights after upgrading our project from 5.2 to 5.3 and subsequently 5.4 got broken in such a way that objects that had a weak, broad specular highlight before now had a much stronger highlight, and objects with tighter, brighter highlights were now weaker.

    I followed the advice in this thread RE: the UNITY_BRDF_GGX and UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 flags but found that they were not the culprits after all. Rather, it was a result of a change made to BRDF1_Unity_PBS function in UnityStandardBRDF.cginc.

    In 5.2.x, the specular term of lighting was calculated in this way:
    half specularTerm = max(0, (V * D * nl) * unity_LightGammaCorrectionConsts_PIDiv4);

    In 5.3.0 and beyond, it is now calculated in this way:
    half specularTerm = (V * D) * (UNITY_PI/4);
    if (IsGammaSpace())
    specularTerm = sqrt(max(1e-4h, specularTerm));

    specularTerm = max(0, specularTerm * nl);

    Our project is in fact using gamma space, and I found that the bolded section is what is throwing our look off (Toggling GGX makes a much subtler difference). I am guessing that this was added as a bug fix to gamma-correct a part of the specular calculation (just guessing, since I do not see any mention of this change in the 5.3 upgrade notes). However our artists already balanced the materials to the un-corrected lighting calculation and this has thrown off the look of our project.

    My question is, what is the best way to rebalance our materials to account for this change? Like I said, some materials seem to have gotten darker specular as a result, and some have gotten brighter highlights. It'd be nice to have some technical principles to guide us in rebalancing our materials. Unfortunately just changing the CGInclude file to use the previous calculation is not a feasible solution, since it would be very difficult to integrate into version control and to make sure that all team members moving forward will be on the same page.
     
    Desktopdaydreams likes this.
  7. thebarryman

    thebarryman

    Joined:
    Nov 22, 2012
    Posts:
    130
    So even though the new gamma correction for the specular calculation is having a big effect on our lighting, it alone is not the whole overexposure issue. We have totally real time light and are getting a way brighter scene after upgrading from 5.2.x.

    I get OK results by halving the value of ambient color and reflection intensity, but it's hard to tell if it matches exactly because of the changes to specular intensity that I posted about above.

    What is going on here? Help please!!!
     
    Desktopdaydreams likes this.
  8. kei_kff

    kei_kff

    Joined:
    Mar 28, 2013
    Posts:
    8
    Hi @Unity-Nikos

    Is this method (using UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2) still applicable in Unity 5.5?

    We recently upgraded Unity from 5.3.4 to 5.5.0. and noticed that some specularity and nomal map definition came really weaker(softer/flatter).

    Before,
    When we had upgraded Unity from 5.2 to 5.3, we really liked the 5.2 Standard Shader look.
    So we had decided to go with the above method which Unity-Nikos showed here.
    We still needed to tweak the values of materials/lighting,too even with using this method. but Overall, we had achieved something similar look like 5.2 Standard shader on 5.3.
    Now we are upgrading to 5.5.0, then we found that the specularity and normal looking weaker than before.

    So we'd like to know if this (UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2) method is still working or not.

    Thank you!
     
    Last edited: Jan 12, 2017
    Desktopdaydreams likes this.
  9. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Hi Folks,

    I just thought I'd add our tale here too. We have recently upgraded from 5.2 to 5.3.7f1 to address VR support and various fixes.

    We noticed the same issue as @thebarryman regarding changes to UNITY_BRDF_GGX and UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 flags.

    @Unity-Nikos I was wondering if this is confirmed as working? There seems to be no change at all in scene to materials when turning of GGX. We're using Deferred rendering, Linear space and real time GI along with no ambient lighting but there is a dull sheen across everything. We've tried reworking specular maps to account for the changes but get very different results and its not feasible to rework the entire texture asset library.

    Surely a change of this magnitude should have accounted for backwards compatibility/ legacy support? At the moment we will have to return to 5.2.

    Please can someone urgently respond to this thred.

    Best,
    Tim
     
  10. mortenm

    mortenm

    Unity Technologies

    Joined:
    Nov 6, 2015
    Posts:
    15
    Hey Tim,

    >I was wondering if this is confirmed as working?

    As far as I can tell UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 has been removed.
    We've had a big push since 5.2 towards standardization and compatibility with existing authoring tools so that smoothness ramp is gone. I realize it's a painful upgrade for those who were already well into their projects of course. If you need visuals to look like 5.2 I recommend you stick with 5.2 until you're ready for an upgrade. If this is not an option then alternatively patch the shader with the relevant differences.

    > There seems to be no change at all in scene to materials when turning off GGX

    Normalized phong and ggx do look very similar. ggx is slightly sharper but has a prevailing milky tail. There's a comparison shot here:

    https://blogs.unity3d.com/2016/01/25/ggx-in-unity-5-3/

    >lighting but there is a dull sheen across everything

    Have you tracked down which contribution causes this? Indirect diffuse, direct diffuse, indirecent specular or direct specular?
     
  11. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Hi @mortenm ,

    Thank you for the reply. I've been meaning to get back to this thread after doing some further digging. From what I have found the changes to UNITY_BRDF_GGX and UNITY_GLOSS_MATCHES_MARMOSET_TOOLBAG2 flags only work in forward rendering and thats maybe that's why we weren't seeing any changes (we're using Deferred). If the smoothness ramp has been removed though then that might also explain it!

    We've had to rollback to 5.2 which is a real shame and has put in an awkward position in regards to VR development.

    > Normalized phong and ggx do look very similar. ggx is slightly sharper but has a prevailing milky tail. There's a comparison shot here:

    Thank you for that. Unfortunately its very noticeable in how we have our materials setup. Our specualr highlights look way too blown out and flat.

    > Have you tracked down which contribution causes this? Indirect diffuse, direct diffuse, indirecent specular or direct specular?

    It seems to affect everything but I haven't had the time to really get to the bottom of it.

    I came across multiple posts with very similar issues though:
    https://forum.unity3d.com/threads/5-3-standard-pbs-is-wrong-cannot-eliminate-remove-specular.375339/
    https://forum.unity3d.com/threads/standard-terrain-shader-smoothness-solved.297691/
    https://forum.unity3d.com/threads/absolutely-rough-non-smooth-material-with-standard-shader.294409/

    The closet we came to a fix ( credit to @LIVENDA) was to Change line 648 from the UnityStandardCore.cginc to:

    outSpecSmoothness = half4(s.specColor, s.oneMinusRoughness)-0.0423+(s.oneMinusRoughness*0.0423);

    This seemed to reduce the 'sheen' we were seeing on all surfaces but then changes in the lighting and richness of the textures became apparent . Its an odd one.

    That's as far as I got as it was just eating into our development time.

    > If this is not an option then alternatively patch the shader with the relevant differences.

    Thanks for this,it sounds promising. How would one go about it?

    Best,
    Tim
     
    Last edited: Mar 17, 2017
  12. mortenm

    mortenm

    Unity Technologies

    Joined:
    Nov 6, 2015
    Posts:
    15
    >Thanks for this,it sounds promising. How would one go about it?

    Duplicate internal-deferredshading.shader and put it in the project folder. Replace the built-in version of it with your version in graphics settings in unity. Do diffs between unity 5.2 cginc files and whichever version of unity you want to upgrade to and bring in the relevant differences to the brdf/lighting. You can also duplicate standard.shader if you need to make material changes that impact gbuffer pass or for forward lighting to update. In this case you will probably need to make a script that updates/touches all your existing materials to make sure they rebuild but besides that should work fine.
     
    Desktopdaydreams likes this.
  13. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    @mortenm ,

    Many thanks for that. I'll try set aside some time this week and see if I can begin preparing the cginc files.
     
  14. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Hi @mortenm ,

    Apologies for getting back to this thread. I've slowly been working my way through 5.2 cginc files and trying to swap out the relevant differences to the brdf/lighting but I keep coming up with no noticeable differences.

    There are changes in quite a few of the .cgnic files, in particular UnityStandardBRDF.cginc and UnityStandardCore.cginc and it seems that making all of the 'relevant' changes has no affect compared with just altering one calculation as mentioned before.

    Unfortunately I don't really know where to go from here as there isn't really any specific documentation regarding the changes that I can find. I spent probably the best part of 30 hours digging through the code.

    Is there anything further I can try or do you have any resources that may help?

    It would also be great if anyone else who has made these changes and they worked, post here with a bit of advice?

    Many thanks,
    Tim
     
  15. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Just thought I'd pop back here to see if anyone has had any success with reverting changes in 5.3 .cginc files to use 5.2 brdf/lighting?
    Many thanks,
    Tim
     
  16. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    4,458
    Hey guys... I'm having an issue with my lightmaps being way overexposed in Unity 5.6 when I enter play mode.

    When not in play, everything is normal. I posted this issue in another post where someone else ran into this. It makes the game unplayable.



    An overexposed.



    Evening turning off my post effects don't help. And I'm using Directional Lightmapping.
     
  17. Rave-TZ

    Rave-TZ

    Joined:
    Jul 21, 2013
    Posts:
    77
    Quick fix
    Go to Edit>Project Settings>Graphics

    Then uncheck Use Defaults in the Tiers
    Now set the Standard Shader Quality to Medium or Low. This immediately fixed the overexposure issues I had with importing an older project that used HDR.