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. Dismiss Notice

Question Light2D Sprite Light moves when camera moves

Discussion in '2D' started by Th3_Spectre, Jul 15, 2023.

  1. Th3_Spectre

    Th3_Spectre

    Joined:
    Apr 3, 2023
    Posts:
    5
    As the title says, i'm wondering how i can prevent this from happening.
    These are the sprite lights looking normal:

    These are the sprite lights moving causing gaps between each other when the camera moves:

    If anyone has any ideas on how to prevent this that'd be awesome!
     
  2. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    It looks like any other pixel (non)perfect seam, I doubt it is something specific to sprite lights

    Just search for "seams in my 2d game unity" etc. to find other solutions

    In general:
    • make sure the pixel perfect settings are correct
    • make sure to snap all objects on all axes using the snap tool with the correct increment
    • maybe check the light render scale in the 2d renderer data settings of your project(also make sure the urp asset is assigned in the graphics setting)
    upload_2023-7-15_14-5-58.png
     
  3. Th3_Spectre

    Th3_Spectre

    Joined:
    Apr 3, 2023
    Posts:
    5
    Hey, cheers for the reply.

    I don't have any seams with any sprites in the game, I've messed around with it a bit and the visible seam in the bottom picture is due to my sprite light moving slightly when the camera moves revealing the black section of the cookie sprite used for lighting the image underneath.

    Id love to figure out how to prevent this for future cases but in the mean time since my rooms are static i guess ill change it over to a freeform light.
     
    Last edited: Jul 16, 2023
  4. venediklee

    venediklee

    Joined:
    Jul 24, 2017
    Posts:
    143
    If the position of the transform component doesnt change, it is not moving and it is a seam

    Open up the frame debugger and see how it looks there. Check for “light texture”s. Are there any seams there?
     
  5. Th3_Spectre

    Th3_Spectre

    Joined:
    Apr 3, 2023
    Posts:
    5
    I just rechecked my settings and i forgot to change light render scale to 1 while setting stuff up haha. That sorted it, thanks! i've changed over to freeform lights for stationary objects anyway but this is good to know for when i need sprite lights :)
     
    venediklee likes this.