Jump to content
  • Advertisement
Sign in to follow this  
dingyi

help! DirectX9.0c point sprites problem

This topic is 4856 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to use DirectX to simulate a particle system by using DirectX point sprites.I open your Point Sprites code sample and change some code for testing. I want to actualize a point is very light when it was born and very dark when thepoint will dead, so I try to change the Alpha value(from 1.0f to 0.0f) of the point to actualize my effect.But I am failed,i got two same pictures when I do this. For Example: The point color D3DCOLOR_COLORVALUE( 1.0f , 0.8f , 0.5f , 1.0f) is same as color D3DCOLOR_COLORVALUE( 1.0f , 0.8f , 0.5f , 0.1f) in picture. why am I failed? Please help me to deal this problem.If you have other good idea, please tell me,thanks. my rend code is: g_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA ); g_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE ); g_pd3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_POINTSCALEENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE, FtoDW(1.0) ); g_pd3dDevice->SetRenderState( D3DRS_POINTSIZE_MIN, FtoDW(1.0f) ); g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_A, FtoDW(0.0f) ); g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_B, FtoDW(0.0f) ); g_pd3dDevice->SetRenderState( D3DRS_POINTSCALE_C, FtoDW(1.0f) ); Vertex *pPointVertices; g_pVertexBuffer->Lock( 0, MAX_PARTICLES * sizeof(Vertex), (void**)&pPointVertices, D3DLOCK_DISCARD ); g_pVertexBuffer->Unlock(); g_pd3dDevice->SetStreamSource( 0, g_pVertexBuffer, 0, sizeof(Vertex) ); g_pd3dDevice->SetFVF( Vertex::FVF_Flags ); g_pd3dDevice->DrawPrimitive( D3DPT_POINTLIST, 0, MAX_PARTICLES ); g_pd3dDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, FALSE ); g_pd3dDevice->SetRenderState( D3DRS_POINTSCALEENABLE, FALSE ); g_pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); g_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );

Share this post


Link to post
Share on other sites
Advertisement
The final color of the particle is a combination of the material color settings (the ones you mentioned) and the diffuse color specified by its texture. The alpha value is taken from the texture so it doesn't fade through the material. You can though fade by fading out the intensity of the color, using only RGB.

Greetz,

Illco

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!