Rene Dudfield wrote:
> Hello.
>
> I was wondering if anyone had an idea on how to do fade to black?
>
> I was thinking of overlaying a texture over the scene and slowly
> changing the alpha this texture has.
This should work on anything from a TNT2 onward, though you don't
actually need it to be a texture unless you are interested in having the
fade be textured (e.g. having the game logo fade in on a
black/white/whatever background). A simple polygon with the required
color and alpha should work.
> But would that work ok on slower hardware? If it is slow any other
> ways to do fade to black(or from black, or to/from white etc)?
I would strongly suggest just implementing it first and seeing if it
really is slow, I wouldn't expect it to be too slow if your game is
running reasonably well before the fade starts, yes there will be a lot
of overdraw, but you can disable depth buffer updates, so only
one/(three) buffers are getting changed. Possible optimization strategies:
* use overlays where available
o i.e. render your transparency as an overlay rather than part
of your main scene
o if not, do a screen-capture to a bitmap and just blit the
bitmap, then the fading polygon each time you want to
increase the fading level, you may find that using the
captured bitmap as a texture works considerably faster
* use screendoor transparency
o only likely to be useful on very old hardware, (e.g. TNT or
previous)
* use solid-color polygon instead of textured (likely only an issue
if the texture is very large)
* do a screen capture, turn it to a texture and blend it *on top
of* a solid-color background of the target color (i.e. glClear)
each frame with altered alpha level, opaque at start, transparent
to end (saves extra geometry/overdraw).
Have fun,
Mike
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
|