天天看點

Unity3D圖像後處理特效——Depth of Field 3.4

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.

新的景深效果顯示如下面的圖檔,一個顯示前景散焦效果,另一個顯示背景散焦的效果。可以看到前景的模糊區域會蔓延,并與其他部分重疊,而背景模糊則不會。

Unity3D圖像後處理特效——Depth of Field 3.4

隻是附近的管道是在聚焦區域

Unity3D圖像後處理特效——Depth of Field 3.4

景深效果中的前景模糊與背景模糊

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

As with the otherimage effects, this effect is only available in Unity Pro and you must have the Pro Standard Assets installed before it becomes available.

您還可能會考慮使用Tilt Shift效果來得到更加直接但簡單的景深效果。和其他圖像特效一樣,該特效隻能在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 theSize, 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 appropriateBlurriness 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.

所有圖像特效如果無法在使用者顯示卡上運作時将會自動被關閉。