   render problem in directx
  I want to render some trees, let say the simplest tree is two planes with diffuse and opacity map, so other parts of the scene can be seen through leafs. How can I assign opacity map texture to these two planes?   
  can someone help?   ;  You need to provide more information. What language? What DirectX version? What DirectX component are you using (I'm going to assume D3D)?The only answer I can give based on the information you've given is "Set the opacity map texture as a texture with SetTexture and set up the texture stage states or pixel shader to blend how you want".   ;  ok, I'm writing it in C# express 2005 using DirectX 10 August 2007 and XNA 2,I'm trying to find a shader or just learn how to create a shader which can hold an opacity map.   ;  With shaders you can get the opacity value from wherever you want.  You can pull it from the alpha channel of your diffuse map, you can pull it from a separate texture, you can pull it from vertices, or from a shader constant...With any of these techniques, you'll simply want to get the value and set it as the alpha component of your output.  So let's say you wanted to use a separate texture containing your opacity values, a simple pixel shader would go like this:sampler opacitySampler = sampler2D{    Texture = <opacityMap>;    MagFilter = LINEAR;    MinFilter = LINEAR;    MipFilter = LINEAR;}sampler diffuseSampler = sampler2D{    Texture = <diffuseMap>;    MagFilter = LINEAR;    MinFilter = LINEAR;    MipFilter = LINEAR;}struct PS_INPUT{    texCoord : TEXCOORD0;}struct PS_OUTPUT{    color : COLOR0;}void PixelShader ( in PS_INPUT IN, out PS_OUTPUT OUT ){    OUT.color.rgb = tex2D( diffuseSampler, IN.texCoord ).rgb;    OUT.color.a = tex2D( opacitySampler, IN.texCoord ).r;};  I entered this shader codetexture opacityMap : Opacity;texture diffuseMap : Diffuse;sampler opacitySampler = sampler_state{    Texture = <opacityMap>;    MagFilter = LINEAR;    MinFilter = LINEAR;    MipFilter = LINEAR; };sampler diffuseSampler = sampler_state{    Texture = <diffuseMap>;    MagFilter = LINEAR;    MinFilter = LINEAR;    MipFilter = LINEAR;};struct PS_INPUT{    float2 texCoord : TEXCOORD0;};struct PS_OUTPUT{    float4 color : COLOR0;};void pixShader ( in PS_INPUT IN, out PS_OUTPUT OUT ){    OUT.color.rgb = tex2D( diffuseSampler, IN.texCoord ).rgb;    OUT.color.a = tex2D( opacitySampler, IN.texCoord ).r;}technique SpecularPerPixel{pass P0{ alphaBlendEnable=true; cullmode=CW;PixelShader =compile ps_2_0 pixShader();} }but it only shows this:http://i30.tinypic.com/2i1ytd2.jpgwithout diffuse map or the real alpha values, it must omit the black part and shows the diffuse texture on the non black area.P.S:How can i wrap codes here or show the image instead of link   ;  You have forgotten to setup the correct alpha blending mode. SrcBlend =srcalpha;DestBlend =invsrcalpha;alphaBlendEnable=true;cullmode=CW;PixelShader =compile ps_2_0 pixShader();Best regards,Porthos   ;  Ahh thank you Porthos, I probably should have mentioned the alpha-blending states.Comboy - see the forum FAQ, it explains how to use tags for posting source code and images.   ;  thank you MJP and PorthosI can have it in fx composer, now i must learn to load th fx file it in xna. i'll manage to do it.some other required options in the shader are tiled textures for both alpha and diffuse.right now i'm looking inside some simple shader codes which is big help   