Original Post
I have read the article about texture splatting at gamedev (http://www.gamedev.net/reference/articles/article2238.asp) i have one question for this one my concern is on the function void RenderWithoutShader(); heres the body: what thus this mean? Its in the code that the function DrawPrimitiveUP was called 4 times to get the effect( for the 4 textures and 4 alphamaps). Now if im going to use this in a terrain lets say for example Geomipmapping terrain does it mean im going to call my render function for the entire terrain for N times(costly!) depending on the number of my texture and alpha map? Or im misssing something here? pls englighten me thanks [Edited by - yuppies on August 29, 2005 3:16:05 AM]
void RenderWithoutShader() {
// Alphamap: take the alpha from the alphamap, we don't care about the color
g_Direct3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
g_Direct3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
// Texture: take the color from the texture, take the alpha from the previous stage
g_Direct3DDevice->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
g_Direct3DDevice->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
g_Direct3DDevice->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
g_Direct3DDevice->SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CURRENT);
// Disable textures from the pixel shader mode
g_Direct3DDevice->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE);
g_Direct3DDevice->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
// Disable the pixel shader
g_Direct3DDevice->SetPixelShader(NULL);
g_Direct3DDevice->SetTexture(0, g_Alphamap1);
g_Direct3DDevice->SetTexture(1, g_Texture1);
g_Direct3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertices, sizeof(QuadVertex));
g_Direct3DDevice->SetTexture(0, g_Alphamap2);
g_Direct3DDevice->SetTexture(1, g_Texture2);
g_Direct3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertices, sizeof(QuadVertex));
g_Direct3DDevice->SetTexture(0, g_Alphamap3);
g_Direct3DDevice->SetTexture(1, g_Texture3);
g_Direct3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertices, sizeof(QuadVertex));
g_Direct3DDevice->SetTexture(0, g_Alphamap4);
g_Direct3DDevice->SetTexture(1, g_Texture4);
g_Direct3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, g_Vertices, sizeof(QuadVertex));
}