machosalad

Members
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

117 Neutral

About machosalad

  • Rank
    Newbie
  1. Need help making a billboard transparent

    I just got it to work. yay.   All i had to do was draw the rest of the scene before drawing the trees.
  2. Need help making a billboard transparent

    Sorry, i meant point sprites, i'm kind of new to directx.   I tried your example, it didn't work.   I can edit the texture by hand and simply give it an alpha channel, but since there is actually 180 of them, that would take too long time unless there is an automated batch file that does it for you. The reason there are so many textures of one single tree is that i am trying to do an experiment to make 2D trees look more realistic. I have made a texture sequence of a tree from 180 different angles. The tree switches between those textures when the angle between you and the tree changes.   The texture sequnce is directly exported from a 3D program called Terragen as a .bmp format. Those .bmp files had no alpha, so i tried improvising to make the textures transparent. So far i have failed.
  3. Need help making a billboard transparent

    The texture does not have an alpha channel. My goal is to make it transparent without editing the texture file by hand. I know this is possible because i have done it before on normal textured quads using colorkeys, but never on billboards before. Maybe colorkeys do not work on billboards?
  4. I am trying to draw a billboard with a tree texture. The texture has a black background with a tree in the middle. The problem is i can't seem to make it transparent. It always has this black box around it. I have tried to remove it using a colorkey by loading the texture like this: D3DXCreateTextureFromFileExA(D3D9_Device,FileName.str().c_str() , D3DX_DEFAULT,D3DX_DEFAULT,D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, D3DCOLOR_XRGB(0, 0, 0), 0, 0 ,&Oak);     here is the drawing code     //Draws tree billboard     D3D9_Device->SetVertexDeclaration(Billboard_Declaration);     D3D9_Device->SetRenderState(D3DRS_POINTSPRITEENABLE, TRUE );     D3D9_Device->SetRenderState(D3DRS_POINTSCALEENABLE, TRUE );     D3D9_Device->SetRenderState(D3DRS_POINTSIZE, FWORD(1.0f) );      D3D9_Device->SetRenderState(D3DRS_POINTSIZE_MIN, FWORD(0.0f) );     D3D9_Device->SetRenderState(D3DRS_POINTSCALE_A, FWORD(1.0f) );     D3D9_Device->SetRenderState(D3DRS_POINTSCALE_B, FWORD(1.0f) );     D3D9_Device->SetRenderState(D3DRS_POINTSCALE_C, FWORD(1.0f) ); /     D3D9_Device->SetRenderState(D3DRS_LIGHTING, FALSE );     D3D9_Device->SetRenderState(D3DRS_ALPHABLENDENABLE,true);     D3D9_Device->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);     D3D9_Device->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA);     D3D9_Device->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); Billboard_Vertex* V;     SAFE_RELEASE(VB_Oak);     D3D9_Device->CreateVertexBuffer(1*sizeof(Billboard_Vertex),Usage | D3DUSAGE_POINTS, 0, Pool, &VB_Oak, 0);     VB_Oak->Lock(0,1*sizeof(Billboard_Vertex),(void**) &V,0);     V[0].Position = D3DXVECTOR3(0,0,0);     V[0].Color = 0xFFFFFFFF;     VB_Oak->Unlock();     D3D9_Device->SetTexture(0,Oak);     D3D9_Device->SetStreamSource(0,VB_Oak,0,sizeof(Billboard_Vertex));     D3D9_Device->DrawPrimitive(D3DPT_POINTLIST,0,1);     And here are the declarations   struct Billboard_Vertex {     D3DXVECTOR3 Position;     D3DCOLOR    Color; }; LPDIRECT3DVERTEXDECLARATION9 Billboard_Declaration; D3DVERTEXELEMENT9 Billboard_Elements[] = { { 0, 0,  D3DDECLTYPE_FLOAT3,   D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION,  0 }, { 0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,     0 }, D3DDECL_END() }; IDirect3DTexture9* Oak; //oak tree texture LPDIRECT3DVERTEXBUFFER9 VB_Oak; //vertex buffer         I have been working on this problem for hours  . Any ideas on why its not working? Thanks.