Faking Depth of Field

For questions about using Classic.

Post » Sun Mar 20, 2011 2:38 pm

So, in my game I want to be able to FOCUS on certain things, blurring the background completely and showing only the target in focus.

I have a blur layer which blurs the entire game (except the HUD) when toggled using a button.

Let's have an example situation.

We have a 2D city and you must assassinate a target. You press F and the background blurs out, leaving you and the target focused while the rest of the background blurs away, kinda like Assassin's Creed ( example pic: http://cloud.steampowered.com/ugc/57891 ... A49ABBE97/ ) You hover over the person you want to follow and press F to "lock on" to the target. Your attacks are now focused on him instead of the others in the area and you can concentrate on him.

So, how can I track a moving target while blurring the background around him, leaving him in focus? How could I do this? Keep in mind that the PLAYER should also be in focus.

The idea I have right now is a Blur Canvas, which renders the entire layer in blur, but I have no idea how to go on from here.

Help, please! :D
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Sun Mar 20, 2011 3:46 pm

Maybe you can make a second frame in the background object that will be blurred and:
on target focused : set animation frame to 2
on target unfocused: set animation frame to 1
B
2
G
2
Posts: 34
Reputation: 718

Post » Sun Mar 20, 2011 4:04 pm

There are a couple of things you can do with effects, in particular "Blur Mask Horizontal".
It creates a blur based on the contrasts of the mask its applied to, IE white is blurred 0%, black 100%.
This would work well with a variable radial gradient object, but alas we dont have one.
We do have a simple gradient, as shown in the cap.
As it stands right now its not really viable, as the fx wont let you set the strength of the blur, and its a fps hog(check the fps, and ram in the window bar), but its the closest thing we have right now that does what your looking for.

[url:tp0vg9b9]http://dl.dropbox.com/u/666516/dofsci.cap[/url:tp0vg9b9]
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Sun Mar 20, 2011 7:09 pm

Okay, I got it! It was really silly, really simple. Not efficient at all though.

I simply made a permanent blur layer I can toggle and manipulate and a new FOCUS layer above it. I add stuff to the focus layer once you "lock on" to a citizen. Bam, problem solved!
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Sun Mar 20, 2011 7:58 pm

Well if I had known you were a cheap date I would have suggested enable/ disable layer or object fx.:P
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Thu Mar 24, 2011 4:34 pm

I just wanted to say thank you so much for helping me out!

Here's how it turned out:

B
4
S
2
G
6
Posts: 50
Reputation: 1,690


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests