• Advertisement

Archived

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

DirectX6 Fade Effect

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

Hi guys, I was hoping you could help me I wanted to implement a fade to black effect without using a palette. This is what I''m trying to do: 1) Draw everything to back buffer. 2) Lock the back buffer. 3) Go through all the pixels on the back buffer and bring each pixel closer to RGB (0, 0, 0) 4) repeat 3 until done 5) Unlock back buffer remember this is without palettes! Any code or advice would be helpful. Thank you very much! Jason Arora jason@pubism.com http://www.pubism.com

Share this post


Link to post
Share on other sites
Advertisement
Another way to do it is to draw a big transformed quad to the screen with the values r=g=b=0, a= fadevalue. Of course you have to do this with D3D to use transformed verts. Vert format is
  
#define SCREEN_VERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)

struct SCREEN_VERTEX
{
f32 x, y, z, rhw; // The transformed position for the vertex.

union // the vertex colour

{
struct{u32 ARGB;};
struct{u8 b,g,r,a;};
};
};


Set z to 1.0f an rhw to 0.5f or 1.0f.

Hope this gives you some ideas.

[The views stated herein do not necessarily represent the view of the company Eurocom ]

Eurocom Entertainment Software
www.Eurocom.co.uk

The Jackal

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
and you need help how? you got the algo down just implement it ya lazy bum. (btw local system memory surfaces are MUCH MUCH MUCH faster then using a video memory surface for this sort of thing) using the 3d method described is not advised unless you are doing 3d stuff already in which case using a black alpha blended quad as your last polygon drawn is advisible.

Share this post


Link to post
Share on other sites
I was actually hoping someone had already created this maybe...
I did write the code for it but I''m having so many problems.

I''ll paste the code if you want when I get home.
It''s basically something like this.

DDSURFACEDESC ddsd
back->lock ()
BYTE *dest = (BYTE*) ddsd.lpSurface

for (y = 0; y < ddsd.height; y++)
{
for (x = 0; x < ddsd.width; x++)
{

}
dest += ddsd.pitch
}

I''ve been trying all sorts of things...
What I need to do is compare the RGB component of each pixel to black, and make the changes accordingly to slowly fade it to black. But everything I try has failed.

Please help

Jason Arora
jason@pubism.com
http://www.pubism.com

Share this post


Link to post
Share on other sites

  • Advertisement