Texture interpolation and alpha test

Good morning.

I have a texture like this :


The black color is transparent and other colors are a picture.

I enable the alpha test and i use :

bear in mind that if your texture filter is set to one of the LINEAR or MIPMAP modes (eg GL_LINEAR_MIPMAP_LINEAR) then even if the top level texture map contains only 0.0 and 1.0, intermediate values will creep in during the filtering process
I suppose that i will have to find a workaround because this behaviour is conform to the spec of OpenGL.

So i ask you how should i do ?

You could move the alpha channel to a different texture that is not linearly interpolated. (Use a combiner or shader to use the alpha/red channel as the output)

Enable GL_ALPHA_TEST, and play with the threshold for glAlphaFunc until you find it satisfactory.

An even better way would be to only change the incoming textures : each “black-transparent” texel B just aside colored texel(s) Cs should be given the average color of Cs.

Oh btw, it is a nice 3D Syndicate screenshot :slight_smile:
I would love to see more of this, do you have website or something ?

Thank you for your help.

This screenshot is from personal experiences. I’am playing with the syndicate graphic ressources. The page of this project is here : http://icculus.org/libsyndicate/