Old school screen fading routines

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.

thx
-furtoman

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.

DFrey, you sure know your stuff!

Now I feel I should have posted that one on the beginner’s page…

thanks for your time.

One big quad => increased fillrate. Maybe you could use glColorMask with values going from 0.0 to 1.0

Y.

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).]

Isn’t glColorMask parameters are GLboolean?
How could that be use to do a fading effect?

Gab

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?

lemino-

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;
}

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?

John

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.

A more realistic method could be to make all lights (including ambient) to fade to black…
Just an idea

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

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)

hrmm.

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

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 .
one think i noticed recently in the quake3 log was “ext_gamma_control 1” what extension is this its not in the sgi registry