News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Motion Blur

Started by ninjarat001, June 26, 2006, 11:40:40 PM

Previous topic - Next topic

ninjarat001


Question:  How do you do motion blur, like in that Axis game that comes with the package?  Something to do with BlitImages as far as I can see... how does it work?

- ninjarat001 B)

kevin

Yes, the blurring effect is made by performing a constant colour subtraction from each pixel on the screen.    So the whole image slowly fades out over time. The more you subtract the quicker the fade will be.   For rendering we don't clear the screen image, instead we just draw everything with alpha addition to the screen.   Which creates the morphing/messy effect.

 PB has built in command called Blit Image which is general purpose transfer command.  Lots of parameters, the easier option is to used included Slib.  Use the  #Include operator to include the Blitimage library  (ie #include "Blitmage") and use the functions that it provides.  Less parameters, easier to to see what they do.

 You can find the BlitIMage library in the PlayBasic/Slibs folder. Here's the functions it icnludes.



BlitImageClear(SrcImage,X,y,ClearColour)


; =====================
; ALPHA 50/50 modes
; =====================

BlitImageAlpha50Image(SrcImage,x,y,BlendImage)


; =====================
; ALPHA MULT modes
; =====================

BlitImageAlphaMultImage(SrcImage,X,y,BlendImage)



; =====================
; ALPHA ADD modes
; =====================


BlitImageAlphaAddImage(SrcImage,X,y,BlendImage)
BlitImageAlphaAddColour(SrcImage,X,y,AddColour)


; =====================
; ALPHA SUB modes
; =====================

BlitImageAlphaSubImage(SrcImage,X,y,BlendImage)

BlitImageAlphaSubColour(SrcImage,X,y,SubColour)