Jump to content
  • Advertisement


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

Mark Tanner

Alpha Blending in DirectX/D3D

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

Hi, I have two questions regarding alpha blending in Direct3D, can anyone help me with this? 1. I want to ''fade out'' a polygon using alpha. Rather than modifying the actual alpha values in the texture, which is very slow, is there a way I can do this nicely (maybe with renderstate settings?) 2. I am creating shadows for characters, this works fine but it would be nice to have alpha blended shadows so that the ground shows through. However, since these are real-time shadows (i.e. flattening the geometry into a plane) I get a LOT of back-to-front rendering artifacts when enabling alphablending because of back-to-front rendering polys on top of each other. Is there a correct way of doing this? Thanks for any help! Mark

Share this post

Link to post
Share on other sites
the way i do it is, i modify the material RGB values depending on the alpha value:

m_colRED * m_fAlpha,
m_colGREEN * m_fAlpha,
m_colBLUE * m_fAlpha,

where RED, GREEN, BLUE and m_fAlpha are in range 0<=x<=1, you get the idea...

(note: D3DRENDERSTATE_ALPHABLENDENABLE must be set to true using SetRenderState)

Share this post

Link to post
Share on other sites
This is regarding your second question. Look in the sdk for information about the zbias renderstate, that should help.

*** Triality ***

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!