Hey guys, I'm working on a game in jME that uses some two-dimensional images instead of models and I'm trying to figure out how to apply transparency properly to the texture.
Utilizing the following AlphaState:
AlphaState as = DisplaySystem.getDisplaySystem().getRenderer().createAlphaState();
as.setBlendEnabled(true);
as.setSrcFunction(AlphaState.SB_SRC_ALPHA);
as.setDstFunction(AlphaState.DB_ONE);
as.setTestEnabled(true);
as.setTestFunction(AlphaState.TF_GEQUAL);
as.setEnabled(true);
I end up with:
I am trying to end up with the background color to disapear and the main image to remain. That is happening sort of, except the main image is translucent, I want it to be solid. Can someone explain how to accomplish this?
I always use .png, that way you can have a true alpha background and set the alpha for each pixel and they are not lossy. Not sure about gifs
Think for youre prob, you dont want to blend the pixels of the apache. But, as the background is black and not transparent you cannot simply replace the pixel. Try changing the image to a png with a true transparent background - otherwise you will need to filter/skip the black pixels in the image
Havent enough time to get you code right now - can do tommorrow if the following doesnt help
Look at the FPS font rendering - as in the ortho FPS -, from memory each letter is taken from an image which lookups where the letter is, each letter is then rendedered to the FPS Quad with bakground as alpha
Are you drawing the terrain before the alpha textured quad? The texture combine mode also affects drawing, and those combine options are quite cryptic.
Though the probability is quite high that I'm crazy and just unable to figure out why, this is still not working for me. I would greatly appreciate it if someone more knowledgable than myself on this could point me in the right direction as I'm not sure what else to try.