2D sprites with diffuse and lighting causes lines between tiles

Hi, when I switch from the standard default material for sprites to the diffuse material, I get lines appearing between my tiles, especially when moving the camera

This only happens when a light source is affecting them

Does anyone know a fix for this?

Cheers!

Hi,

this is a problem with rounding / interpolation in OpenGL. It can happen in several places - so you might try one or more of the following:

  1. Try to move the camera only in full pixels. Avoid sub pixel coordinates. This might be hard to achieve in Unity…
  2. Add a border of 1 or 2 pixels around your sprites that repeats the outer pixels. This avoids dragging in transparent pixels from outside the sprite.

Best
Andreas

Sometimes you just have to build in order for the lines to go away.
It may seem obvious but I spent hours trying to fix it before I tried building it and then testing.

I know exactly what you are talking about, and my experience with 3D lights on sprites is no thank you.

I wouldn’t know how to code a 2D lighting system, Unity is supposed to have one coming out with 2019, so you might want to wait if you can, but this tool has saved me so much time trying to tweak with 3D lights and sprites and works exactly like I was hoping it would, you might want to consider purchasing it:

I highly recommend that over any other 2D lighting solution, and the author of it is a really cool guy who responds to questions within seconds on his forum.