Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Textures created with Photoshop show up with a white border

$
0
0

All of a sudden, I started having this problem. I’ve used libGDX + Photoshop before and never had this problem. One of my textures is showing up with a white border/glow around.

enter image description here

The texture is the black blob on the middle, which is a 256 pixels png with a few black brushstrokes I created with Photoshop, just to test it.

Everything in libGDX is on default. I haven’t changed the blending function, I’m just using a SpriteBatch to render the image without any changes.

The weird thing is, some other textures I created with Photoshop, same size, RBG 8 bit color mode (just like my blob image), look fine. These are temporary textures I created by downloading a png from the web, pasting it into Photoshop, applying a solid color overlay effect to it and saving it back as a png.

Any idea what’s causing this?

Edit: Here’s how I’m loading my textures:

private static Texture createTexture(String fileName, boolean maxQuality, Texture.TextureWrap textureWrap) {
    Texture result = new Texture(Gdx.files.internal(fileName), true);
    result.setFilter(maxQuality ? Texture.TextureFilter.MipMapLinearLinear : Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear); // TODO: Are these the best?
    if(textureWrap != null)
        result.setWrap(textureWrap, textureWrap);
    return result;
}

texture = new TextureRegion(createTexture("data/blob.png"));

I just found out using this technique that the transparent pixels in my texture are white (1, 1, 1, 0). So I’m pretty sure the cause is a combination of this, the linear resizing and probably the blending function. Not sure what’s the right way to fix it though. Don’t want to change the resizing to nearest.


Viewing all articles
Browse latest Browse all 434

Trending Articles