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

Mark Tanner

Alpha Blending in DirectX/D3D

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