d->SetTexture(0, m_tex);
d->SetTexture(1, m_detailTex1);
d->SetTexture(2, m_alpha1);
d->SetTexture(3, m_detailTex2);
d->SetTexture(4, m_alpha2);
d->SetSamplerState(1, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP);
d->SetSamplerState(1, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP);
d->SetSamplerState(1, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(1, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(1, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(2, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(2, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(2, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(3, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(3, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(3, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(4, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(4, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
d->SetSamplerState(4, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
//base pic
d->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
d->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_TEMP);
// detail pic1
d->SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_TEXTURE);
d->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
// first alpha
d->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_BLENDTEXTUREALPHA);
d->SetTextureStageState(2, D3DTSS_COLORARG1, D3DTA_CURRENT);
d->SetTextureStageState(2, D3DTSS_COLORARG2, D3DTA_TEMP);
d->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
d->SetTextureStageState(2, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
I set multitexturing for terrain.
and finish do terrain rendering.I do
d->SetTexture(0, 0);
d->SetTexture(1, 0);
d->SetTexture(2, 0);
d->SetTexture(4, 0);
d->SetTexture(3, 0);
d->SetTextureStageState(0, D3DTSS_RESULTARG, D3DTA_CURRENT);
d->SetTextureStageState(4, D3DTSS_COLOROP, D3DTOP_DISABLE);
d->SetTextureStageState(4, D3DTSS_COLORARG1, 0);
d->SetTextureStageState(4, D3DTSS_COLORARG2, 0);
d->SetTextureStageState(4, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
d->SetTextureStageState(4, D3DTSS_ALPHAARG1, 0);
d->SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
d->SetTextureStageState(1, D3DTSS_COLORARG1, 0);
d->SetTextureStageState(1, D3DTSS_COLORARG2, 0);
d->SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
d->SetTextureStageState(1, D3DTSS_ALPHAARG1, 0);
d->SetTextureStageState(2, D3DTSS_COLOROP, D3DTOP_DISABLE);
d->SetTextureStageState(2, D3DTSS_COLORARG1, 0);
d->SetTextureStageState(2, D3DTSS_COLORARG2, 0);
d->SetTextureStageState(2, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
d->SetTextureStageState(2, D3DTSS_ALPHAARG1, 0);
d->SetTextureStageState(3, D3DTSS_COLOROP, D3DTOP_DISABLE);
d->SetTextureStageState(3, D3DTSS_COLORARG1, 0);
d->SetTextureStageState(3, D3DTSS_COLORARG2, 0);
d->SetTextureStageState(3, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
d->SetTextureStageState(3, D3DTSS_ALPHAARG1, 0);
but the render state of terain still influence other rendering, make the curious happen. for example, the light is available to some entity,but disable to else entity
but I do not set render state of terrain. all is ok.
how to do?