   Leaf alhpa test and white edge
  I use alpha test to render tree's leaf, setting as follows: AlphaTestEnable  = TRUE; AlphaRef   = 150; AlphaFunc   = GREATER; The alpha channel is black except leaf shape area is white. Why when viewpoint is far the leaf appear white? When the viewpoint is near to tree, the leaf appears right. The samping way of leaf texture is:sampler leafTexSamp = sampler_state{    Texture   = (leafTexture);    MinFilter = point;MagFilter = point;MipFilter = point;};I dont know how to post the image here.Thank you very much.   
  Sounds like your mipmapping is screwed up to me.Try turning it off completely to prove the point. There is a sample state you can use to set the max mips used - set it to zero. Or use tex2DLod() passing float4(0) for the extra argument.   ;  What do the RGB channels of your texture look like in the areas where the alpha is black? Are those areas white, or are they the same colour as the leaf?When authoring textures like this, the leaf's colour should always continue out past the edge of the alpha-mask at least one pixel without mipmapping, and multiple pixels if mipmapping is enabled.[Edit] I didn't notice you were using point filtering... It sounds like this isn't working though -- when you zoom in close on the leaf can you clearly see the square texels?   ;  How do you generate the mipmaps?Even though certain white (rgb = 255, alpha = 0) pixels are below any alpha threshold you set when point sampling they may still be used when you use a standard api bi-linear filtering tool to create mipmaps.Best to do some manual mipmap pre-processing on your textures. When 2x2 filtering a higher mipmaplevel only use rgb-data from pixels that have a non-zero alpha.[Edited by - eppo on May 10, 2010 5:52:06 AM];Quote:Original post by HodgmanWhat do the RGB channels of your texture look like in the areas where the alpha is black? Are those areas white, or are they the same colour as the leaf?In alpha channel, the leaf area is white and the left area is black. When zoom in, the white point around leaf edge is clear.If change filtering way to:MinFilter = linear; MagFilter = linear; MipFilter = linear;then whole leaf edge is white. What's wrong?When authoring textures like this, the leaf's colour should always continue out past the edge of the alpha-mask at least one pixel without mipmapping, and multiple pixels if mipmapping is enabled.quote]I cannt understand the mean of above.;Quote:Original post by eppoHow do you generate the mipmaps?Even though certain white (rgb = 255, alpha = 0) pixels are below any alpha threshold you set when point sampling they may still be used when you use a standard api bi-linear filtering tool to create mipmaps.Best to do some manual mipmap pre-processing on your textures. When 2x2 filtering a higher mipmaplevel only use rgb-data from pixels that have a non-zero alpha.I didn't use mipmaps. I use tex2D(leafTexSamp, i.tex) in pixel shader and the texture for leafTexSamp is created by:D3DXCreateTextureFromFile(pd3dDevice,L"leaf1.tga",&LeafTex);What should I do?;  D3DXCreateTextureFromFile() automatically generates mipmaps for you.One thing you can try quickly is to set the color of all transparent pixels to roughly the same color as the leaf.   ;Quote:Original post by eppoOne thing you can try quickly is to set the color of all transparent pixels to roughly the same color as the leaf.Sound like a good idea, I have a try at once.