Sign in to follow this  
fazerbox

How Add Edge Transparency to Texture?

Recommended Posts

Hi all,

I have a very simple question.

I have a Texture and I use ID3DXSprite.Draw() to draw it. I want apply transparency to texture but only at edge. I want to do that without changing source texture file, I mean I don't want modify texture including transparency edge. See image below.

In there a simple way to do that? How?

Is it possible use SetRenderState to do that, maybe using a second Texture Applied to first that has info about Edge Transparency?

Thanks in advance.
Max.

Share this post


Link to post
Share on other sites
[quote name='fazerbox' timestamp='1307359604' post='4820039']
Hi all,

I have a very simple question.

I have a Texture and I use ID3DXSprite.Draw() to draw it. I want apply transparency to texture but only at edge. I want to do that without changing source texture file, I mean I don't want modify texture including transparency edge. See image below.

In there a simple way to do that? How?

Is it possible use SetRenderState to do that, maybe using a second Texture Applied to first that has info about Edge Transparency?

Thanks in advance.
Max.
[/quote]


Transparency is a pain in the rear. You can get a somewhat type of transparency through Device>Renderstate SourceBlend and DesitnationBlend. Depending on what your looking to do, the rendering order (sorting back to front) will need to be taken into consideration.

if your just looking to render a texture that has part of the image cut out (no background) you can use SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE);

Just remember to turn it off when your not using it.

Hope this helps,

Dj

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