Transparent PNG texture getting white border at angles

I have a transparent PNG that I am using as a texture for a quad.



It looks correct when pointing directly at the camera (facing the camera) but begins to get a weird white glow once it is turned at an angle.









Ideally, it would always just show the black parts. The original PNG only has black and full transparent pixels.



I am not sure why this is occuring. I thought maybe the texture sampler might be doing some weird blending, but I can’t seem to get a different result.



Does anyone have any ideas?





Here is the code I am using for the quad

[java]

Quad quadMesh = new Quad(quadSize, quadSize);

Geometry quad = new Geometry(“Quad”, quadMesh);

quad.setQueueBucket(Bucket.Transparent);



Material mat = new Material(Scene.getSceneAssetManager(), “Common/MatDefs/Misc/SimpleTextured.j3md”);

mat.setTexture(“ColorMap”, Scene.getSceneAssetManager().loadTexture(“protractor.png”));

mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);

mat.getAdditionalRenderState().setAlphaTest(true);

mat.getAdditionalRenderState().setAlphaFallOff(0.01f);

quad.setMaterial(mat);

[/java]

I can see the white border even on the first image… Or am I wrong?

Ah sorry, that is a bad screen shot. Here is the actual PNG

Ah, I fixed it by changing the filters on the texture to:

[java]

tex.setMinFilter(Texture.MinFilter.NearestNoMipMaps);

tex.setMagFilter(Texture.MagFilter.Nearest);

[/java]



Now it samples as I expected :slight_smile:

1 Like