Redshift Global Illumination

Photon Mapping GI Engine 光子貼圖GI引擎

Brute Force GI Engine 暴力GI引擎

Irradiance Cache GI Engine 輻射緩存GI引擎

Irradiance Point Cloud Engine 輻射點雲GI引擎

Basic Concepts 基本概念

In real life, light photons originate from light sources, theybounce off a number of surfaces, havetheir colors modified by these surfaces and eventually reach our eyes. In computer graphics, Global Illumination (GI) attempts to simulate those photon bouncing interactions. This simulation adds realism to lighting and helps achieve more life-like images.

在真實的世界裡,光源會發射出大量的光子。光子達到物體表面後反彈,根據反彈表面的色彩面改變自身的顏色,最終進入我們的眼睛。在計算機圖形學中,GI(Global Illumination)全局照明模式就是嘗試模擬這種光子反彈式的物理照明過程。這種光子模擬過程為渲染增加了真實感,幫助數字藝術家得到更為生動、真實的畫面。

GI can have a profound effect even on extremely simple scenes, as shown below:

即便是處理極為簡單的場景,GI也可以營造出極高質量的效果。

Without GI(沒有使用GI)

With GI. Notice the color bleeding.

(開始GI,注意畫面中的「顏色溢出效果 」)

Light that reaches object surfaces without any bounces is referred to as direct lighting. Once light has bounced off one or more surfaces it is referred to as indirectlighting. So what GI essentially computes is indirect lighting.

光線直接照射物體表面,而沒有經過光子反彈,稱之為直接照明。光線經過一次或者多物體表面的反彈後,稱之為間接照明。所以,GI的核心是計算間接照明。

When a photon hits a rough surface, it gets scattered around randomly. This is called Diffuse Global Illumination. When a photon hits a strongly reflective or refractive surface (like mirror or glass), it tends to have a more predictable bounce direction. Because of this, photons bouncing off reflective/refractive surfaces tend to get 『clumped』 together and form interesting lighting patterns. These patternsare called Caustics. Global Illumination, in general, refers to both of these effects: Diffuse GI and Caustics.

當光子碰撞到一個粗糙的表面,它就會被 隨機地向各個方向散射出去,這就是所謂的Diffuse Global Illumination(漫反射全局照明)。當光子擊中一個強烈反射或者折射的表面(如鏡面或者玻璃),它往往會向一個更可預測的方向反彈。正因為如此,光子離開反射、折射後,往往會「集結」在一起,形成有趣的光亮圖案。這種圖案被稱為「Caustics」(焦散)。Global Illuminaiton,在不一般情況下,就是指這兩種效應:Diffuse GI 和Caustics.

The image shown above is lit using Diffuse GI, while the image below uses Caustics.

上面的圖片就是利用Diffuse GI ,而下面的圖片則使用Caustics.

Caustics

Redshifttreats Diffuse GI and Caustics separately.

Redshift計算Diffuse GI 和Caustics是分開進行的。

Diffuse Global Illumination can be achieved with a combination of the following techniques:

Diffuse GI 可以通過以下技術的組合來實現:

Photon mapping光子貼圖

Brute-Force暴力計算

Irradiance caching輻射緩存

Irradiance point cloud 輻射點雲

Caustics, on the other hand, can only be achieved with

而Caustics效果只能能過一種方式獲得

Photon mapping光子貼圖

In Redshift, all of these techniques are called 「GI Engines」. Each GI Engine has its pros and cons. These are listed further down in this document.

在Redshift 系統中,所有這些技術都被稱為「GI引擎」。每個GI引擎都有其它優點和缺點。

Primary And Secondary GI Engines

Among the techniques mentioned above, photon mapping is the only one that works similar to how lighting works in real-life, i.e. it shoots photons from the lights. All the other techniques work the reverse way: they shoot rays out of the camera, bounce them around and eventually hit a light.

在上述提到的技術中,Photo Mapping 是唯一類似於真實生活中光線運行原理的方式:它從光源向外發射光子。所有其它技術的工作方式恰恰相反:它們從相機發射採樣射線,在環境中反彈,並最終抵達燈光。

When these camera rays hit an object, the primary GI Engine is used. If GI requires multiple bounces, the secondary GI Engine is used for these bounces. The figures below show how this happens when you enable 「brute force」 for both primary and secondary GI engines.

當這些「相機射線」擊中物體時,Praimary GI 引擎被啟動。如果GI需要多次反彈,Secondry GI引擎被啟動用於這些反彈的採樣。下圖顯示了「Brtue-Force」模式下,Primary GI 和Secondary GI是如何進行工作的。

Zero GI Bounces. Camera shoots a ray and hits wall (point 「A」). The primary GI engine is used and shoots another ray of which is shown in red. This way, direct lighting on the floor (point 「B」) affects point 「A」.

第0次GI反彈。相機發射採樣射線,抵達到牆上的A點。Primary GI 引擎啟動,開始發射另一條採樣射線,在圖中以紅色顯示。通過這種方式,針對地板的直接照明B點會對A點產生光照影響。

One GI Bounce. The processing now goes a bit further. Point 「B」 uses the secondary GI engine to gather illumination from the sphere by shooting a single ray (shown in blue). This way, the direct lighting of the floor (point 「B」) and the sphere (point 「C」) affects point 「A」.

第一次反彈,渲染繼續進行,B點採用Secondary GI引擎通過發射一條新的採樣射線來收集來自球體的光影信息(以藍色顯示)。通過這種方式,被直接照亮的地板B點和球體C點共同影響A點的光影信息。

Shooting photons from the lights or shooting rays from our eyes are, in some ways, equivalent. If you flip the direction of all the arrows above it』s as if lighting came from the light source, bounced off the sphere, floor, wall and then reached the camera!

從光源發射光子與從我們的眼睛發射採樣射線,在某些程度上是相同的原理。如果反轉上面的圖中的所有的鏡頭方向,就會像所有光線來自光源,經過球體、地板、牆壁的反彈最終抵達攝像機。

So why have separate primary and secondary GI engines? The results of primary GI lighting are directly visible to the camera so needs to be as high-quality as possible. Secondary GI lighting, on the other hand, often represents a smallest part of the final lighting so it can afford to be of somewhat lower quality (think 「blurrier」 or 「noisier」) without introducing significant visual artifacts.Approximating secondary GI like that has significant performance and, sometimes, quality advantages!

那麼,為什麼要有分別獨立的Primary和Secondary的GI引擎呢?Primary GI 的效果對於相機是直接可見的,所以需要儘可能地提高渲染品質級別。另一方面,Secondary GI照明往往對最終光影影響很小,所以可以用稍低的質量(可以想像成「虛化」或者「噪點」)而不會影響最終渲染質量。這樣的Secondary 近似GI方式擁有極快的渲染效率,有時甚至可以提高渲染質量!

Please note that the examples above only show what happens with 「brute force」. Other GI engines do different things for points A, B, C. These are described in more detail under each technique』s documentation.

特別要注意,以上示例只是顯示了「Brute Force」引擎的工作模式,其它的GI引擎對於點A 、 B 、C點會有不同的處理方式,我們會在每種GI技術的介紹文檔中進行詳細描述。

Main Global Illumination Settings 基礎參數測試

The starting point for enabling GI is selecting the primary and secondary GI Engines and specifying the number of GI bounces.

啟用GI的第一步工作就是選擇Primary GI 和Secondary GI引擎,以及指定Gi反彈的次數。

Introducing more GI bounces in your scene will often make your lighting brighter - and the rendering slower. It also tends to 「wash out」 the lighting a bit, too. For these reasons users sometimes choose to limit the number of bounces.

在場景中引入更多的GI反彈往往會使光影效果偏亮,而且渲染不速度也會更慢,這些往往會導致畫面的亮部顯得「曝」。基於這些因素,用戶們有時候會適當限制反彈的次數。

The scene shown below contains a few vertical tiles, one of which is lit with a strong spotlight. The biggest visual difference (for this particular scene) is between 0 and 1 GI bounces. Note that these images were rendered using Irradiance Caching for the primary GI engine and Irradiance Point Cloud for the secondary GI engine.

在下面顯示的場景中,垂直地排列一些條形物。一盞高亮的聚光燈照射在他們中的一個上(針對該特定場景)。GI反彈次數設置為0和1的差別最明顯。注意:在渲染這些照片時,Primary GI 引擎選用Irradiance Cache(輻射絡緩存),Secondary GI引擎選擇了Irradiance Point Cloud (輻射點雲)。

Zero GI Bounces. The right tiles are lit by the direct lighting on the center illuminated tile.

第0次GI反彈。畫面中部被直接照亮的條狀物照亮了畫面右側的條狀物。

One GI Bounce. The indirect lighting on the right tiles is now bouncing off once and illuminating the left tiles. The ground below the right tiles now also receives extra illumination.

第1次GI反彈被間接照度的右側條狀物現在再次反彈照亮了左側的條狀物。在右側條狀物下面的地面,也被額外的光照亮了。

Two GI Bounces. The indirect lighting of the left tiles is now affecting the ground below them. The effect is definitely more subtle compared to the difference between zero and one GI bounce.

第2 次GI反彈。現在左側幾何體也開始反彈間接照明光線,影響它們腳下的地面了。相比於第0次和第1 次GI反彈之間的差異。這次影響很微妙。

After you』ve selected your primary and secondary GI engines, you』ll need to configure them. Please refer to the topics listed below for more information:

在選擇了primary和secondary引擎之後,您應該配置它們的參數。請參考下面的章節獲取更多的幫助。

Photon Mapping

Brute Force

Irradiance Caching

Irradiance Point Cloud

Recommended Settings 推薦的設置

Some users can be overwhelmed by the multitude of choices. and will ask for the best settings.

有時間用戶面對過多的參數會不堪重負,繼而會提出「最佳設置」的建議需要。

While different scenes will have different requirements, we have found that a good starting point is this:

雖然不用同場景都會有不同的要求,不過我們已經總結了一套不錯的初始配置方案;

  • Set the Primary GI Engine to 「Brute-Force」

Primary GI引擎選擇「Irradiance Cache」模式

  • Set the Secondary GI Engine to 「Irradiance Point Cloud」

Secondary GI引擎選擇「Irradiance Point Cloud」模式

  • Set the 「Number of GI Bounces」 to 2 or 3

Number of GI Bounces先設置2 或者 3.

If your scene need caustics (for glass or mirrors), please refer to the caustics section of the photon mapping topic.

如果場景有需要焦散效果(含有鏡子或者玻璃),可以去Photo Mapping 章節的「Caustics」部分查看應該方法。

As a rule of thumb, try to remember the following regarding GI quality:

關於GI的品質方面,請將下列經驗用作為使用準則牢牢記住:

  • Scenes containing several (not too strong) lights can typically get away with fairly low GI settings (number of rays, number of samples, etc)

場景如果包含多盞(不是太強亮度的)燈光,通常可以適當降低GI的各種設置(採樣線數量、採樣數、誤差閾值)

  • Scenes that contain very few, very strong lights will need more aggressive GI settings. For example, the 「single lit tile」 scene above required many rays to get a clean result because it was almost entirely indirectly lit and using only a single very strong light.

場景中如果包含極少且強度很高的燈光,就需要更為激進的GI設置。例如,前面舉例過的「只照亮單個物體」的場景,就需要大量的採樣射線才能得到一個整潔的效果。因為整個場景中只有一個強度較高的燈光,照明效果 幾乎完全依賴間接照明。

Outdoor scenes that are lit with environment shaders (like 「physical sky」) can typically get away with fairly low GI settings

利用Environment Shader (如「Physical SKY」)進行照明室外場景,通常可以採用相當低GI參數設置。

To summarize all of the above: lots of lighting contrast requires higherquality settings, lower contrast can get away with lower quality settings

總的來說,光影對比度越高,意味著需要更高質量的設置;較低的對比度,意味著可以採用較低的質量設置。

Photon Mapping光子貼圖

This technique works similarly to how light behaves in real life. In one stage, it shoots photons from light sources, bounces them around the scene and stores them on surfaces. Then, on a second stage, the renderer uses these photons to render the final image.

該技術的工作原理類似於光線在現實生活中的行為方式。在和一階段,從光源發射光子,在周圍的場景中反彈,並將它們存儲在場景中各種「表面」上,然後在第二階段渲染中,渲染器使用這些光子進行渲染最終的圖像。

Pros優點;

Provides a very good degree of control

擁有最大限度的可控行。

For reasonable numbers of photons, it renders fast

如果可以控制光子數量在合理範圍內,渲染速度比較快。

唯一可以渲染Caustic(焦散)效果的方式。

Cons缺點;

Photon mapping is an outdated technique

光子貼圖是一種過時的技術

Photons have to be stored in GPU memory so too many photons can be prohibitive in terms of memory usage

光子必須存儲在GPU卡顯存當中,所以太多的光子是沒有辦法存儲在內存當中。

There are a few settings to tweak and some experimentation might be needed to get a clean result

有一些可以用來調整的參數設置。如果想得到一個乾淨、細膩的結果,一些測試渲染是必不可少的。

Processing time and storage may be wasted for photons that will not end up being visible to the camera

有一些光子會最終因處於攝像機外面不可見,所以系統計算處理他們花的時間以及存儲它們都會是一種成的浪費。

Brute-Force暴力光照計算

Brute force works the opposite way to photon mapping. Instead of shooting photons from the light, it shoots a number of rays from each surface and bounces the rays around.

Brute force工作方式與photon mapping恰好相反,它會從場景中的物體表面發射大量採樣射線,並在物體表面之間相互反彈,而不是從光源向外發射光子。

Pros優點:

Very accurate

非常精準

No flickering in animations

沒有動畫閃爍問題

It』s easy as it only has one setting to tweak (「Num Rays」)

沒有多少參數需要調節

Does not require any storage so the final image resolution and scene detail does not matter

不需要任何存儲工作,所以最終圖像的解析度的場景細節都不是什麼大問題

Cons缺點:

It』s the slowest technique. But due to Redshift』s speed, it』s more practical compared to other renderers.

渲染速度最慢的方式,但由於Redshift 是使用GPU為加速的與其它渲染器相比更為實用。

Unless many rays are shot per pixel, it can produce grainy images – especially in difficult lighting situations。

除非在每個像素上都使用大量採樣射線,否則會產生顆粒感的圖像,尤其是在光照條件不好的情況下。 渲染成解析度與渲染時長是線性關係。

Irradiance Caching輻射緩存

Global Illumination often changes slowly over surfaces. This means that several pixels next to each other could 『share』 the same value which, in turn, means that we don』t need to compute a separate GI value for each pixel! Irradiance caching takes advantage of this fact and computes GI similar to Brute-Force but at sparse points around the image, which means that the computation takes much less time.

GI沿表面的的變化是非常緩慢的,這意味著幾個彼此相鄰的像素可「共享」相同的光影信息,這也就意味著我們不需要為每個像素進行單獨的GI照明計算,Irradiance caching 採用也Brute-Force引擎類似的工作方式進行GI運算,但是在渲染畫面引入更少的採樣信息點,這就意味著實際上它的計算時間會更短。

Pros優點:

Can produce smooth images several times faster than Brute-Force

以比Brute-Force快幾部的速度渲染出平滑的圖片。

The results can be saved to disk for each animation frame. So if you are tweaking things like antialiasing, glossy num rays, num area light samples and other quality parameters (not related to GI), you can simply load the GI results and iterate quickly.

每一幀的計算結果會被自動存儲到磁碟上,因此假如調整諸如抗鋸齒(譯註:Antialiasing,渲染設置中output下Unified Sampling),光澤採樣數(譯註:材質節點折射中Samples)、區域光源採樣數(譯註:Redshift Physical Light中,使用Area時的Samples)以及其它影響渲染質量的參數(與GI無關的那些),就只需要載入前面的GI信息,並以極快的速度反覆渲染迭代。

Lots of scenes have large parts that are mostly flat. For example: walls on an architectural interior. Or the surface of a car. The irradiance cache will have a significant performance benefit on these scenes.

許多場景都包含一些表面平緩的面。例如,建築內部的牆壁、汽車的表面等等。Irradiance在這些場景的渲染上很明顯的效率優勢。

Increasing the final image resolution often does not increase the irradiance cache time linearly –depending on scene complexity and irradiance cache settings. I.e. going from 1280x720 to 2560x1400 (i.e. 4 times more pixels), you might find the irradiance cache processing time taking less than 4 times longer

提高最終圖像的解析度通常不會同比線性增加Irradiance Cache時間(主要是根據場景複雜度和Irradiance Cache設置)。如果從1280 * 720 到2560*1400(既4倍像素比),Irradiance Cache的處理時間通常不會慢4倍。

Cons缺點:

The Irradiance Cache Points are computed during a separate rendering pass so interactive feedback is not possible.

Irradiance Cache信息是在單獨的渲染步驟中進行,因此無法提供交互顯示。

While shooting too few rays with brute-force shows up as grain, shooting too few rays for the irradiance cache shows up as 「splotches」 and flickering in animations. These can be even more visually distracting than grain.

在brute-force模式下過少的採樣線會導致顆粒感很明顯。同樣,太少的採樣射線會導致Irradiance Cache渲染出現「斑塊」,有時之比顆粒感更不能接受。

There are several user parameters that control things like point spacing. Settings these correctly is important for splotch-free and flicker-free results. Learning how to use these settings often involves trial-and-error.

有一些可選的參數可以控制諸如信息點間距之類的渲染設置。想要排除閃爍和斑塊問題,就必須正確的設置這些參數。想要理解如何進行設置,則需要積極地通過不斷的「試錯」。

If the scene has a lot of detail (example: foliage covering a big part of the screen) then too many points might have to be created. This invalidates the benefits of the irradiance cache and also puts a big burden on memory resources because the points have to be stored. For these scenes, brute-force might be a better choice.

如果場景有很多細節(例如,屏幕中的大部分區域覆蓋著植被),那麼可能需要創建許多採樣點,這會大幅降低Irradiance Cache的優勢。內存資源將承受巨大的負擔,因為這些點都需要被存儲。對於這類場景,也許Brute-Frace反倒是一個更好的選擇。

Irradiance Point Cloud 輻射點雲

The Irradiance Point Cloud can only be used as a secondary GI engine. Its purpose is to provide faster and cleaner secondary lighting to the primary GI engine. You might have seen similar techniques on other renderers called 「Importons」, 「Irradiance Particles」 or 「Light Cache」. While Redshift』s Irradiance Point Cloud works differently to these techniques, it serves the same purpose which is to improve the quality and efficiency of multiple-bounce GI.

Irradiance Point Cloud只能作為Secondary GI引擎使用。它的主要應用目的是為GI引擎提供一種更速度和更清潔的輔助照明。你可能已經在其它一些渲染器,諸如:「Importons」 「Irradiance Particles」或者「Light Cache」中聽說過類似的技術。但是Redshift Irradiance Point Cloud的工作方式與它們不太一樣,當然目前是一樣的----提高多次GI反彈的質量和效率。

Pros優點:

Helps make Brute-Force and Irradiance Caching faster and cleaner

幫助Brute-Froce和Irradiance Cache渲染更快捷更乾淨。

Certain very difficult lighting scenarios can only be rendered with this technique! (i.e. they would take an extremely long time with purely brute force techniques)

適合燈光對比度比較大的場景(如果用Brute-Force渲染會花費大量的時間)。

Cons缺點:

Requires some storage (but, typically, not much)

點用存儲空間(但通常不會太多)

There are a few settings to tweak so a bit of experimentation is required.

需要調整一些參數

Only provides a benefit when multiple bounces are needed, if the scene contains lots of lights or when the lighting conditions are difficult

只有在多重反彈和極端的燈光配置中才體現出優勢。

Conserve Reflections Energy維持反射能量守恆

Redshift does not currently support reflection ray sampling during Global Illumination calculation, which can lead to a loss of energy. Checking the 『Conserve Reflections Energy』 option enables a cheap trick which adds the reflection energy that would be lost (i.e. the reflection color tint) to the diffuse color tint of materials during GI calculation. This gives the illusion of reflection ray bounces contributing to GI, which can be particularly noticeable with strong or colored material reflections.

Redshift在進行GI計算的時候,暫時不支持Reflection Ray Samping(反射射線採樣),這會導致部分能量損失。選擇「Conserve Reflections Energy」(維持反射能量守恆)選項,將以較低代價補償這一問題-----引入額外的反射能量補償能量損失(比如,亮面反射染色Reflection Color Tint)。這會造成一種Reflections Ray會加強GI光影的錯覺,在反射很強或者有顏色的材質物體上這種效果


推薦閱讀:

TAG:redshift | gpu渲染 | 渲染 |