Skip to main content
gamedev.net
🔒 Locked

Texture Splatting

Started by Programmer101 Feb 28, 2007 at 8:32 PM 0 replies 300+ views
Original Post
Programmer101
Programmer101
I was reading the article on texture splatting and when I implemented it the fixed-function way, all I could see was my base texture. Here is my texture setup code:
g_pD3DDevice->SetTexture(0, groundTexture[0]);
	g_pD3DDevice->SetTexture(1, alphamap);
	g_pD3DDevice->SetTexture(2, groundTexture[1]);
	g_pD3DDevice->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
	// Alphamap: take the alpha from the alphamap, we don't care about the color
	g_pD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
	g_pD3DDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);

	// Texture: take the color from the texture, take the alpha from the previous stage
	g_pD3DDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
	g_pD3DDevice->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_TEXTURE);
	g_pD3DDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
	g_pD3DDevice->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_CURRENT);

	g_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	g_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	g_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
Does anyone know how to fix this?

Topic Locked

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

Sign in to reply to this topic.