Sign in to follow this  
Daryl01

Trying to blend IDirect3DSurface9

Recommended Posts

-- Edit: --------------------------------------------- Hey, I'm trying to blend a surface with the back buffer (which already has my game entities like sprites and background scenery), to create a fading in/out effect. ------------------------------------------------------ I created the surface using IDirect3DDevice9->CreateOffscreenPlainSurface(...) and I sent D3DFMT_A8R8G8B8 as argument to D3DFORMAT parameter. -- Edit: --------------------------------------------- I filled the surface with black color by calling IDirect3DDevice->ColorFill (...). When a new game begins the player will see the scene all black (the surface), then the surface's alpha will be gradually decreased (the fading effect), slowly revealing the game world. ------------------------------------------------------ I've tried a lot of different combinations with the D3DRS_SRCBLEND and D3DRS_DESTBLEND using the direct3d device's SetRenderState() function but no luck. Can it be done? ..How can I do this? I enabled the back buffer, depth buffer & stencil buffer. Maybe that info. will help. Thanks [Edited by - Daryl01 on March 6, 2010 3:23:32 PM]

Share this post


Link to post
Share on other sites
If it were me, i'd write a simple shader that outputs black and substitutes in a shader constant as the alpha channel. I'd be setting the constant from the application using ID3DXEffect::SetFloat() based on time progressing the value towards 0.

Share this post


Link to post
Share on other sites
Ok. I havn't learnt or began using shaders yet, but I understand. I'm reading the book 'Introductoin to 3D Game Programing...' by Frank Lua, when I get to part iv- shaders and effects I will implement your suggestion. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this