Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.



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

I have made a couple of really cool 3d demos in Direct3D and I want to add transperincy to them. How to I do this? For example How would make a bitmap transparent? Thanks in advance.

Share this post

Link to post
Share on other sites
Firstly, you''ll need to enable alpha blending ("device" is your LPDIRECT3DDEVICE8):

device->SetRenderState(D3DRS_ALPHABLENDENABLE, true);

That turns alpha blending on. Then set up your blend states:


this tells Direct3D how the alpha values are combined into the final rendered pixel. If you want to know more specificly how this works, read the DirectX 8 SDK, but the above values are the most commonly used.

The transparency is then defined as the alpha value of the diffuse color at any given pixel. This could be the alpha component of the diffuse color of your current material(if you''re using materials) or the alpha component of the diffuse color defined at each vertex(if you''re using color values hard-coded in your FVF). 0 is invisible, 1 is completely solid, and anything in between is various levels of translucency.

If you want to do anything fancier (like using the alpha channel of a texture surface to do per-pixel translucency) you''ll have to set some more states, but that should get you started... I think. it''s been a while since I''ve actually done this myself. if it doesn''t work, read the SDK. if it does work, read the SDK anyways. Never hurts to know exactly what''s going on! :-)

Share this post

Link to post
Share on other sites
Once you figure out the alpha blending write a tut on how you did it and submit it to NeXe I am interested in alpha blending and a tutorial on it would really help me out for when I get around to messing around with it.

Eric Wright o0Programmer0o
AcidRain Productions

Share this post

Link to post
Share on other sites

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