Code archives/3D Graphics - Effects/Motion Blur

This code has been declared by its author to be Public Domain code.

Download source code

Motion Blur by daaan2005
This is a very small lib that with tweaking can do some really neat things. I have a demo that you can download which has complete source and a simple example.

http://www.hi-toro.com/blitz/MotionBlur.rar
http://www.hi-toro.com/blitz/MotionBlur.zip

Also, please vote for my gallery screenshot at

http://blitzbasic.com/gallery/view_pic.php?id=1193&gallery=&page=1
; l_surface by Daniel Wooden
; Created : 10/25/2005

Global l_surface = CreateSprite( camera )

SpriteViewMode l_surface, 2
PositionEntity l_surface, 0, 0, 0.00638
ScaleSprite l_surface, 0.0064, 0.0048
EntityAlpha l_surface, 0.5

Global l_texture = CreateTexture( 640, 480, 1+256 )
ScaleTexture l_texture, 1.598, 1.066
TextureBlend l_texture, 2

EntityTexture l_surface, l_texture

Function l_update()
	
	RenderWorld
	CopyRect 0, 0, 640, 480, 0, 0, BackBuffer(), TextureBuffer( l_texture )
	
End Function

Function l_setAlpha( a# )
	
	EntityAlpha l_surface, a#
	
End Function

Comments

Alienforce2005
Thanks, This was really good..


Barliesque2005
Excellent effect, very nicely presented. I'd already given the gallery image a 5/5. ...and thanks for the preview! :)


doctorskully2006
Cool effect!
I was experimenting a bit and got it to work with other width/height values than 640x480, and the sprite is now 1 unit away from the camera so you don't have to make the CameraRange near# value as small:



Global l_surface=CreateSprite(camera)
Global width=GraphicsWidth(),height=GraphicsHeight()

SpriteViewMode l_surface,2
PositionEntity l_surface,0,0,1
EntityOrder l_surface,-100
ScaleSprite l_surface, 1, 0.75

Global l_texture=CreateTexture(width,Height,1+256)
TextureBlend l_texture,2
ScaleTexture l_texture, (Float TextureWidth(l_texture)/Float width),(Float TextureHeight(l_texture)/Float Height)

EntityTexture l_surface,l_texture
EntityAlpha l_surface,.3

Function l_setAlpha(alpha#)

EntityAlpha l_surface,alpha#

End Function

Function l_update()

RenderWorld
CopyRect 0,0,width,Height,0,0,BackBuffer(),TextureBuffer(l_texture)

End Function


Realm Master2006
Simple, but effective, great job! The Screenshot it awesome!


Trader35642007
very awesome!


LamptonWorm2007
Cool :)

Has anyone tried adjusting this for multiple cameras by the way? e.g. 2 player split screen. Guess its a case of having x2 sprites one per cam etc.


n8r2k2007
um does anyone have the demo for this


Play2008
can someone refresh the link ?


Ked2009
Does anyone have the demo for this?


n8r2k2010
link?


Ked2010
...

Obviously, there is no and will never be a link.


daaan2011
Hey all!

I still have the code for this somewhere in my gmail account. if you would like, Send an email to dan.wooden@... and I will reply with the demo/code.


BlitzSupport2011
I just noticed I was hosting this at one point, but a lot of links died when I changed web host. I'd be happy to put it back on the original link if you want to email it to me, daaan.


daaan2011
Sent :D


BlitzSupport2011
Thanks, daaan -- both links at the top are now working again. It's a really cool effect too!


Code Archives Forum