Jump to content
  • Advertisement
Sign in to follow this  
xissburg

Texture blending...

This topic is 4818 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!