Texture stage terrain is this possible ?

Started by
2 comments, last by dansteph 22 years, 3 months ago
While my english suck somewhat I have great pain to understand the doc about texture stage blending. I tried the mfctex as well as searching on the netbut without success (I still understand nothing to texture stage ) In brief is this possible: Using two texture stage and the color vertex information to blend from one texture to another. Say V1 V2 = 0xFFnnnnnn and V3= 0x00nnnnnn or V1 V2 = oxFFFFFF and V3= 0x000000 If yes what are the texture stage parameter that I should use ? Many thanks for any hint. Dan Edited by - dansteph on January 12, 2002 6:13:49 PM
Advertisement
This work in mfcTex:

    	m_pd3dDevice->SetTexture( 0, m_pTerrainTextures[1] );	m_pd3dDevice->SetTexture( 1, m_pTerrainTextures[2] );	m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );	m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP,   D3DTOP_SELECTARG1 );	m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );	m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );	m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP,   D3DTOP_BLENDDIFFUSEALPHA );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP,   D3DTOP_MODULATE );	m_pd3dDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE | D3DTA_COMPLEMENT);    


By changing then the alpha component of the diffuse I get one or the other texture that appear.
At 50% both texture are blended together.

Howewer this don't work on my terrain I got only gray texture...
here my vertex format:
struct COLORVERTEX
{
D3DXVECTOR3 p;
D3DCOLOR color; /* Vertex color */
FLOAT tu, tv;
};


anyone ?

Help

Dan

Edited by - dansteph on January 12, 2002 10:51:03 PM
First you need to change:
struct COLORVERTEX
{
D3DXVECTOR3 p;
D3DCOLOR color; /* Vertex color */
FLOAT tu, tv;
};

to

struct COLORVERTEX
{
D3DXVECTOR3 p;
D3DCOLOR color; /* Vertex color */
FLOAT tu, tv;
FLOAT tu1, tv1;
};

and set up your FVF to have both TEX0 and TEX1.

Then set those texture stages up the way you have them in your code sniplet and it should work, though I did not look any deeper so I might have missed something.
"All programmers are playwrights and all computers are lousy actors." -Anon.
quote:Original post by BenHanson
First you need to change:
struct COLORVERTEX
{
D3DXVECTOR3 p;
D3DCOLOR color; /* Vertex color */
FLOAT tu, tv;
};

to.../snip/


Thanks for reply but no need to do this just two texture stage
and its done.

Damn I'm so happy all come well... here the first shot with only two texture. I will now add sand and mountain and plain and and ... :-)















Edited by - dansteph on January 13, 2002 2:33:45 AM

This topic is closed to new replies.

Advertisement