Code archives/3D Graphics - Effects/Super fast full screen motion blur.

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

Download source code

Super fast full screen motion blur. by Proger2003
Demo with full source code:

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no
Global ark_blur_image, ark_blur_texture, ark_sw, ark_sh

Function CreateBlurImage()
	;Create blur camera
	Local cam = CreateCamera()
	CameraClsMode cam, 0, 0
	CameraRange cam, 0.1, 1.5
	MoveEntity cam, 0, 0, 10000

	ark_sw = GraphicsWidth()
	ark_sh = GraphicsHeight()
	
	
	;Create sprite
	Local spr = CreateMesh(cam)
	Local sf = CreateSurface(spr)
	AddVertex sf, -1, 1, 0, 0, 0
	AddVertex sf, 1, 1, 0, 1, 0
	AddVertex sf, -1, -1, 0, 0, 1
	AddVertex sf, 1, -1, 0, 1, 1
	AddTriangle sf, 0, 1, 2
	AddTriangle sf, 3, 2, 1
	EntityFX spr, 17
	ScaleEntity spr, 1024.0 / Float(ark_sw), 1024.0 / Float(ark_sw), 1
	PositionEntity spr, 0, 0, 1.0001
	EntityOrder spr, -100000
	EntityBlend spr, 1
	ark_blur_image = spr
	
	;Create blur texture
	ark_blur_texture = CreateTexture(1024, 1024, 256)
	EntityTexture spr, ark_blur_texture
End Function

Function UpdateBlur(power#)
	EntityAlpha ark_blur_image, power#
	CopyRect  ark_sw / 2 - 512, ark_sh / 2 - 512, 1024, 1024, 0, 0, BackBuffer(), TextureBuffer(ark_blur_texture)	
End Function

Comments

Kornflex2004
The link for DL the full demo it's down ?

Regards,


BlitzSupport2004
Now that we can post comments, I just want to say that this kicks ass -- and it's so easy to plug into existing code! Thanks Arkon.


Ziltch2004
Thanks for this blur code. It is great!

I found modifing these lines centred the blur and gave more options.

	PositionEntity spr, -0.0015, 0.0015, 1.0001; adjust Z plane for blur in/out. <1 = in, >1 = out
	EntityBlend    spr, 3

With the EntityBlend change you also need to have a lower UpdateBlur(power#) power# value, i.e. .49

Thanks again


Dirk Krause2004
Does anybody have the link to the full download? As Kornflex stated it is down.

Regards,
Dirk


Dirk Krause2004
Does anybody have the link to the full download? As Kornflex stated it is down.

Regards,
Dirk


Damien Sturdy2004
this is THE best function ive EVER come across for visual effects... just.... WOW

ive replaced my blur routines with it now! this drokin' rocks!!! :D


Jeremy Alessi2004
Nicely optimized version of what I had before!


Proger2004
I update link for this demo!

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no


daaan2005
Broken...


Naughty Alien2005
..dead link...


Boiled Sweets2005
Could someone please post this again in the code archives?


John Blackledge2005
Yes please. Post again. Dead link.


Mikele2005
[DELETED]


Naughty Alien2005
.thanks Mikele


John Blackledge2005
Stunning!


Avrigus2005
The pre compiled .exe works great but when I compile the code myself and ramp up the blur ammount the blur starts smearing diagonally down towards the right of the screen. Has anyone else encountered this?


VP2005
Download re-hosted here because it downloads very slowly from the link supplied by Mikele.

Sorry Mikele, but wherever it is you're hosting it doesn't seem to have a lot of bandwidth ;)


Mikele2005
Hmm... i don't know why... i have 120 KB/s from that server (maybe bandwith is limited outside my country).
Sorry :)


Trader35642007
pff.. 3 dead links. any ideas?


WendellM2007
I found a copy from a few years ago sitting in my Blitz folder:
http://neonavis.com/blur.zip


Kryzon2008
No offense, the effect does look nice. But it really isn't motion blur - you are using frames you already showed the user to mix up and get the result. That classifies this as Ghosting.

In order for it to be really motion blur, you'd have to render in-between frames with a certain tweening (meaning each subframe has a tween of 1/number of subframes), and then mix THAT up and show the user. That would be classified as the temporal-exposure that occurs with camera shutters, AKA motion-blur.


Code Archives Forum