Search Unity

Question Dirty looking baked lighting

Discussion in 'Global Illumination' started by Spacelag, Jul 30, 2021.

  1. Spacelag

    Spacelag

    Joined:
    Nov 26, 2020
    Posts:
    11
    Hey all,
    after following the great advice from my last post I stumbled into another issue with baked lights.
    I added a bunch of Area lights both near windows and on the ceilings as ceiling lamps. Now however, possibly after adding the ceiling lamps (i turned them off and it seemed better, but probably just less noticeable), my shadows look.... dirty, as you can see in these screenshots:



    It's a really unpleasant type of artifact and i haven't found a way to get rid of it. I tried turning off lightmap compression, changing lighting mode from shadowmask to subtractive, turning up lightmap resolution, turning off ambient occlusion, and as I already mentioned turning off the ceiling area lights but that didn't really help.
    These are my current lighting settings:

    I have made sure to double & triple check that every imported model has "Generate Lightmap UVs" checked.


    Thanks in advance for any tips :)
     
  2. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    Significantly raise the "Samples" values. Try Indirect Samples of 8192. If it improves but still looks bad, raise further.

    Lightmap padding of 10 is overkill, try something like 3-4.
     
    Spacelag and JamesArndt like this.
  3. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Just wanted to add to what @AcidArrow has said. If you are using area lights, make sure to bump the direct sample count to at least 256. Otherwise, you will suffer from lightmap noise in areas lit directly by area lights.
     
    Last edited: Aug 2, 2021
    Spacelag likes this.
  4. Spacelag

    Spacelag

    Joined:
    Nov 26, 2020
    Posts:
    11
    Unfortunately it only makes the issue less noticeable, but it's definitely still there:

    I will try raising the values even more tomorrow as suggested by @AcidArrow, however this already increased bake times from around 40 minutes to 3 hours so it's kind of a pain to potentially waste that much time just waiting for the task to finish without being able to do much else ^^' Thank you though for the quick responses
     
  5. noahx

    noahx

    Joined:
    Nov 22, 2010
    Posts:
    77
    I was getting a "dirty baked" lightning and I simply increased the lightmap size to the next level/option and it went away. Maybe that can help. In the screenshot, your Max Lightmap Size is set to 1024, try increasing it to 2048.
    It's funny but in my case, the objects were so simple and way smaller (probably 1/1000th the size of your scene) and I set that option to 2048.
     
  6. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,791
    I'm used to making overnight bakes at this point... Baking is not a fast process and an interior that is mostly lit indirectly, is one of the tougher scenarios.

    If you want faster bakes, especially for preview purposes, I generally like keeping the Samples values fairly high and reducing the "Lightmap Resolution" value a lot. Like you have at 40 now, try sub 10 and see how that goes.

    Also, try making a bake with filtering OFF, so you can tell more easily where the areas with a lot of noise are.
     
    Spacelag likes this.
  7. BlandonDu

    BlandonDu

    Joined:
    Dec 26, 2016
    Posts:
    10
    from my exp:
    1 check the scene view with the UV charts, see if the texture density is displaying properly.
    2 if not, tune the "lightmap scale" in the mesh renderer component until the grid charts looks good.
    3 ASTC compression method is way more clean than the default compression method.
     
    Fazerdoo likes this.
  8. UnityLighting

    UnityLighting

    Joined:
    Mar 31, 2015
    Posts:
    3,874
    Indirect lights (area lights, sky light, emissive materials) has too much noise
    you can use 180 degree spot lights as area lights to reduce noise much as possible:


    note: if you are using HDRP, you can write a simple script to change shadow radius for the light source. it's not available by default in the HDRP's light inspector
     
  9. pineco222

    pineco222

    Joined:
    Feb 10, 2021
    Posts:
    1
    I noticed that optix denoiser can cause dirty looking lightmaps. I think that with nvidia gpu and filtering set to auto, optix is always used.

    Other denoisers give better results to me. Using rtx 3080 with newest drivers.