Sign in to follow this  
xissburg

Texture blending...

Recommended Posts

Hello...I've been trying to blend some textures but I'm having no success!!lol...So, I'm coming here to ask for your help...huh Well, this is what I wanna do: 1)I have this Tex1: 2),This Tex2: 3)and this Mask: 4)And I wanna blend them and get this result: How do I do it?!? One more!huh....this is about alpha blending: 1)I have this Tex1: 2)and this Mask: 3)and I wanna get this result: Resuming, I want that the black in the mask make the grass be trasparent and the white make the grass appears normally.How do I do it?!? obs.:these images were generated by 3dsmax... Thank you all very much much much :) [Edited by - xissburg on September 8, 2005 11:32:06 PM]

Share this post


Link to post
Share on other sites
hmm?!?Why my images doesn't appear?!?the tags are correctly set....wow...damn...please copy and paste the urls to your browser address...I'm really needing to know how to do that....

Thanks...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
For one texture only, you can create an image with 32 bits (TGA, DDS etc) in order to use the RGB channels (24 bits) for the colored image and the alpha channel (8 bits) for the alpha map. This task is made in an image editor, like PhotoShop. SDK DX also has a texture editor to create DDS images.

So, in the code, you must to set the following:

device->SetTextureStageState( 0 , D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
device->SetTextureStageState( 0 , D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );
device->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
device->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );

device->SetRenderState( D3DRS_ALPHABLENDENABLE, true);
// render the textured object...
device->SetRenderState( D3DRS_ALPHABLENDENABLE, false);


For multitexturing, you can use pixel shaders. Search for multitexturing tutorials.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this