View Full Version : Texture interpolation and alpha test

07-05-2007, 05:32 AM
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 ?

07-05-2007, 08:45 AM
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)

07-06-2007, 12:02 AM
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 :-)
I would love to see more of this, do you have website or something ?

07-07-2007, 04:51 AM
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/