Trying to blend IDirect3DSurface9
-- 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]
Are you trying to render to this off screen surface? Can you explain a bit more about what effect you are trying to achieve? What are you trying to fade with what?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement