1. 程式人生 > >Unity3D影象後處理特效——Bloom and Lens Flares

Unity3D影象後處理特效——Bloom and Lens Flares

Blooming is the optical effect where light from a bright source (such as a glint) appears to leak into surrounding objects. The Bloom and Lens Flares image effect adds bloom and also automatically generates lens flares in a highly efficient way. Bloom is a very distinctive effect that can make a big difference to a scene and may suggest a magical or dreamlike environment especially when used in conjunction with

HDR rendering. Bloom and Lens Flares is actually an enhanced version of the Glow image effect which offers greater control over the bloom at the expense of rendering performance.

泛光特效是一種光學效應,它是指在來自於強光源(如閃爍)的光線看起來像是影響到了周圍物體。Bloom and Lens Flares影象效果通過一種高效的方式添加了泛光效果,並會自動生成鏡頭光暈的效果。泛光是一個非常獨特的效果,它與HDR渲染方法一起使用時可以很大程度地改變場景的氛圍,烘托出神奇、夢幻般的環境。泛光與鏡頭光暈特效實際上是輝光特效的一個增強版,它可以對泛光效果提供更好的控制,但同時也會帶來昂貴的渲染效能開銷。

Example showing how Bloom and Lens Flares can give a soft glow using the new Screen blend mode. The new anamorphic lens flare type helps evoke a cinematic feeling.

例子中顯示了該特效在使用了新的螢幕混合模式後可以提供一個柔和的輝光效果。新的變形鏡頭光暈型別有助於烘托出電影的感覺。

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    屬性

Tweak Mode

調整模式

Choose complex mode for additional options such as lens flares.

對於額外的選項選擇複雜的模式,比如鏡頭光暈效果。

Blend mode

混合模式

The method used to add bloom to the color buffer. The softer Screen mode is better for preserving bright image details but doesn't work with HDR.

將泛光效果新增到顏色快取上的方法。更加柔順的螢幕模式比較適合於保留明亮的影象細節,但這種模式無法跟HDR一起使用。

HDR

高動態範圍

Whether bloom is using HDR buffers. This will result in a different look as pixel intensities may leave the [0,1] range, see details in tonemapping and HDR.

決定該特效是否使用HDR快取。使用HDR將導致一個不同的視覺感受,因為畫素亮度將超過[0,1]範圍,具體細節可見tonemappingHDR

Cast lens flares

投射透鏡光暈

Enable or disable automatic lens flare generation.

開啟或關閉自動生成的透鏡光暈效果。

Intensity

強度

The global light intensity of the added light (affects bloom and lens flares).

附加光(影響到該特效的光源)的全域性光強。

Threshhold

閾值

Regions of the image brighter than this threshold receive blooming (and potentially lens flares).

影象中亮度高於該閾值的區域將產生泛光效果(以及潛在的透鏡光暈效果)。

Blur iterations

模糊次數

The number of times gaussian blur is applied. More iterations improve smoothness but take extra time to process and hide small frequencies.

高斯模糊應用的次數。更多的迭代次數會增強畫面的柔順度,但同樣需要額外的時間來處理和隱藏小頻率的細節。

Blur spread

模糊擴散

The max radius of the blur. Does not affect performance.

模糊的最大半徑。不會影響效能。

Use alpha mask

使用alpha遮罩

The degree to which the alpha channel acts as a mask for the bloom effect.

使用alpha通道作為遮罩,來應用於泛光效果。

Lens flare mode

透鏡光暈模式

The type of lens flare. The options are Ghosting, Anamorphic or a mix of the two.

透鏡光暈的型別,主要有三種:重影、變形或者兩者結合。

Lens flare mask

透鏡光暈遮罩

Mask used to prevent lens flare artifacts at screen edges.

防止透鏡光暈在螢幕邊緣造成誤差的遮罩。

Local intensity

區域性強度

Local intensity used only for lens flares.

僅用於透鏡光暈效果的區域性強度。

Local threshold

區域性閾值

The accumulative light intensity threshold that defines which image parts are candidates for lens flares.

累積的光源強度閾值,它限定了影象中哪些部分對透鏡光暈產生影響。

Stretch width

拉伸寬度

The width for anamorphic lens flares.

透鏡光暈的變形寬度。

Blur iterations

模糊次數

The number of times blurring is applied to anamorphic lens flares. More iterations improve smoothness but take more processing time.

應用於變形透鏡光暈的模糊次數。更多的迭代次數會增強畫面的柔順度,但同樣會佔用更多的處理時間。

Tint Color

色調顏色

Color modulation for the anamorphic flare type.

變形光暈型別的顏色調製

1st-4th Color

顏色型別

Color modulation for all lens flares when Ghosting or Combined is chosen.

當重影或合併被選中時,所用的調製顏色。

Blend Modes: Add and Screen    混合模式:增加模式和螢幕模式

Blend modes determine the way that two images will be combined when overlaid. Each pixel from the base image is combined mathematically with the pixel in the corresponding position in the overlay image. Two blend modes are available for Unity image effects, Add and Screen.

混合模式決定了當兩張圖片重疊式的合併方法。基影象上的每個畫素都根據數學公式與重疊影象上的相應畫素進行合併。目前Unity支援兩種混合模式:增加模式和螢幕模式。

Add Mode         增加模式

When the images are blended in Add mode, the values of the color channels (red, green and blue) are simply added together and clamped to the maximum value of 1. The overall effect is that areas of each image that aren't especially bright can easily blend to maximum brightness in the result. The final image tends to lose color and detail and so Add mode is useful when a dazzling "white out" effect is required.

當圖片是通過增加模式進行混合時,各個顏色通道(紅、綠、藍)的值只需要簡單相加即可,同時將最大值限制為1。這樣,總體效果就是使每幅圖片上本來不是特別明亮的區域在混合結果中會被很容易地達到最大亮度值,以至於最終圖片可能會失去顏色和細節資訊,所以,增加模式比較適合於生成“泛白”的效果。

Screen Mode   螢幕模式

Screen mode is so named because it simulates the effect of projecting the two source images onto a white screen simultaneously. Each color channel is combined separately but identically to the others. Firstly, the channel values of the two source pixels are inverted (ie, subtracted from 1). Then, the two inverted values are multiplied together and the result is inverted. The result is brighter than either of the two source pixels but it will be at maximum brightness only if one of the source colors was also. The overall effect is that more color variation and detail from the source images is preserved, leading to a gentler effect than Add mode.

之所以叫螢幕模式是因為它主要是通過將兩幅圖片同時投影到一個螢幕上來模擬該特效。每個顏色通道各自分別融合,首先,對兩個源圖片上的畫素進行求逆運算(用1來減每個通道的值),然後將兩個值相乘,並將結果再次取逆,結果將比兩個源畫素都要明亮,但只有當其中一個畫素為最大亮度時,結果才會達到最大亮度。同時,整體效果也會展現出更多的顏色變化以及保留更多的細節資訊。

Hardware support     硬體支援

This effect requires a graphics card with pixel shaders (2.0) or OpenGL ES 2.0. PC: NVIDIA cards since 2003 (GeForce FX), AMD cards since 2004 (Radeon 9500), Intel cards since 2005 (GMA 900); Mobile: OpenGL ES 2.0; Consoles: Xbox 360, PS3.

這個特效需要顯示卡擁有畫素著色器(2.0)或者OpenGL ES 2.0。桌上型電腦:2003年以後的NVIDIA顯示卡(GeForce FX),2004年以後的AMD顯示卡(Radeon 9500),2005年以後的Intel卡(GMA 900);移動裝置:OpenGL ES 2.0;控制檯: Xbox 360 PS3

All image effects automatically disable themselves when they can not run on end-users graphics card.

所有影象特效如果無法在使用者顯示卡上執行時將會自動被關閉。