Alpha blending...need help!

hola everyone.

I am making 2.5D game with JME2. I was maping a texture to a Quad. My texture is png with transparent background. So texture is mapped correctly. My texture image has few void space at the corners with transparent color so when texture is mapped to quad then those void space are also visible i.e quad is visible at those void areas. So i want to make Quad transparent so that my texture and quad melts with my background scene. I just want to know how to make quad transparent or apply alpha values. I hope you understand my problem.


The secret for transparency is the BlendState.

i think i am making some mistake here as i am not getting the desired output…

This is how my texture is getting rendered:

there is black color at void spaces where it should be transparent. I have a landscape texture as a background so those that landscape should be visible in place of that black areas. How to achieve that ??

here is the code

Quad land = new Quad("land1", 200, 10);

TextureState ts2 = display.getRenderer().createTextureState();

Texture t1 = TextureManager.loadTexture(

MaterialState ms=display.getRenderer().createMaterialState();
        ms.setAmbient(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));
        ms.setDiffuse(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));
        ms.setSpecular(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));

BlendState bs=display.getRenderer().createBlendState();



I've tried your code and the code snippet doesn't contain all the details (as you don't set the texture as the land renderState), however I do know what was wrong with it.

Firstly, a side note:

ms.setAmbient(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));
ms.setDiffuse(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));
ms.setSpecular(new ColorRGBA(0.5f,0.5f,0.75f,0.5f));

Here you've set the alpha for the material's ambient, diffuse and specular at 0.5, this usually means the object will appear opaque


Now there is no black color around the corner and its transparent there.