# How to set a global alpha-blending value in Direct3D 9?

Is it possible to set an alpha value globally in Direct3D 9, which modulates the pixel alpha values of every subsequent draw?

I would like to let a whole scene fade in/out. I know that for example ID3DXSprite::Draw() lets you set this in the Color parameter, but I'm using pixel shaders to draw 2D circles and rectangles as well, so I would have to pass the alpha value to each of them.

With shaders and ordinary alpha blending I don't think this is possible. If you wanted to replace all the alpha values in the scene by a global constant, you could use D3DBLEND_BLENDFACTOR and D3DBLEND_INVBLENDFACTOR. But it sounds to me like you want to multiply each pixel's alpha value by a global constant. This is best done in the pixel shader.