fade image from & to black

Started by
16 comments, last by invictus 20 years, 1 month ago
Is there any built-in way to fade a image from black, wait a couple of seconds and fade to black again using directdraw?
Advertisement
No.



In fact, there are two ways of doing it, that I know of firsthandedly...

1. Use the Gamma Ramp controls, which I''ve seen somewhere in the tutorials here, if I remember correctly, or somewhere around the net...

Or

2. Code a custom function which locks input and destination surfaces and read every pixel and applies a percentage to each of its color components, then writes it back to the destination surface.

Correct me if I''m wrong anyone.
Yes there is but it lags quite alot.. and isnt really worth it when you can do the same effect in direct3d using the view matrix with almost no lag
You could just render a black, alpha-blended rectangle on top of everything. Just increase or decrease the alpha component of the color of the rect to make the final output more black or less black.

DevLiquidKnight: how can you use the view matrix in d3d?

[edited by - circlesoft on March 20, 2004 9:48:45 PM]
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Increase / Decrease lighting intensity...
Generally it''s done with a single alpha blended quad stretched over the screen. This also has the advantage of easily extending to screen flashes, screen blood flashes (a la Doom), blood pouring over your vision (again Doom), underwater, etc.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
quote:Original post by circlesoft
You could just render a black, alpha-blended rectangle on top of everything. Just increase or decrease the alpha component of the color of the rect to make the final output more black or less black.

DevLiquidKnight: how can you use the view matrix in d3d?

[edited by - circlesoft on March 20, 2004 9:48:45 PM]


Is this a good way of doing it? is it difficult? and how is the performance?
quote:Original post by Promit
Generally it''s done with a single alpha blended quad stretched over the screen. This also has the advantage of easily extending to screen flashes, screen blood flashes (a la Doom), blood pouring over your vision (again Doom), underwater, etc.


He is using DirectDraw, therefore this is not possible. The only way you are going to get acceptable performance in DirectDraw is to use the Gamma controls, or to ''dissolve'' the screen by adding a few new black pixels to the backbuffer each frame.
If anyone has the book Windows Game Programming for dummies I remember there was a fade to black function in there. If I find my copy I''ll be sure to paste the code.

~Wave
well if u use direct3d u just change the alpha value of the texture that is drawn to the view matrix but sense your not using direct3d u cant so yea... if you want to do 2d with direct3d look into direct3d sprites.

[edited by - DevLiquidKnight on March 21, 2004 11:41:19 PM]

This topic is closed to new replies.

Advertisement