[bb] Super fast full screen motion blur. by Proger [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:43

Previous topic - Next topic

BlitzBot

Title : Super fast full screen motion blur.
Author : Proger
Posted : 1+ years ago

Description : Demo with full source code:

<a href="http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no" target="_blank">http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no</a>


Code :
Code (blitzbasic) Select
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 :


Kornflex(Posted 1+ years ago)

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


BlitzSupport(Posted 1+ years ago)

 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.


Ziltch(Posted 1+ years ago)

 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 Krause(Posted 1+ years ago)

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


Dirk Krause(Posted 1+ years ago)

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


Damien Sturdy(Posted 1+ years ago)

 this is THE best function ive EVER come across for visual effects... just.... WOWive replaced my blur routines with it now! this drokin' rocks!!! :D


Jeremy Alessi(Posted 1+ years ago)

 Nicely optimized version of what I had before!


Proger(Posted 1+ years ago)

 I update link for this demo!<a href="http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no" target="_blank">http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=arkon200412082003152343&comments=no</a>


daaan(Posted 1+ years ago)

 Broken...


Naughty Alien(Posted 1+ years ago)

 ..dead link...


Boiled Sweets(Posted 1+ years ago)

 Could someone please post this again in the code archives?


John Blackledge(Posted 1+ years ago)

 Yes please. Post again. Dead link.


Mikele(Posted 1+ years ago)

 [DELETED]


Naughty Alien(Posted 1+ years ago)

 .thanks Mikele


John Blackledge(Posted 1+ years ago)

 Stunning!


Avrigus(Posted 1+ years ago)

 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?


VP(Posted 1+ years ago)

 Download re-hosted <a href="http://www.zen72251.zen.co.uk/files/blur.zip" target="_blank">here</a> 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 ;)


Mikele(Posted 1+ years ago)

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


Trader3564(Posted 1+ years ago)

 pff.. 3 dead links. any ideas?


WendellM(Posted 1+ years ago)

 I found a copy from a few years ago sitting in my Blitz folder:<a href="http://neonavis.com/blur.zip" target="_blank">http://neonavis.com/blur.zip</a>


Kryzon(Posted 1+ years ago)

 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. [/i]