Version: 5.5
Crease Shading
Depth of Field

Depth of Field (Deprecated)

Depth of Field (Deprecated) is a common postprocessing effect that simulates the properties of a camera lens. The name refers to the fact that the effect was added in Unity 3.4, but now is superseded by a more modern Depth Of Field effect which uses optimized techniques to simulate lens blurs and enables better transitions between focal areas. However, depending on the use case, performance might be a lot better in the old 3.4 version as it was developed for older hardware.

In real life, a camera can only focus sharply on an object at a specific distance; objects nearer or farther from the camera will be somewhat out of focus. The blurring not only gives a visual cue about an object’s distance but also introduces bokeh which is the term for pleasing visual artifacts that appear around bright areas of the image as they fall out of focus.

An example of 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.

Only the nearby pipes are in the focal area
Only the nearby pipes are in the focal area
Foreground vs Background blurring with Depth of Field
Foreground vs Background blurring with Depth of Field

You might also consider using the Tilt Shift effect for a more straightforward but less sophisticated depth-of-field effect.

Al igual que los otros efectos de imagen, usted debe tener el Standard Assets Effects package instalado antes de que se vuelva disponible.

Propiedades

Propiedad: Función:
General Settings
Resolution Determines the internal render target sizes. A lower resolution will result in faster rendering and lower memory requirements.
Quality El nivel de calidad. Escoja entre el más rápido OnlyBackground o la calidad más alta BackgroundAndForeground que calcula el desenfoque depth-of-field (profundidad de campo) para ambas áreas de manera separada.
Simple tweak Switches to a simpler focal model.
Visualize focus This shows the focal plane in the game view to assist learning and debugging.
Enable bokeh This will generate more realistic lens blurs where very bright parts are scaled and overlap.
Focal Settings
Focal distance La distancia al plano focal desde la posición de la cámara en el espacio del mundo.
Object Focus Determina la distancia focal utilizando un objeto como blanco en la escena.
Smoothness The smoothness when transitioning from out-of-focus to in-focus areas.
Focal size El tamaño del área enfocada.
Blur
Blurriness How many iterations are used when blurring the various buffers (each iteration requires processing time).
Blur spread The blur radius. This is resolution-independent, so you may need to readjust the value for each required resolution.
Bokeh Settings
Destination Enabling foreground and background blur increases rendering time but gives more realistic results.
Intensity Blend intensity used as bokeh shapes are being accumulated. This is a critical value that always needs to be carefully adjusted.
Min luminance The luminance threshold below which pixels will not have bokeh artifacts applied.
Min contrast The contrast threshold below which pixels will not have bokeh artifacts applied. The significance of this is that you usually only need bokeh shapes in areas of high frequency (ie, cluttered or “noisy” areas of image) since they are otherwise nearly invisible. Performance will be improved if you use this parameter to avoid generating unnecessary bokeh artifacts.
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 La textura que define las formas del bokeh.

Tenga en cuenta, ya que el efecto bokeh es creado al dibujar triángulos por pixel, este puede afectar drásticamente su framerate, especialmente si no está ajustado de manera optima. Ajuste el Size, Min luminance, Min contrast, Downsample y Resolution para mejorar rendimiento. También, ya que la pantalla está oscurecida antes de que las formas bokeh se aplique, suted debería utilizar un nivel de Blurriness adecuado para quitar artefactos posibles.

Hardware Support

This effect requires a graphics card that supports Shader Model 3 and depth textures. See the Graphics Hardware Capabilities and Emulation page for further details and a list of compliant hardware.

Crease Shading
Depth of Field