Alphablending with floating point render targets

Started by
0 comments, last by SimmerD 18 years, 11 months ago
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);

Advertisement
Most cards don't support alpha blending to fp render targets. Currently, only the GeForce 6600+ cards support blending to a16r16f16b16f fp format.

This topic is closed to new replies.

Advertisement