Depth of Field 3.4 is a common postprocessing effect that simulates the properties of a camera lens. The name refers to the fact that the effect has had significant performance and feature improvements in Unity 3.4.
景深3.4特效是一种常见的模拟相机透镜的后处理特效。它的名字反映了在Unity3.4中该特效有了重要特性增强以及性能增强。
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.
现实生活中,相机可以只专注特定距离的物体;更近或更远的物体将会出现一定的失焦现象。模糊不仅提供了一个关于物体距离的视觉提示,同时也带来了背景虚化(bokeh)效果,这种效果是由图片中明亮失焦物体而产生的。
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
只是附近的管道是在聚焦区域
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.
您还可能会考虑使用Tilt Shift效果来得到更加直接但简单的景深效果。
As with the other image effects, this effect is only available in Unity Pro and you must have the Pro Standard Assets installed before it becomes available.
和其他图像特效一样,该特效只能在Unity Pro上进行使用,并且在使用之前必须安装Pro Standard Assets。
Properties 属性
-
General Settings一般设置
-
Resolution 分辨率Determines the internal render target sizes. A lower resolution will result in faster rendering and lower memory requirements.
确定内部渲染目标的大小。较低的分辨率将导致更快地渲染效率和较低的内存要求 -
Quality 质量The quality level. Choose between the faster OnlyBackground or the higher-quality BackgroundAndForeground which calculates the depth-of-field defocus for both areas separately.
质量级别。在OnlyBackground和BackgroundAndForeground之间进行选择。前者更快,后者质量更高。 -
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 聚焦距离The distance to the focal plane from the camera position in world space.
在世界空间中焦平面到相机的距离 -
Object Focus 物体聚焦Determine the focal distance using a target object in the scene.
使用场景中的目标物体来决定的聚焦距离 -
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 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 背景虚化纹理The texture defining the bokeh shapes.
定义背景虚化图形的纹理
Note that since the bokeh effect is created by drawing triangles per pixel, it can drastically affect your framerate, especially if it's not adjusted optimally. Adjust the Size, Min luminance, Min contrast, Downsample and Resolution to improve performance. Also, since the screen is darkened before the bokeh shapes are applied, you should use an appropriate 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.
这个特效需要显卡拥有像素着色器(3.0)或者OpenGL ES 2.0,同时需要支持深度纹理。台式机:2004年以后的NVIDIA显卡(GeForce6),2005年以后的AMD显卡(Radeon X1300),2006年以后的Intel卡(GMA X3000);移动设备:OpenGL ES 2.0并支持深度纹理;控制台: Xbox 360、 PS3。
All image effects automatically disable themselves when they can not run on end-users graphics card.
所有图像特效如果无法在用户显卡上运行时将会自动被关闭。