Search Unity

Lighting Patches

Discussion in 'Global Illumination' started by beanie4now, Feb 6, 2019.

  1. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
    Very new to 3d/ lighting, i've baked this scene 30+ times trying to follow different forums advice and tutorial and this is still the best I can get
    l1.PNG l2.PNG l3.PNG

    Things that I have tried already (improved it somewhat)

    I have re-imported all my objects as smaller pieces so they have their own UV map things
    Reduced point lighting count down to 3.
    Messed with every setting I can find....
    Current setup

    lightsettings.PNG

    All of my objects pretty much have the same settings

    settings.PNG

    Would be grateful for any advice
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    Hey! The usual culprit for these kind of artifacts are invalid lightmap UVs and/or invalid lightmap texels. Did you author your lightmap UVs yourself, or did you let Unity generate automatic UVs for you?

    Try inspecting your scene using Texel Validity scene view mode (accessible through the upper left corner dropdown menu in the scene viewport). If after rebaking your lighting the visualization shows a lot of red texels, then you have texel validity problem. That issue can be mitigated by tracking down one-sided geometry, and enabling Double Sided GI in its material settings.
     
  3. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
    Used Unity to generate automatic UVs, just started getting to blender so generating UV's is not something i"m famaliar with. As for the red... not seeing any. crate.PNG
     
  4. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    The texel validity marks valid areas as green, invalid as red and undetermined areas as orange. In your screenshot you're not seeing any results at all, so there's not way of telling what the actual state of the scene is. You should also lower the lightmap resolution to something like 12 while you're trying things out, 60 is much too high for experimenting with the scene, assuming you're also using a unit of 1.0 as 1 meter for scale.
     
  5. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
    After looking through the blender files that I was given for this project it seems like it is probably a "normal" problem.
    Time to flip like 10,000 normals since recalculate seems inept...
    normals.PNG
    Thanks for the help.
     
  6. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
    Oh this... Oh god what does this mean... Give up now?
    Is there documentation on this texel validity stuff? I don't see how something as simple as one of rectangular shelves has invalid texels...whatever that means.
    new validity.PNG

    this is all I could find from https://docs.google.com/document/d/18dN_KWdF52ou7NXgbqhdB36kVFEyfmojn_JlCeoLN9Q/edit
    This is a VR project and from other reading i've done setting faces to double sided is bad for performance.... and sinnce like.. all my faces are invalid... that sounds bad
     
    Last edited: Feb 8, 2019
  7. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    When we shoot a ray starting from a surface point, and we hit another surface, we check the normal to make sure that we've hit the surface from the outside. If the normal points in the wrong direction, we check whether the object is double sided (essentially flipping the normal). If that's also not the case, we determine we've hit an invalid surface. This usually happens if you've setup your scene with intersecting meshes, e.g. you have a cube halfway in the ground. The surface texels of the ground that are covered by the cube will now hit the cube from the inside, so those will be flagged as invalid. The ground outside the cube will hit the outer side of the cube, so they will be marked as valid. In your case, if all the normals of the walls actually point outside, and the walls are not double sided, the lightmapper will keep hitting the wall from the backside (as that's what the normal is telling it), so it will mark the hit as invalid.

    Setting your material to double sided can be a quick way to determine if that's the problem, but actually fixing it would be flipping the normals on all broken surfaces.

    The backface Tolerance parameter is a measurement which you can use to allow e.g. 20% invalid ray hits, before the texel itself gets marked as invalid. For your specific setup right now, you can ignore that value.
     
  8. beanie4now

    beanie4now

    Joined:
    Apr 22, 2018
    Posts:
    311
    Ok so I totally reworked the blender files (just the walls now for testing)
    normal2.PNG walll1.PNG

    So that it is just a "single" one sided plane. After a bake I get this
    shaded.PNG

    The walls finally look as expected!

    View attachment 371923

    The validity isn't shown, just transparent... Although the lighting looks correct on the wall now. Is this correct?

    I would have expected the walls to be big green areas o_O
     
  9. Kuba

    Kuba

    Moderator

    Joined:
    Jan 13, 2009
    Posts:
    416
    We would expect that too. :) Please note however that this visualisation is currently available only right after the bake and the data is gone after an Editor restart or once you switch to another scene/scenes. Was that the case for you?

    Cheers,
    Kuba
     
  10. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Sorry for necroing this thread, but what do I do when I am getting surfaces with "speckled" invalid texels?
    I have a one-sided geometry ground plane that's getting this, quickly setting its material to be double-sided did not mitigate the issue.
    It's causing very clear noisy pixels in my lightbakes that the denoiser can't fix...

    Edit: I quickly modified the geometry to be double-sided, but this did NOT fix the problem either.
     

    Attached Files:

    Last edited: Jan 14, 2021
  11. uy3d

    uy3d

    Unity Technologies

    Joined:
    Aug 16, 2016
    Posts:
    187
    You are probably misinterpreting the invalid texel view. The red texels on the ground plane mean that the rays shot from there hit a lot of backfaces. So there's some other object in that scene that is causing this. Setting the ground plane to double sided won't fix this, you have to find that other object visible from the ground plane that is causing the issue and set that one to double sided (or fix the surface normals on the mesh).
     
  12. Yandalf

    Yandalf

    Joined:
    Feb 11, 2014
    Posts:
    491
    Thanks, in the meantime I did indeed find out that the problem's with the other objects in the scene causing bad bounces. Things are better now.