Sign in to follow this  

Texture blending...

This topic is 4481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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

This topic is 4481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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