Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Texture Mask

This topic is 4816 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

Advertisement
Hi there EvilKnuckles666,
How are you doing buddy?

The Problem
Blending textures, such as a lightmap and a diffuse texture.

The Solution
Toymaker has an excellent article on texture stage states.

I think this is what you are looking for. He also has an example of using the texture stage states to do what you are looking for.

I hope this helps.
Take care buddy.

Share this post


Link to post
Share on other sites
thanks, i can use that for my other stuff i needed.
But i was talking about having a regular texture for a sprite, then applying a mask to it. The mask would be in greyscale; the closer to black the color is, the more opaque the end texture will have and the closer to white the color is, the more transparent the end texture will have.

Share this post


Link to post
Share on other sites
You really just want to look into using plain alpha channels encoded into your sprite image.

These can be created in almost any paint package.

You then simply set the texture stages to use the image information as the alpha source and your sprite will be more opaque the brighter your alpha channel is and more transparent the darker it is.

I can dig out the states for you if you need them but its pretty self-explanatory.

Share this post


Link to post
Share on other sites
If you make a .tga 32 bit image with an alpha channel, you can use the info in the alpha channel to generate the transparency. In the code, you'll just need these 3 RenderStates:


d3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
d3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
d3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);


Hope this helps....cya

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!