Depth of Field 3.4
The Depth of Field 3.4 image effect is a common post effect simulating camera lens systems. It has been updated with new features and faster execution for Unity 3.4, hence the name. An example for the new Depth of Field effect can be seen in the following images, displaying the results of a defocused foreground and a defocused background. Notice how the foreground blur overlaps with the rest while the background doesn't. You might also consider the Tilt Shift effect for a simpler to use but less powerful depth of field effect.
Only the nearby pipes are in the focal area
Foreground vs. Background blurring with Depth of Field
As with the other image effects, this effect is only available in Unity Pro. Make sure to have the Pro Standard Assets installed.
Properties
General Settings | |
Resolution | Determines the internal render target sizes. The lower the resolution the faster the effect and the lower the memory requirements will be. |
Quality | The quality level. Chose between the faster OnlyBackground or the slower BackgroundAndForeground options which calculates the Depth of Field defocus for both areas seperately. |
Simple tweak | Switches to a simpler focal model. |
Visualize focus | Visualizes the focal areas in the game view. |
Enable bokeh | This will generate more realistic lens blurs where very bright parts are scaled and overlap. |
Focal Settings | |
Focal distance | The distance to the focal point from the camera position in world space. |
Object Focus | Instead of setting the distance manually you can always autofocus on this Transform. |
Smoothness | The smoothness when transitioning from out-of-focus to in-focus areas. |
Focal size | The size of the in-focus area. |
Blur | |
Blurriness | How many iterations are taken for defocusing the various buffers. |
Blur spread | The blur distance (resolution independent, you might have to re-tweak if the resolution changes drastically). |
Bokeh Settings | |
Destination | Enabling foreground and background blur will be a lot slower but gives more realistic results. |
Intensity | Blend intensity when all bokeh shapes are being accumulated. This is a critical value that always needs to be carefully adjusted. |
Min luminance | The luminance threshhold for all pixels that should be considered. |
Min contrast | The contrast threshhold for all pixels that should be considered (this is important as usually, you only need bokeh shapes in areas of high frequency. They would be close to invisible otherwise. It also helps performance as it can save a lot of fillrate.). |
Downsample | The size of the internal render target used for accumulating bokeh shapes. |
Size | The maximum bokeh size. Will be modulated by the amount of defocus (Circle of Confusion). |
Bokeh Texture | The texture defining the bokeh shapes. |
Note about the Bokeh effect: as it is based on drawing triangles per pixel it can drastically affect your framerate, especially if it's not properly tweaked. Adjust the Size, Min luminance, Min contrast, Downsample and Resolution for highest performance. Also, as it pre-darkens the screen before applying the bokeh shapes, one should take care of using an apropriately high Blurriness level to remove possible artefacts.
Hardware support
This effect requires a graphics card with pixel shaders (3.0) or OpenGL ES 2.0. Additionally, depth texture support is required. PC: NVIDIA cards since 2004 (GeForce 6), AMD cards since 2005 (Radeon X1300), Intel cards since 2006 (GMA X3000); Mobile: OpenGL ES 2.0 with depth texture support; Consoles: Xbox 360, PS3.
All image effects automatically disable themselves when they can not run on end-users graphics card.
Page last updated: 2011-06-12