Fade Effect
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
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... :|
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!
if using d3d:
You can alpha-blend a quad on the screen, interpolating its color towards black(the fades color).
What the hells!
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.
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
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
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.
Z.
Dunno about you lot, but I was able to fade to any RGB colour using the DX gamma controls.
It was on a TNT2.
Waassaap!!
It was on a TNT2.
Waassaap!!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement