   Masking & Alpha
  Hey I have these tree models with a texture that needs to be masked I want the trees to appear transparent in certain parts so it looks like real leafs sort of like this imageI am using a Mask to achieve this affect, but Iam running into problems, I tried simplyfying the model by just using 2 quads on top of eachother, thinking that might help me solve the problem but Iam still getting the same issue, when I try to use masking My models show up like this.can anyone help me out? this is my render code Comments and all!!!.[Source="java"]    public void Render()    {   GL11.glPushMatrix(); GL11.glTranslatef(-50f, 0f, 50f);//   GL11.glRotatef(-90, 1,0,0);//   GL11.glScalef(.05f, .05f, .05f);   GL11.glEnable(GL11.GL_BLEND);   GL11.glDisable(GL11.GL_DEPTH_TEST);    GL11.glColor3f(1,1,1);   GL11.glBlendFunc(GL11.GL_DST_COLOR,GL11.GL_ZERO);   Texture.Apply(skin2);   GL11.glBegin(GL11.GL_QUADS);  GL11.glTexCoord2f(0, 0);  GL11.glVertex3f(  0f, 0f, 0f);  GL11.glTexCoord2f(1, 0);  GL11.glVertex3f(100f, 0f, 0f);  GL11.glTexCoord2f(1, 1);  GL11.glVertex3f(100f, 0f, -100f);  GL11.glTexCoord2f(0, 1);  GL11.glVertex3f(0f,   0f, -100f);   GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS);  GL11.glTexCoord2f(0, 0);  GL11.glVertex3f(25f, 0f, -25f);  GL11.glTexCoord2f(1, 0);  GL11.glVertex3f(75f, 0f, -25f);  GL11.glTexCoord2f(1, 1);  GL11.glVertex3f(75f, 0f, -75f);  GL11.glTexCoord2f(0, 1);  GL11.glVertex3f(25f,  0f, -75f);   GL11.glEnd();/*   GL11.glBegin(GL11.GL_TRIANGLES);   for(int i=0; i < header.TrisCount; i++)   {  GL11.glTexCoord2f(TexCoord[Tris[3]][0], 1-TexCoord[Tris[3]][1]);  GL11.glVertex3f(Vertices[indx][Tris[0]][0], Vertices[indx][Tris[0]][1], Vertices[indx][Tris[0]][2]);  GL11.glTexCoord2f(TexCoord[Tris[4]][0], 1-TexCoord[Tris[4]][1]);  GL11.glVertex3f(Vertices[indx][Tris[1]][0], Vertices[indx][Tris[1]][1], Vertices[indx][Tris[1]][2]);    GL11.glTexCoord2f(TexCoord[Tris[5]][0], 1-TexCoord[Tris[5]][1]);  GL11.glVertex3f(Vertices[0][Tris[2]][0], Vertices[indx][Tris[2]][1], Vertices[indx][Tris[2]][2]);   }   GL11.glEnd();*/   /*   GL11.glBegin(GL11.GL_TRIANGLES);   for(int i=0; i < header.TrisCount; i++)   {  GL11.glTexCoord2f(TexCoord[Tris[3]][0], 1-TexCoord[Tris[3]][1]);  GL11.glVertex3f(Vertices[indx][Tris[0]][0], Vertices[indx][Tris[0]][1], Vertices[indx][Tris[0]][2]);  GL11.glTexCoord2f(TexCoord[Tris[4]][0], 1-TexCoord[Tris[4]][1]);  GL11.glVertex3f(Vertices[indx][Tris[1]][0], Vertices[indx][Tris[1]][1], Vertices[indx][Tris[1]][2]);    GL11.glTexCoord2f(TexCoord[Tris[5]][0], 1-TexCoord[Tris[5]][1]);  GL11.glVertex3f(Vertices[0][Tris[2]][0], Vertices[indx][Tris[2]][1], Vertices[indx][Tris[2]][2]);   }   GL11.glEnd();*/   Texture.Apply(skin);   GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE);  GL11.glBegin(GL11.GL_QUADS);  GL11.glTexCoord2f(0, 0);  GL11.glVertex3f(  0f, 0f, 0f);  GL11.glTexCoord2f(1, 0);  GL11.glVertex3f(100f, 0f, 0f);  GL11.glTexCoord2f(1, 1);  GL11.glVertex3f(100f, 0f, -100f);  GL11.glTexCoord2f(0, 1);  GL11.glVertex3f(0f,   0f, -100f);   GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS);  GL11.glTexCoord2f(0, 0);  GL11.glVertex3f(25f, 0f, -25f);  GL11.glTexCoord2f(1, 0);  GL11.glVertex3f(75f, 0f, -25f);  GL11.glTexCoord2f(1, 1);  GL11.glVertex3f(75f, 0f, -75f);  GL11.glTexCoord2f(0, 1);  GL11.glVertex3f(25f,  0f, -75f);   GL11.glEnd(); GL11.glEnable(GL11.GL_DEPTH_TEST);   GL11.glDisable(GL11.GL_BLEND);  GL11.glPopMatrix();//   GL11.glFlush();    }[/Source]by the way iam using LWJGL + JavaThank you for your help   
  dont use maskingthe simplest way is to create an alpha channel in your leaf texture, alpha==0 for see through parts 1==elsewherethen enable alpha test with greater>0   ;  hmm ok could you show me how I would do it?   ;  To add an alpha channel to the texture, consult your art program's help file [grin]. For the other part:glAlphaFunc (GL_GREATER, 0.0f);glEnable (GL_ALPHA_TEST);;  alpha test will be nicer because you wont have to sort it, but the problem with what you were doing is this:   GL11.glBlendFunc(GL11.GL_DST_COLOR,GL11.GL_ZERO);that is wrong in your source code if your trying to blend it with the alpha channel.now i work with directX, but the problem is the sameyou should change it to something like this(do not copy this, look it up in some opengl manual and change it so its right)   GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_SRC_INVALPHA);it could be right though. well good luck[edit]um, this will only work if your leaf texture has an alpha layer that is white were the leaves should be and black where the leaves shouldn't be.Also, dont reset the glBlendFunc(), it will slow down your render time and it isnt needed with this setting[/edit][Edited by - Bliz23 on December 29, 2005 10:31:24 AM];  I guess writing sorting for true transparency would be fairly time consuming? Would it be expensive to render? I'm not sure how it works...   ;  Yes sorting is expensive, usually O(n log n).And I agree with the others, you don't really need masking. Using alpha channel instead. And you don't need to sort if you use alpha test. And alpha test would be sufficient in your case, unless you are using alpha channel to do something else.   