Thread: Directx weird alpha problems

  1. #1
    Registered User
    Join Date
    Aug 2004

    Directx weird alpha problems

    Well I have had this problem times before and still don't know how to fix this. My alpha render states are setup like this:

    device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
    device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
    device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
    device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
    There are two main problems in this the fallowing picture.

    1) The point sprites show a very obvius blue square on the person model
    2) The point sprites sometimes form blue squares on top of each other

    I can fix problem 1 by drawing the point sprites last but I can't always do that. The second problem I got no clue with.

    sorry for pic not being in this topic (couldn't get the attachment manager to work)

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    if you don't plan on drawing anything after these point sprites, don't have them write to the depth buffer. That way they'll Z test against everything else in the scene, but not themselves.

    Most systems draw anything with alpha blending last to avoid the artifact you're seeing.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Ok ya I didn't notice the zwriteenable, I just knew about the zenable. Everything for the most part works now, just gotta redo a few things to make them work. Thanks.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Also if you don't want to sort your billboards then you can do alpha testing. Most cards support this now and it's quite handy for simple objects.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problems with my DirectX program
    By fighter92 in forum Game Programming
    Replies: 1
    Last Post: 01-23-2007, 06:28 PM
  2. Rendering problems (DirectX?)
    By OnionKnight in forum Tech Board
    Replies: 0
    Last Post: 08-17-2006, 12:17 PM
  3. 2 questions in DirectX
    By X PaYnE X in forum Game Programming
    Replies: 4
    Last Post: 12-02-2004, 09:38 AM
  4. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-25-2004, 12:49 AM
  5. Alpha blending w/o color loss
    By VirtualAce in forum Game Programming
    Replies: 37
    Last Post: 10-27-2004, 12:58 AM