Jump to content
  • Advertisement
Sign in to follow this  
ZeroEffect

Material Alpha not working?

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

Currently I am trying to create a semi-transparent object using only a D3DMATERIAL. I've given the material an alpha value (for all components although diffuse color should suffice). Following the code in the SDK I am unable to get the object to be anything but opaque (although the color is correct). I would expect it to blend with the background color. Below is the SDK code. Are there any other render states that need to be enabled/disabled for this to work? from the SDK (Material Alpha):
// use material diffuse color component
m_pd3dDevice->SetRenderState( D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL );

...

// Initialize the material with an alpha value, and set the material before drawing.
D3DMATERIAL9 mtrl;
mtrl.Diffuse = mtrl.Ambient = mtrl.Specular = mtrl.Emissive = 
    D3DCOLORVALUE(255,0,0,0.5f)

m_pd3dDevice->SetMaterial(&mtrl);

Thanks, Chris Z.

Share this post


Link to post
Share on other sites
Advertisement
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!