Depth of Field Image Effect
Manual     Reference     Scripting   
Reference Manual > Components > Image Effect Scripts > Depth of Field Image Effect

Depth of Field Image Effect

The Depth of Field image effect is a common post effect simulating camera lens systems. This results in sharp and unsharp areas based on each pixel's depth in comparison to a defined focal point.

As with the other image effects, this effect is only available in Unity Pro. Make sure to have the Pro Standard Assets installed.


Example for Depth of Field. Note how the camera focuses on the screen center (Focus on Center enabled).

Properties

QualityThe quality level. Chose between Low (but fast), Medium (no halos, but low quality foreground blur) and High (properly blurs foreground objects). This setting has a big impact on overall performance.
Focal DistanceThe distance to the focal point from the camera position in world space. This value will be automatically calculated if Focus on Center or Focus on This is enabled.
Focal SizeIncreases the focal area if > 0.
Start CurveDefines the intensity curve for the foreground blur.
End CurveDefines the intensity curve for the background blur.
Focal FalloffGlobal tweaking that affects start and end curves.
Center focusSpecify this to automatically focus on whatever the center of the camera is looking at. The script will automatically read out the depth buffer and calculate a proper focal distance.
Object focusSpecify this to automatically focus on whatever transform object has been dropped here. A proper focal distance will be automatically calculated.
BokehEnable fake bokeh simulations. This will make bright objects bleed in a circular manner over neighbouring pixels.
Bokeh CutoffThe threshhold for the bokeh simulation.
Background BlurSettings for background blurring (most common usage of Depth of Field).
Blur iterationsThe smoothness of the unsharp areas.
Blur SpreadThe blur distance for the unsharp areas.
Foreground BlurSettings for foreground blurring.
SpreadThe blur distance for the unsharp foreground objects.
IterationsThe smoothness of the unsharp objects in the foreground.
WeightThe overall blur strength of the unsharp objects in the foreground.
Debug Blur AreasEnable this to get the blending between sharp & unsharp areas displayed in the game view.

Hardware support

Depth of Field works only on graphics cards with support for pixel shaders (2.0) or devices with OpenGL ES2.0 support. Eg. GeForce FX 5200 or Radeon 9500 and up. All image effects automatically disable themselves when they can not run on an end-users graphics card. Depth texture support is required.

Page last updated: 2011-01-12