[Discussion] Motion Blur

Share your Construct 2 effect files

Post » Wed Dec 23, 2015 11:48 am

Hey, as no one made a motion blur effect for construct, I'm trying to do it on my own.
Anyway, I'm new to javascript, so I got a few questions.

I've made some researches on how the effect should work, and I found that what the effect does is:
1- Copies the canvas (or whatever name you call it, the part of the game that is currently displayed on screen)
2- Adds to it some blurry effect
3- After 1 frame, blends it to the current canvas
4- Go back to step one.

So, I know how to blend images.
I kinda know how to add that blurry effect.
But, the whole problem is that I neither know how to "copy" the canvas nor how to "wait" 1 frame

Could some awesome javascripter help me with this one? ^^
Image
B
28
S
6
G
2
Posts: 202
Reputation: 3,131

Post » Fri Dec 25, 2015 6:39 am

When you say "motion blur", do you mean creating a trail?
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Sat Dec 26, 2015 7:37 am

Yes, something like this : (add https)://www.scirra.com/forum/request-directional-blur_t122854
Image
B
28
S
6
G
2
Posts: 202
Reputation: 3,131

Post » Thu Dec 31, 2015 5:16 pm

Here's how I approached it in a recent game. I created a semi-transparent copy of the player object (named it Trail) and gave it fade behavior. Set it to active. Set it destroy after fade out. Set the fade out time to 0.5 seconds.

On Some condition> (create a sub event)
______System> Every 0.06 seconds > Player Spawn Trail ( on layer below the Player's layer)

As the Player object moves it creates a trail. You can adjust the timing parameters for the desired effect. In my case, I created a transparency (Trail) at 30% of the original Player Object.

Worked well for me. Good Luck
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Sat Jan 02, 2016 8:50 pm

What I did personally, is redoing what the dude in the post I've shown in my previous message. The result is quite satisfying
Image
B
28
S
6
G
2
Posts: 202
Reputation: 3,131

Post » Wed Jan 06, 2016 2:29 am

@TheDom
@skymen

Iv'e 90% finished a fx shader that looks half decent. Here's a screen grab-

Image

The problem is passing info from the player input...keyboard press etc.
B
21
S
6
G
8
Posts: 1,215
Reputation: 7,881

Post » Wed Jan 06, 2016 8:26 am

Out of curiosity what would be the best practice for this, performance wise?

A. Spawning sprite instances.
B. Using a shader.
C. Pasting to the canvas/paster plugin.

Of course while all the parameters and draw calls are exactly the same.
Image
B
67
S
26
G
12
Posts: 511
Reputation: 11,974


Return to Effects

Who is online

Users browsing this forum: No registered users and 0 guests