Original Post
Ok, I don't even know if this is possible to do efficiently (but to be honest it doesn't really matter).
I have these three tiles:
(If the image is broken, #1 is a mask (magenta & black), and #2 & #3 are normal textures [grass & sand]).
I'd really like to be able to blend the second and third textures using the first as a mask of some sort, but i really don't know how to go about it.
At the moment is have this:
(Ignore the window title - its a work in progress
)
But i don't know what to do next...
Someone suggested something to do with the stencil buffer that sounds over-complicated to me. Is this the only way to do it?
How do terrain engines do this? Terrain engines blend 2 textures into one another (e.g. grass & rock), which is what i'm doing - except with only 1 bit of alpha (effectively 0.0 or 1.0)
Any suggestions?
Cheers,
Steve
[edited by - Evil Steve on August 12, 2003 8:07:55 AM]
(If the image is broken, #1 is a mask (magenta & black), and #2 & #3 are normal textures [grass & sand]).
I'd really like to be able to blend the second and third textures using the first as a mask of some sort, but i really don't know how to go about it.
At the moment is have this:
m_pDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE); m_pDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); m_pDevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_CURRENT); m_pDevice->SetTextureStageState(1,D3DTSS_ALPHAOP,D3DTOP_MODULATE); m_pDevice->SetTextureStageState(1,D3DTSS_ALPHAARG1,D3DTA_TEXTURE); m_pDevice->SetTextureStageState(1,D3DTSS_ALPHAARG2,D3DTA_CURRENT); m_pDevice->SetTextureStageState(1,D3DTSS_COLOROP,D3DTOP_ADD); m_pDevice->SetTextureStageState(1,D3DTSS_COLORARG1,D3DTA_TEXTURE); m_pDevice->SetTextureStageState(1,D3DTSS_COLORARG2,D3DTA_CURRENT);Which produces an image like this:
(Ignore the window title - its a work in progress
