Search code examples
unity-game-engine2dtextures

Weird dotted lines in Unity3D texture


I have a problem, there are dotted lines in my texture for no reason. You will need to look closely. I have tried exporting it as .jpg and .psd (its currently .png) and to my avail, it has changed nothing. Redid the entire image, I am running low on options, and this is why I have resorted to you. If someone could explain how to fix this, that would be great!

Screenshot


Solution

  • Why does it happen?

    1. Texture coordinates interpolation is done using floating point values, which are limited in their precision. This leads to errors in calculations.
    2. You use nearest neighbor texture filtration and this gives no chance for rendering software (D3D or OGL) to smooth these errors: only one texel will be chosen for each pixel.

    How to fix it

    Instead of using 16x16 texture, create, let's say, 256x256 texture (just scale your original image in your graphical editor using nearest neighbor scaling) and use it with Filter Mode: Bilinear.