Texture masking problem
The masking code for textures with a fully transparent section (lesson 20) works fine for me, but only with the depth testing disabled. This means that all textures with a mask are being displayed in front of everything else.
Is there any way to use this masking effect with the depth buffer? And if not, how does this effect usually get drawn?
Of course you can mask with depth buffer. There are alot of different ways for masking, and NeHe *only* presented one solution.
I recommend using a texture with an alpha channel, and use alpha masking while drawing the texture.
It will do the trick if alpha is either 100% opaque or 100% transparent. But with semi-transparent texels, you will unfortunately be faced to eternal transparency problems.
ps: be careful, if you use linear filtering the limit between opaque and transparent will interpolate semi-transparent pixels. That is, a binary alpha channel may yield to semi-transparent zones when texture is maginfied.
I recommend using a texture with an alpha channel, and use alpha masking while drawing the texture.
It will do the trick if alpha is either 100% opaque or 100% transparent. But with semi-transparent texels, you will unfortunately be faced to eternal transparency problems.
ps: be careful, if you use linear filtering the limit between opaque and transparent will interpolate semi-transparent pixels. That is, a binary alpha channel may yield to semi-transparent zones when texture is maginfied.
Vincoof:
Easily fixed if you set the Alpha test to (GL_EQUAL, 1.0f)
Sander Maréchal
[Lone Wolves Production][Articles][E-mail]
Easily fixed if you set the Alpha test to (GL_EQUAL, 1.0f)
Sander Maréchal
[Lone Wolves Production][Articles][E-mail]
<hr />
Sander Marechal<small>[Lone Wolves][Hearts for GNOME][E-mail][Forum FAQ]</small>
This will eliminate all transparent pixels, but obviously sometimes that''s good to keep semi-transparent pixels.
For binary textures, I agree that glAlphaFunc(GL_EQUAL, 1.0f) will certainly do the trick, but for alpha channels that have more than 1-bit, some semi-transparent pixels may not be eliminated.
For binary textures, I agree that glAlphaFunc(GL_EQUAL, 1.0f) will certainly do the trick, but for alpha channels that have more than 1-bit, some semi-transparent pixels may not be eliminated.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement