Directx weird alpha problems

This is a discussion on Directx weird alpha problems within the Game Programming forums, part of the General Programming Boards category; Well I have had this problem times before and still don't know how to fix this. My alpha render states ...

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    731

    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:

    Code:
    device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
    device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
    device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
    
    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)
    http://runehunter.byethost9.com/Alpha.png

  2. #2
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    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
    Posts
    731
    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
    Posts
    9,596
    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, 05: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, 08:38 AM
  4. DirectX - Starting Guide?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-24-2004, 11:49 PM
  5. Alpha blending w/o color loss
    By VirtualAce in forum Game Programming
    Replies: 37
    Last Post: 10-27-2004, 12:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21