Search Unity

Baked lightmap shadows jitter on screen edge in quest 2 standalone

Discussion in 'General Graphics' started by MalekMC, Mar 7, 2022.

  1. MalekMC

    MalekMC

    Joined:
    Nov 25, 2016
    Posts:
    13
    I have a scene with baked lightmaps. This scene works fine in the unity editor, and when testing using the link cable, the shadows work fine.

    The issue is in standalone mode, the shadows in the distance for certain objects become jittery and seem to z fight objects that are distant from them. This is a video that show the issue in action:
    Link:
     
  2. MalekMC

    MalekMC

    Joined:
    Nov 25, 2016
    Posts:
    13
    (Scene is upside down)
    (Look at the bar that is the furthest away, you can see black lines "emerge" from the ceiling onto it)
    Steps to recreate:
    Create 3D project
    Implement Unity XR / XI
    Add 3D model (Preferably a long hall with walls similar to mine)
    Add Directional light (Hard shadows)
    Set everything to static
    Bake lights
    Build and run
     
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    I don’t think it’s a lightmap issue. Looks more like the mesh isn’t water tight to me.
     
  4. MalekMC

    MalekMC

    Joined:
    Nov 25, 2016
    Posts:
    13
    Okay, I'm sorry but I am not sure what that means.
    My mesh is basically a plane for the ceiling, and stretched cubes intersecting it.
    I tried baking them which each object being it's own object or them combined to a single object, same issue
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,735
    I'm not 100% what I'm looking at with that low red compressed video.

    It's one of these 3:

    1. white pixel fireflies from the mesh not being water tight (not sure if this has a more proper term, my mind is drawing a blank right now), in which case, you fix your mesh.
    2. It's lightmap bleeding do to it dropping to lower mips and bright texels seep in, in which case, make better UVs with more padding / margin between the islands.
    3. It is actual z-fighting (although... with what?), in which case, either alter your geometry so there is less z-fight potential, change the near and far values on the camera so there is a shorter range that needs to be covered, if you are using 16bit depth, switch to 24bit.
     
  6. MalekMC

    MalekMC

    Joined:
    Nov 25, 2016
    Posts:
    13
    I should mention this only happens when the game is running in standalone mode and not when streamed from unity.
    Do you think that might help pin the issue down?

    1. About the water tight issue: This happens when different 3D models are close to each other, but far away from the player. (Close as in less than 1 unit away from each other, and further than about 40 units from the player)
    2. Do you mean I should regenerate the lightmap UVS when importing the model?
    3. surfaces are more than 0.2 units away from each other. Also how do I change the bit depth?

    Another not is, this issue only happens when the shadows are near the screen edge, and only on one side of the quest 2.
    So ceiling only has shadow issue, when near the top op of the view, no issues are present when near the bottom or middle of the screen.
    Left wall has issues when it is near the left side, no issues in middle or right side of the screen.
    Right wall has issues when it is near the right side, but no issues in the middle or left side of the screen.
     
  7. MalekMC

    MalekMC

    Joined:
    Nov 25, 2016
    Posts:
    13
    I managed to avoid the issue by making my polygons smaller.
    As in before I had a single plane stretched out to cover the whole length, of the walls / ceiling. I added loop cuts to it and the issue was gone.