Faking Depth of Field

This forum is currently in read-only mode.
From the Asset Store
A very simple to set up ZElevation based depth of field system for your game. Fully commented.
  • 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!

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    http://dl.dropbox.com/u/666516/dofsci.cap

  • 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!

  • Well if I had known you were a cheap date I would have suggested enable/ disable layer or object fx.

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

    Here's how it turned out:

    <img src="http://i.cubeupload.com/051bJ9.png">

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)