News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

Scrolling Tile Fade

Started by kevin, February 10, 2008, 03:54:44 PM

Previous topic - Next topic

kevin

Scrolling Tile Fade

        This example creates simple fading (in/out) scrolling tile effect.   While the effect isn't particularly interesting, the approach is.   The code uses a  very common illusion from the old 8/16bit days of video games and demo's.   The latter in particular are full of such visual illusions, where what you think is happening, virtually never is!    

        In this example the fading creates the illusion to the viewer that the entire 'screen' is fading in/out.    While that is one (the most obvious) approach,  but often same effect can be achieved by fading the elements in the scene, rather than the entire scene itself.  (i.e. less pixels - less overhead = faster!)  

       So all this demo is doing, is loading the backdrop image as a tile.  This image is stored as an FX image (so it can read quickly - this is important as it need to be dynamically changed).   Then each redraw, we're using the BlitAlphaMultColour  function from the BlitImage library to copy this image from it's original state (the original image never changes) onto a identically sized image that's stored in video memory.     Once it's there, we can use the GPU to blit (tile) the chunks to the screen.  And hey presto the illusion is complete.


    Code attached.  (PlayBASIC V1.63 and above)