Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

issues with Lighting; can't make areas bright white

Discussion in 'Global Illumination' started by KDurzy, Oct 8, 2015.

  1. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    I've been noticing some issues while working on a project recently. The project was started in Unity 4.something but has now switched to 5.1.2f1. Anyway, I was working on baking Lightmaps and noticed the lights just were not behaving as I thought they should. I made a test scene to test some things out and wanted to ask if anyone can help me figure out what is going on.
    Attached is an image of the test scene; The first part shows the setup of the lights and meshes, one of the lights is set to blow out and create a pool of white right below it, the other is just set very bright. The second part shows the baked Lightmaps with the result being only a not-very-bright area where the lights are supposed to be. Certainly brighter than the shadow they are in but not what I would expect. The third part flashes in the scene window as the LMs are building, and then is replaced by the horrible looking Lightmaps.
    Has anyone seen something similar happen? Any ideas on what burried setting might be causing it? I have tried switching from linear space to gamma, forward to deferred rendering, turning Precomputed Realtime GI on and off... just about every tickbox in the Lighting panel on/off, to no avail.
    Any help would be very appreciated!

    LMw_errorExample_cubes.png
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,022
    Try unticking compressed see if that helps.
     
  3. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    Hey. Yeah I tried that as well, no change.
     
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,328
    Your screen indicates that you're running engine on DX9 gpu.

    To get "running specular lights" effects you need to set mode to "Directional Specular" and resolution to about 80. Your current resolution is 10.
    2.jpg
    That's baked light.

    And you'll need hardware that supports shader model 3, which is not available on DX9 GPU. Result still won't be perfect and it will still look different compared to dynamic lights.

    Extra brightness you see apparently comes from skybox and reflection. Setting both ambient intensity and reflection intensity to zero makes lighting more similar to original:
    4.jpg

    Here's dynamic lighting for comparison:
    1.jpg

    And directional lightmaps:
    5.jpg

    I think you're seeing the issue because lightmap resolution is too low.
     
  5. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    Hi Negfinity, thank you for the detailed reply.
    I did try setting resolution up to 80, no change.
    Lightmap resolution being too low doesn't make sense anyway, as that has never been an issue before; if one pixel should be bright white, that pixel should be rendered/baked bright white. I certainly cannot have LM resolutions set to high numbers when I am baking a very big scene (downtown of a city for example), and need only 2-3 max Lightmaps.

    My machine has a Radeon HD7870 (DX 11 capable, and ticking the "GPU skinning" does not change the bake results), but the project is set to iOS... has something changed since 4.6 in that regard where switching to a different platform when working in Windows will no longer yield correct results? I had worked on this project in iOS mode before (with Beast lighting of course, 4.6) in order to have it look representative of the final image on iOS... How else is someone working on a windows machine supposed to create content for iOS? Is it now just a guessing game in terms of the final look of graphics with Unity?
    Dynamic lighting is not the issue, everything looks fine when I have the lights set to Realtime or Mixed, but I cannot leave realtime lights in the scene for the final build of the project.... that's why we have Lightmapping in the first place, so we don't use Realtime lights and save processing power/time. I noticed that in your first screenshot you also have Mixed lights set, if all of your results were with that setting, then it's not indicative of my problem.

    I have worked on this problem all morning and have finally found what is causing it, and it really seems like a BUG to me. Posting a second reply above so as not to mix it with this, already long, one
     
  6. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    So, it appears as something in Unity has indeed changed in terms of Lightmap presentation while in iOS mode. If anyone could shed any light on this I would much appreciate it! I really need a work around or some sort of solution as this cannot really be working as-intended. I need to be able to work on iOS projects and be able to see correct lighting results. This cannot be a correct result... unless the lighting for iOS is now just garbage.

    Here is an example image;
    LMw_iOSLightmaps_BuggedResults.png

    I created a brand new Project to test this.
    Part A shows the lighting setup; All lights set to Baked (Mixed or Realtime not helpful as I need to have no lights in the final scene, at least not these lights which should be baked), the scene is a little dark because there are only 2 lights, the Directional is at an extreme angle, its all OK, fine.
    Part B shows the baked lightmap. This is what I am expecting the result to look like! Yay! The light blows out as it is very close to the floor, although I would expect the same to happen to the blue block in that location, so that is still worrisome (I do not have the Project open as I had to take care of a bunch of other things for Work and now I can't get to it).
    And here is the problem;
    Part C shows the malfunctioning iOS Lightmaps. The ONLY thing that's changed between B and C is that the Platform was switched to iOS. The way the Lightmap was displayed on the meshes just changed... flicked to this garbage clamped look once the switch finished (really fast in an empty brand-new Project). Re-baking yielded same results, nothing helped.
    Changing to Directional Specular helped the look, but the brightest spot was still clamped to the same value as seen here. That is my main issue, the brightest spot created by a Light in Unity while on iSO with built Lightmaps is NOT pure white as it should be, but the, probably, Ambient-or-Emissive-at-1 value of the shader the light is shining on.

    So, my questions;
    Why may this be happening? Could there be some setting somewhere that changes the way Lightmaps are processed in iOS? Could there be a setting that correctly displays what would be seen on an iOS device?
    I have not tested this on device yet, I guess I could do that but it would be quite a big process as I have not been doing the builds and tests on the Project I am working on now. If the results are the same on device then this has to be a bug with the way Lightmaps get processed for iOS now.

    TLDR; Lightmaps bake and look fine on Standalone, switching to iOS Platform turns them to crap. Why?
     
  7. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,328
    I would guess that it has something to do with texture format in which lightmaps are stored on IOS. That's a guess, though, because iOS is not one of my areas of expertise. Basically, if lightmap texture stores intensity and it must be brighter than 1.0, but it is saved in something that has, for example, 8bit precision, you won't get overbrighting you want. I mean, your material is gray, if you multiply it with white (1.0 value), it will stay gray.

    You'll need to tear apart standard shader for ios to figure out why exactly that happens. It might help to test project on actual ios device, if you can.

    Aside from that, I suspect that your only option is to contact support and hope that they'll reply to you.
     
  8. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    Yeah I figured it is something like that as well, which is why I'm assuming it's a bug. Why would the Standard shader be basically useless on Mobile devices (iOS at least)? Our idea in switching to the Standard shader in Unity 5 was to have something that should runs well and has the functionality we need. It may be that we have to rethink that.
    Thanks for giving me the idea to test with other materials, I really should have thought of that before. In case anyone is interested, I'll post my findings below as well.
     
  9. KDurzy

    KDurzy

    Joined:
    Feb 2, 2015
    Posts:
    24
    Well it was indeed a Shader issue, thanks Negfinity!
    For some reason the new Standard Shader does not like Lightmaps in iOS. Luckily the Standard Specular Shader seems to work fine with them! I may have to tweak some of my material setups and textures to work better with the Standard Specular way of things, but at least I should get proper results in the baked Lightmaps.
    Image below; Same scene as above, nothing changed just switched shader to Standard Specular.
     

    Attached Files:

  10. Aiursrage2k

    Aiursrage2k

    Joined:
    Nov 1, 2009
    Posts:
    4,835
    Okay same issue