Sign in to follow this  
ParanoiaComplex

Problem with particle system

Recommended Posts

My particle system As you can see, my particle system doesn't blend. Anyone help me out here? I've tried and pulled my hair out for a long time about this. Should I just go to pointsprites, or is refilling the vertex buffer too costly each time for a large particle system? Am I using the right particle sprite too? Rendering code
		// Enable alpha blending
		// Turn it on
		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_INVSRCALPHA); 

		g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); 
		g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); 
		g_pD3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); 
		g_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 ); 
		g_pD3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE ); 

		// Render all at once
		do
		{
			// Set the rectangle
			out.left = pCurrent->xPos;
			out.top = pCurrent->yPos;
			out.right = out.left + 32;
			out.bottom = out.top + 32;

			// Blt it using the global sprite engine
			test->BltSpriteEx(&out, NULL, NULL, D3DCOLOR_RGBA(255, 255, 255, 230), 0, NULL);
			pCurrent = pCurrent->pNext;

			count++;
		} while(pCurrent);

Share this post


Link to post
Share on other sites
Hey man, try this:

pDirect3D->GetDevice()->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
pDirect3D->GetDevice()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pDirect3D->GetDevice()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ONE);

Hope it helps.

~burst

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this