Archived

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

Fade Effect

This topic is 6023 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! iam a newbie and i need a fade out effect for my game! iam programming in 800x600x16! how can i make the whole screen fade to any color i like? please help me... woodruff

Share this post


Link to post
Share on other sites
The fasted way would be to obtain a pointer to the video memory (locking the surface if you use DX) and then use raw assembly language to fade the screen. Otherwise there are a lot of other, slower ways... :|

Share this post


Link to post
Share on other sites
If your card supports gamma (controls//ramps...How the hells is that called?) you have a tutorial here in GameDev about it.

if using d3d:
You can alpha-blend a quad on the screen, interpolating its color towards black(the fades color).

What the hells!

Share this post


Link to post
Share on other sites
You can view a color as a point in color space, i.e. rgb instead of xyz. So basically fading is just calculating intermediate points on the line segment joining the original color to the target color. So for each pixel you have to subtract the current color from the target color. That gives you an RGB delta. You then have to decide how many steps you want to take. That delta times the step number you are on divided by the number of steps is how much you add to the original color.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I would recommend the gamma control way, it''s the fastest you''ll find. You can only fade to black or white though.
Second fast is the blending of a quad, you have to be carefull choosing your blending factors (in an exponential way), since the blends are cumulative. But you can fade to any colour you want, and it''s still very fast.
The slowest way is the one Zipster described, I would not recommend it. Huge ammounts of data would have to be transfered over the PCI/AGP bus, and that''s awfully slow. It''s a waste of resources to do something in software, that is supported it in hardware on your 3D card.

-JL

Share this post


Link to post
Share on other sites
As was said before, Just draw a big Quad on the screen, with using the color you want to fade to as the background color, and over time, increase the alpha component of the color (so that more of the quad shows, and less of the scene). This is the easiest, by far.

Z.

Share this post


Link to post
Share on other sites