Reversing the Alpha State

I guess there is a simple switch somewhere to do this but I can't for the life of me find it.

I have a model with a whole bunch of textures with alphas. The problem is that the alpha's are reversed so when I render solid is transparent and transparent is solid. Unfortunately there are way too many textures to reverse manually and the process that produces the models is a third party package so I can't change it there.

So is there a simple way to reverse the alpha order on a texture?

I do not know if there is anything built into jME for that, but here is one way of doing it…

Load the image into a java.awt.image.BufferedImage instead of creating a texture at once.

Use BufferedImage to access the image data before creating the texture itself… You can access the alpha channel separately and do whatever you want with the bytes there… I am using it to get the alpha values for every pixel and use it to build my scene.

Then use this new modified BufferedImage to create a texture. TextureManager.loadTexture comes with a method of creating the texture out of a BufferedImage although it is not used most of the time I think.

You were probably hoping for a one-liner :slight_smile: but I cannot help you with that.

Perhaps you can use an alpha test with a reference of 1 and a function of less than?