I am building a scene with ex2d sprites and I noticed that in the left and top border, pixels get either transparent or darker, depending on which shader I use. Here is what I get: Captura de Tela 2012-01-23 ...
The fact is that my image has no alpha at all, and that 1~2pxs border of alpha cannot exist!
If I change the shader, some may have darker colors instead of alpha, but I cannot have that either!
The fact is that this happens only on the left/top borders. I am not using any lights or shadows, and I am working with ex2d sprites.
Any suggestions on what I should do to flatten those borders without any alpha or darker colors?
I discovered a setting that ~sometimes~ solves the problem.
On the texture, I had “Repeat” set as “Wrap mode”, changing it to “Clamp” solved my problem.
Note that “solved” is very relative. It did not work on a huge texture I had as an atlas map, I had to create a smaller texture with that option and then it worked. This was kinda laborious and annoyed me a lot until I figured it out, do you know why this would happen? Changing from “Repeat” to “Clamp” may make sense, but why it would not work on a large texture, so that I needed to create a smaller atlas? weird… haha
By the way, I was using ex2D/Alpha Blended from ex2d. But that also happened with Diffuse, for instance.
Clamp will work, but only if you keep your UVs inside of the 0-1 range (otherwise it just repeats the edge-most pixels indefinitely). My guess is that ex2d may give UV values outside of the 0-1 range.
It was mostly fault of the “filter mode”, I changed it from “bilinear” to “point”, in addition to using wrap mode as “clamp”, and the weird border disappeared. The camera won’t get near of those textures, anyways.