Jump to content
  • Advertisement
Sign in to follow this  

Alphablending with floating point render targets

This topic is 4749 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

Hi, I was alpha blending a render surface with a texture so that the output would be one multiplied by the other. I have now changed the format from standard to floating point and the alphablending code no longer works. Can someone help me fix this as I'm not sure what to do. Thanks

		Device->SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, 0);//Use first(and only) UV
		Device->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);//Just take texture, we don't want lighting or anything.
		Device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
		Device->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
		Device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
		Device->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
		Device->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
		
		// blend as newcolor * previouscolor + previouscolor * 0
		Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
		Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_DESTCOLOR);
		Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_ZERO);
		Device->SetRenderState(D3DRS_BLENDOP, D3DBLENDOP_ADD);

		Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0);
		(*renderSurface[j])->BeginScene(*textureSurface[j], NULL);

		Device->SetStreamSource(0, texVQuad, 0, sizeof(TexVertex));
		Device->SetIndices(texIQuad);
		Device->SetFVF(TexVertex::FVF);
					
		Device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 4, 0, 2);	
		(*renderSurface[j])->EndScene(0);

Share this post


Link to post
Share on other sites
Advertisement
Most cards don't support alpha blending to fp render targets. Currently, only the GeForce 6600+ cards support blending to a16r16f16b16f fp format.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!