• Advertisement
Sign in to follow this  

Trying to blend IDirect3DSurface9

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

-- 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
Advertisement
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?

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
Sign in to follow this  

  • Advertisement