Search Unity

Ugly green light when baking.

Discussion in 'Global Illumination' started by Deleted User, Aug 16, 2018.

  1. Deleted User

    Deleted User

    Guest

    Hi guys, im trying to achieve realtime light result by baking. I cant understand why does my light goes green, when all settings are same, tried nearly everything. All advices are appreciated,thanks!

    Realtime:

    Baked:
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Perhaps it would help to list unity version, pipeline, linear, gamma, etc etc etc
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Are you targeting mobile? Is the wall particularly dark? It might just be dLDR.
     
  4. Deleted User

    Deleted User

    Guest

    - Lightweight Render Pipeline.

    - Targeting mobile.

    - Linear - gamma doesnt matter (stays the same).

    - I also cant use more than one mixed/realtime lightning ( triead increasing number of pixel lights, but it didnt change anything) .

    - Tried different quality including Ultra, tried simple lightning and physical material that are standart for LightWeight PipeLine.

    - Also tried increasing lightmap scale on material, lightmap settings .

    -Im a bit sorry, what is dLDR ?
     
    Last edited by a moderator: Aug 17, 2018
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    DLDR is Double Low Dynamic Range.

    It's the way Unity decodes lightmaps for mobile.

    Roughly it means this (if a Unity dev sees this, correct me if I'm wrong):

    The maximum lightmap value is 2, 2, 2 (for mobile). So let's say your light there is pretty strong and it wants to write a value of 4, 2, 0.5. This gets clamped to 2, 2, 0.5. So immediately it loses its redness (which is why it looks green-ish.).

    That value then gets multiplied with the texture, which looks pretty dark, let's say it's 0.2, 0.2, 0.2. So the final pixel value is something like 0.4, 0.4, 0.025.

    The way to work around it, is to use somewhat brighter textures and somewhat lower light intensities so that your lightmap doesn't get clamped a lot.
     
  6. Deleted User

    Deleted User

    Guest

    Thanks for reply, it realy works for pc, but is there any way to enable hdr on mobile, or my only choice is to play with colors/lights ?
     
  7. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
  8. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Currently, HDR lightmaps are not supported on mobile. However, you can expect this feature in Unity 2019.1
     
    Deleted User likes this.
  9. Deleted User

    Deleted User

    Guest

    Thats very good news! For now will just try to avoid bright light, could i also ask, why do i cant use more than 1 realtime/mixed lightning on Lightweight Render Pipeline? Increased number of pixel lights in quality and pipeline graphic asset, however i didnt take any effect?
     
  10. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    LWRP currently supports a single shadow-casting Directional Light. Multiple shadow-casting lights will be available in 2019.1

    In the meanwhile, you can set your punctual lights to cast no shadow and that should fix the issue.
     
  11. Deleted User

    Deleted User

    Guest

    Just tested, I can use Directionnal light with shadows + point light without shadows, but no more point lights, disabled shadows on all point lights. Removed directional light, left 2 point lights, but only 1 works, does it works as intended?
     
  12. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    This is strange. Which Unity version are you using? Also, have you updated to the latest LWRP package version through the package manager?
     
    Deleted User likes this.
  13. Deleted User

    Deleted User

    Guest

    Tried last Unity version 2018.2.4f1, Updated LightWeight to 3.0 ( last ), and it works only on PC Build, On Android only 1 point light works.
     
    Last edited by a moderator: Aug 22, 2018
  14. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Multiple lights are working fine here in our test cases, on both GLes3 and GLes2, shadows are not as we are working on a shadow atlasing system for the local lights. Can you post a screenshot of your pipeline settings?
     
  15. Deleted User

    Deleted User

    Guest




    Tried enabling/disableing vertex lightning, same results.
     
    Last edited by a moderator: Aug 26, 2018
  16. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Hi,

    I see you posted in the other main thread, you said you are only having this issue when switching to android? this is to do with a bug in the emulation mode that Unity puts the project in when switching.

    Can you check that under 'Edit/Graphics Emulation/No Emulation' is selected.

    Also for now I would make sure to disable the 'Local Shadows' checkbox on the pipeline asset as they are not working correctly and can cause issues with rendering lights.
     
  17. Deleted User

    Deleted User

    Guest

    Thank you for reply! When switched to android platform, i had OpenGles3, on scene it immediatly broke ( i mean all lights moved in one place, like there was only one light with bigger intensity.However i changed emulation to
    No Emulation and then back to OpenGles3, it worked again,but after hit Play it breaks or after i tried to build apk on android, and after build process was done, lights broke again. I thought on android it wont work either, but to my suprize it worked.



     
  18. Andre_Mcgrail

    Andre_Mcgrail

    Unity Technologies

    Joined:
    Dec 9, 2016
    Posts:
    244
    Hey,

    I'm glad you got it working, the issue here is that our Emulation mode as it exists now has some flaws, it skips some important parts and especially with the new SRPs it has lagged behind. Also it will turn itself back on after a build and also after closing/reopening the project, so it can be quite annoying.

    In the latest package(which you will be able to get when 18.3 betas releases) disables structured buffers which solves this temporarily until we fix graphics emulation on the Unity side.
     
    m0guz likes this.
  19. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Hello,

    I just popped over to see if I could find help with my own "ugly blue light" problem & saw this thread. I'd hoped it might hint at a solution, but it seems the OP and I have similar issues with different setups. I'm working on a VR game for PC (Oculus) and have a fairly simple scene setup with one mixed Directional light and several baked Area/Spot lights. For some reason, much of the scene will turn a ramped-up blue shade after baking the lightmaps for the scene. I've tried all sorts of variations of settings to try and cut it down/out with no luck and little in the way of change.

    Without baking:


    With baking:


    Current settings:


    I've tried this with both Progressive and Enlighten lightmapping, with all variations of the Mixed Lighting "Lighting Mode", with and without including Realtime Global Illumination and/or Baked Global Illumination, and with the various Intensity settings all set to 0. None of this seems to make any difference when it comes to the overpowering blue hue that is being applied & I can't seem to find where it's coming from or how to remove it. Any advice would be most certainly appreciated!

    I'm using Unity 2018.2.5f1 Personal, no particular rendering pipeline (that's all still new to me), Post Processing v2, and VRTK (which really shouldn't have any bearing on lighting so far as I know).
     
    Last edited: Sep 2, 2018
  20. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Reduce the intensity multiplier in Evnironment Lighting and rebake.
     
    ManuelMeyer likes this.
  21. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    I'm almost certain I've tried it at 0 without seeing a difference, but I'll give it another go just to be sure :) Thanks! I'll be back to report on how it went in, oh, three to six hours. :D
     
  22. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Yeah, but it's still my best guess :)

    Reduce resolution dramatically so you will see results sooner.
     
    krougeau likes this.
  23. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Drats, foiled again! Here's the results with Environment Lighting Intensity Multiplier set to 0 (and I tucked the one on Environment Reflections down to 0.5 for good measure). I was really hoping this was the solution, but I was also pretty sure I'd tried it and just about every other combination I could think of before asking for assistance. I've been at it for the better part of two days now, so I really can't say with any clarity anymore other than to say it's been a damned mess. :p


    latest results


    latest settings
     
  24. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Huh... That's weird. From the top of my head, I can't think of anything else.

    Can you share the scene? Or a simplified version of the scene? I could take a look.
     
  25. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Thanks ever so much for the offer! :) I tried scaling the scene down to more or less what you see in the screenshots, lowered the lightmap resolution and did a quick test bake... Lo and behold, the issue doesn't appear. While I'm still not sure just what the culprit is, armed with a faster "test bake" time (thanks again for that!) I should now be able to toggle things on/off and figure out just where the problem stems from. I've got a feeling I'll be kicking myself when I figure it out; it wouldn't be the first time.
     
  26. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Is it blue all over the place, or just near the area you are showing in the screenshot? Maybe there is a material that is set to emissive and has a strong blue color?
     
  27. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    It seems to affect anything that's "outside", which is why I figured it was related to the skybox. Doesn't seem to be the case though as the last attempt used the same skybox. I've got to reboot before it'll let me tinker further, but I should have it sorted out through trial/error in fairly short order, hopefully.
     
  28. krougeau

    krougeau

    Joined:
    Jul 1, 2012
    Posts:
    456
    Just wanted to check back in and report my eventual success :) Took some digging, but I eventually narrowed it down to being a problem with an aquarium I'd downloaded from the Asset Store. Not entirely sure what about it is broken, though I will be taking it apart later to see what I can learn. At the moment though, I'm just thrilled that my lighting is back to looking great & not like a Smurf exploded :D Thanks again AcidArrow! Have a great day!
     
    AcidArrow likes this.
  29. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,755
    Wooh!

    Glad you figured it out.
     
    krougeau likes this.
  30. BuzzKirill

    BuzzKirill

    Joined:
    Nov 14, 2017
    Posts:
    48
    For anyone having this issue, Project Settings > Player > Other settings > Rendering > Lightmap Encoding might be the issue. Mine was set to Low quality, changing to High made the greenish Directional light properly blue again.
     
    Corysia likes this.
  31. Corysia

    Corysia

    Joined:
    Mar 14, 2018
    Posts:
    108
    I'd just run in to this 'green tinge' for the first time in 2019.3.2.f1 with the URP. Mine was set to Normal. I flipped it to Low and it cleared up. Then I tried putting it back to Normal, or even trying High and the green didn't return. Yay!