Archived

This topic is now archived and is closed to further replies.

kmsixpence

Multitexturing

Recommended Posts

Well, as most people do, I''m developing a terrain engine with DirectX 8. I''m trying to multitexture a surface, ex when the rocks mix with the grass. The SDK documentation was no help when it came to this. I fooled around with it and no luck. I couldn''t get neither the multipass nor the hardware multitexturing to work. If anyone is wondering, I already read the DX7 Framework Article on multitexturing. The dark mapping worked but that''s not what I want and plus, I can''t understand a word of it. The flipcode article didn''t cover how to do it in D3D, just the theory. If someone could please guide me on the right track on multitexturing with maybe a few hints on the texture stages and stuff. Thanks

Share this post


Link to post
Share on other sites
Please? Anyone? People who developed terrain engines with DX and with multitexturing, what tex stage states and loading did you do. The sdk is no help to me, they only talk in MICROsoft langage. Notice the MICRO because they never bother to describe what they do so their talk is MICRO. Sorry, I have a terrible humor.

Share this post


Link to post
Share on other sites
Here's what states i use for my DX8 terrain multitexturing engine. (not working all the way yet, but should be soon)

Note: I had a hard time getting this to work in the beginning because i wasn't using a texture with an alpha channel.

D3DDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
D3DDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG2 );
D3DDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );

D3DDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG2 );
D3DDevice->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );
D3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
D3DDevice->SetTextureStageState( 1, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );

D3DDevice->SetTextureStageState( 2, D3DTSS_COLOROP, D3DTOP_DISABLE );
D3DDevice->SetTextureStageState( 2, D3DTSS_ALPHAOP, D3DTOP_DISABLE );

D3DDevice->SetTexture( 0, TextureMap);
D3DDevice->SetTexture( 1, AlphaMap); // This texture needs an alpha channel

Actually, I didn't test this with DX8 and was using DX7 before.
Hope this is what you are looking for and everything works.
My E-Mail is RobotBuilder@charter.net, so you can e-mail me if you need to.

Edited by - Miyamoto on December 31, 2001 6:16:54 PM

Share this post


Link to post
Share on other sites
Thanks Miyamoto. That was exactly what I was looking for. I had code somewhat like that. Also, thanks for the alpha texture tip. I had no idea about that. If I remember, I''ll send you some of the source when I get more of the engine going. Thanks alot!

Share this post


Link to post
Share on other sites
Is that with the DX Texture Tool? I got a plain black alpha channel with my regular bitmap in the tool and loaded it up. The problem is that the regular texture should be darker than usual because of the blend, right? It doesn''t change at all. I tried those parameters but am I even doing the right thing?

Share this post


Link to post
Share on other sites