Skip to main content
GameDev.net gamedev.net
🔒 Locked

Alpha Blend

Started by AmidaBucu Dec 1, 2008 at 7:55 AM 0 replies 600+ views
Original Post
AmidaBucu
AmidaBucu
Hi there! I want to try out the wolf's light pre pass rendering. And I don't know how to blend light datas into one texture. I did is so in my "engine":

	ClearTexture(c_RT3);
	SetRenderTarget(0, c_RT3);
	
	c_shaderStoreLight->SetTexture("lights", c_RT3);
	c_shaderStoreLight->SetTexture("normals", c_RT1);
	c_shaderStoreLight->SetTexture("depths", c_RT0);
	c_d3d->SetRenderState(D3DRS_ALPHABLENDENABLE, true);
	c_d3d->SetRenderState(D3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
	c_d3d->SetRenderState(D3DRS_DESTBLENDALPHA, D3DBLEND_ONE);
	for(int i = 0; i < c_light.Size(); i++)
	{
		c_d3d->BeginScene();
		c_shaderStoreLight->Begin(NULL, NULL);
		c_shaderStoreLight->SetVector("lightPos", (D3DXVECTOR4*)&c_light.c_pos);
		c_shaderStoreLight->SetVector("lightDiff", (D3DXVECTOR4*)&c_light.c_diff);
		c_shaderStoreLight->CommitChanges();
		c_shaderStoreLight->BeginPass(0);
		DrawScreenPlane();
		c_shaderStoreLight->EndPass();
		c_shaderStoreLight->End();
		c_d3d->EndScene();
	}




In that way I can't get the right result I want. Does Anyone know how to put the all of the lights into the light buffer? How to tell the shader not to overwrite, but blend the new color woth the old one? [Edited by - AmidaBucu on December 2, 2008 6:29:20 AM]
AmidaBucu
AmidaBucu
I just dunno, how to blend a texture and the result of a pixelshader

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.