View Full Version : Old school screen fading routines

10-22-2000, 09:30 AM
Salutations, ladies and gents

Anyone remember the old-school 8-bit fading routines? (like in doom and prince of persia)

anyone have efficient (heck, even working) routines for this effect?

I figured maybe using the rgb bias or somesuch, but i'm not sure it would work.

For static scenes, alpha blending works by just rendering the scene and using the completed render as a bitmap and sweeping alpha from 0 to 1 on a black background, but there has to be some way to implement it on a dynamic 3d scene.

any help would be nice, no code though,just concepts. I don't wanna spunge anyone else's code.


10-22-2000, 09:46 AM
This is exceptionally easy to do. Just draw a black alpha blended quad over the entire screen each frame, and increase the alpha with time.

10-22-2000, 10:14 AM
DFrey, you sure know your stuff!

Now I feel I should have posted that one on the beginner's page...

thanks for your time.

10-22-2000, 02:32 PM
One big quad => increased fillrate. Maybe you could use glColorMask with values going from 0.0 to 1.0


10-22-2000, 03:00 PM
During a fade out , is maximum framerate really important? I don't think so. But as far as that goes, you'd could also twiddle the hardware gamma ramps to do a fade.

[This message has been edited by DFrey (edited 10-22-2000).]

10-22-2000, 05:30 PM
Isn't glColorMask parameters are GLboolean?
How could that be use to do a fading effect?


10-22-2000, 07:01 PM
You're right, gabriel...

the gamma ramps.. are they only accessible through the extentions?

anyone have good sites about accessing the extenstions?

you have to use func. ptrs w/ the dll's, huh?


10-22-2000, 10:52 PM
int SetGamma(float gammacorrection)

for (int i = 0; i < 3; i++)
int min = 256 * i;
int max = min + 256;
for (int j = min; j < max; j++)
NewRamp[j] = pow(((j % 256) / 256.0), 1/gammacorrection) * 65536;
SetDeviceGammaRamp(WinData.hDC, NewRamp);

return 1;

10-23-2000, 05:19 AM
And now without any windows specific code?
And isn't it true that this gamma stuff is only available on newer card, i.e. since TNT1 card or something?


10-23-2000, 06:32 AM
Hmm, I have no idea how to adjust the gamma ramps on anything other than Windows. And yes, only relatively modern cards may likely support gamma ramps. Also, for obvious reasons, I wouldn't want to do this if the app was windowed. The easiest cross platform method of fading is simply drawing the viewport covering quad with time varying alpha.

10-23-2000, 06:34 AM
A more realistic method could be to make all lights (including ambient) to fade to black...
Just an idea http://www.opengl.org/discussion_boards/ubb/biggrin.gif

[This message has been edited by paddy (edited 10-23-2000).]

10-26-2000, 09:42 AM
anyone have any ideas if the bias functions would have any effect?

are they only good for the actual pixel transfers, like they wouldn't affect the rendering other than when the texture is applied in the beginning (i.e. won'd even touch the un-textured polys)


yeoup, btw, the black quad works good, thx!

10-26-2000, 11:36 AM
i do what DFrey saiz a big polygon across the screen and adjust the alpha component which is acceptable even in 16bit colour.
about the gamma, on me win2000
SetDeviceGammaRamp(..) seems to work randomly ie about 20% of the time, i havent been able to figure this one out though i cant say ive tried to hard http://www.opengl.org/discussion_boards/ubb/smile.gif.
one think i noticed recently in the quake3 log was "ext_gamma_control 1" what extension is this its not in the sgi registry