Archived

This topic is now archived and is closed to further replies.

New2DX

Questions about alphablending refering to Jim's RPG book

Recommended Posts

Hi i am going through chapt 6 particle and i have a few question i hope someone will answer me thanks. 1stly, why when i disable alphablending and remove setmaterial all the app shows are black rectangles moving around..y isn't it the texture that is shown ? the texture is a black background with a circular gradient white circle at the center.. 2nd ) can someone pls explain to me the reason this two blending mode is being used to achieve the effect..: g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE); from what i understand the material is the provide the color..how does these two mode works ? where is the alpha info of the texture ? in the texture ? 3) why do i have to set ambience to highest to see all the particles thanks [edited by - new2dx on December 23, 2002 10:16:20 AM]

Share this post


Link to post
Share on other sites
You might want to disable lighting before rendering your particles. Also, you can mix alpha blending modes. Another popular set of blending flags is:

pDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCCOLOR);
pDevice->SetRenderState(D3DTS_DESTBLEND, D3DBLEND_DESTCOLOR);

The SetMaterial call changes the color when using lighting.

[500x1]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hi thanks alot for your reply.. i don''t understand why the black is rendered transparent for the texture..is it cause by the two renderstate ? how ? sorry ..thanks alot for reply..

Share this post


Link to post
Share on other sites
does not directx use 50-50 alpha if no alpha is specified when blending with those states enabled? i didnt think you needed to specify alpha info when doing simple blends :S

Share this post


Link to post
Share on other sites
You should never really assume a default, as render states can change radically during execution. A driver may decide to use a render state that a background task is using at the same time as yours, or the driver can change render states to something it considers default...

[500x2]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Qatal
does not directx use 50-50 alpha if no alpha is specified when blending with those states enabled? i didnt think you needed to specify alpha info when doing simple blends :S


thanks..sorry but i still don''t understand y the black is transparent in the particle sample..

g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
<- whats the source alpha ?

g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

Share this post


Link to post
Share on other sites