Experiment: Motion Blur with Physics

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ishkabible
Party member
Posts: 241
Joined: Sat Oct 23, 2010 7:34 pm
Location: Kansas USA

Re: Experiment: Motion Blur with Physics

Post by ishkabible » Wed Jul 18, 2012 5:17 pm

I'm getting 450 frames per second on this with standard settings. if change it to 50 frames and 10 alpha multiplier, I get 350 frames per second.

O, and I have a slight suggestion for look improvement when you getting it working with fewer frames; have the blurred objects have an alpha gradient in the direction the object is moving so that when blur ends, it blends seamlessly into the next blur. that way it doesn't look anywhere near as choppy.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Experiment: Motion Blur with Physics

Post by BlackBulletIV » Thu Jul 19, 2012 12:00 am

I've no idea what's going on then.

The problem is, each object is moving a different way between frames. The only ways I can think of accomplishing that couldn't justify the performance drop. Besides that, I wouldn't even know how to generate an alpha gradient.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Experiment: Motion Blur with Physics

Post by BlackBulletIV » Sun Aug 05, 2012 7:12 am

I've worked out what the problem is. If you have V-Sync turned off, the frames per second will generally be much higher than 60. Since the effect relies on the difference between frames, how much blur you see is dependent on the frame rate. If the number of motion blur frames stays the same, you'll see less motion blur as the frame rate goes up. The only clean way that I know of to fix this is V-Sync.

User avatar
Larsii30
Party member
Posts: 267
Joined: Sun Sep 11, 2011 9:36 am
Location: Germany

Re: Experiment: Motion Blur with Physics

Post by Larsii30 » Sun Aug 05, 2012 10:08 am

Image

Modern Art. You can buy my creation for 1.9999,99 € !

User avatar
Lafolie
Inner party member
Posts: 804
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Experiment: Motion Blur with Physics

Post by Lafolie » Mon Aug 06, 2012 3:54 am

Very impressive. You seem to have a good hold of the physics module. Make a game :P
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

User avatar
retrotails
Party member
Posts: 212
Joined: Wed Apr 18, 2012 12:37 am

Re: Experiment: Motion Blur with Physics

Post by retrotails » Mon Aug 06, 2012 4:04 am

I made it use 1 canvas and also made it almost the same no matter what FPS. V enables/disables vsync.
edit:
Image
Attachments
motion blur edit.love
(1.76 KiB) Downloaded 87 times

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Experiment: Motion Blur with Physics

Post by BlackBulletIV » Mon Aug 06, 2012 6:22 am

Larsii30: Honestly, if you were a somewhat famous artist, you could just apply a blur and smudge filter (perhaps some colour desaturation as well) to that and sell it for a great deal of money. :P

Lafolie: This was my little experiment to get used to the new system. I may well make something... we'll see. :)

retrotails: That's brilliant! Took me a while to get how you did it. I still don't understand the exact meaning of the numbers in "dt*15*255".

User avatar
retrotails
Party member
Posts: 212
Joined: Wed Apr 18, 2012 12:37 am

Re: Experiment: Motion Blur with Physics

Post by retrotails » Mon Aug 06, 2012 9:58 am

BlackBulletIV wrote: retrotails: That's brilliant! Took me a while to get how you did it. I still don't understand the exact meaning of the numbers in "dt*15*255".
Thanks. math.clamp(dt*15*255, 4, 255) is the transparency, as such when you have a high dt, you have a low FPS, so it turns up the alpha so you don't have ridiculous blur, and vice versa. 4 and 255 are nice minimum & maximum values (I think above 255 and it wraps around, not good!). It's still dt*15*255 instead of dt*3825 because 15 is 1/4 of 60 (normal monitor refresh rate) and it's a good, easy number to change.
Think of it like this: If you have vsync at 60 FPS, dt will be 1/60. If it was dt*60*255, at 60 FPS, the function would output 255. 100% alpha means every frame gets 100% overwritten, in other words no blur. So I made is 15, and now every frame gets overwritten with 1/4 alpha.

User avatar
BlackBulletIV
Inner party member
Posts: 1260
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Experiment: Motion Blur with Physics

Post by BlackBulletIV » Mon Aug 06, 2012 11:54 am

Ah, I think I mostly understand now. Thanks. :)

User avatar
Lafolie
Inner party member
Posts: 804
Joined: Tue Apr 05, 2011 2:59 pm
Location: SR388
Contact:

Re: Experiment: Motion Blur with Physics

Post by Lafolie » Mon Aug 06, 2012 7:02 pm

Well you've basically got a platforming engine right here. Make a level and run around it, eventually you will think "what happens here if xyz...".
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests