Introduction簡介

A renderer achieves effects such as depth-of-field, motion blur and antialiasing by shooting several rays out of each pixel. These rays are called 『primary rays』. When not enough primary rays are shot per pixel, the results can be noisy (『grainy』) or jaggy. However, not all parts of the image need the same number of primary rays! For example, a fast moving object needs more primary rays for smooth motion blur compared to a stationary one. Similarly, an out-of-focus object needs more rays for accurate/smooth depth of field compared to an in-focus one. This means that shooting the same number of primary rays for all pixels on the screen can be wasteful. Shooting the same number of primary rays per pixel is called 『fixed rate sampling』. Fixed rate sampling is the exact opposite of 『adaptive sampling』.

渲染器在對一些效果如景深、運動模糊和抗鋸齒進行處理時,會從每一個像素髮射很多採樣射線,當每一個像素髮射的Primary Rays(一級採樣射線)不足時,渲染結果就會有噪點和鋸齒。當然不是圖片的每一部分都需要一樣多的Primary Rays。例如渲染一個快速運動的物體可能要比渲染靜止物體需要更多的Primary Rays來使運動模糊足夠平滑。類似的,一個失焦物體相比實焦物體,也需要更多的Primary Rays來使景深模糊足夠準確/平滑。這意味著為每一個像素髮射相同多的採樣射線比較低效。為每一個像素髮射相同多的採樣射線叫作限定採樣,與其相對就是自適應採樣。

Unified sampling is an adaptive sampling technique which detects the parts of the image that are noisy/jaggy and adjusts the number of primary rays accordingly – in a per pixel fashion. As a result, rendering takes less time. Furthermore, because unified sampling treats antialiasing, depth of field and motion blur together, is removes the need for separate controls for 「AA samples」, 「DOF samples」 and 「Motion blur samples」 which, in turn, simplifies the workflow.

Unified Sampling(統一採樣)是一種自適應採樣技術,這種技術通過判斷畫面中噪點/鋸齒,自動調整每個像素的主採樣射線數量。這樣渲染會節省時間。由於自適應採樣將抗鋸齒、景深和運動模糊放在一起計算,所以無須單獨控制諸如AA Samples、DOF Samples以及Motion Blur Samples等等採樣參數。這樣就簡化了設置流程。

Because unified sampling detects noise and stops rendering when a pixel is 『clean enough』, a desirable byproduct is that it also benefits the performance of other multi-sample effects, such as:

因為Unified Sampling會在發現某一像素「足夠乾淨」的時候停止渲染,因此這會給另外幾種涉及多次採樣的計算帶來效率上的額外好處:

1、Glossy reflections/refractions 折/反射光澤

2、Brute-force GI 暴力GI

3、Area lighting 區域光

4、Ambient occlusion 環境遮擋

Settings設置

Min/Max Samples最小/最大採樣

These are the minimum and maximum number of primary rays that will be shot per pixel. Redshift will initially shoot 『min samples』 rays for a given pixel and then, if it still detects noise around that pixel, it will shootmore rays until the pixel is clean enough or if it reaches 『max samples』 rays. If you』re using depth of field or motion blur, it』s recommended that you use at least 8-16 『min samples』. Scenes containing strong depth of field or longmotion blur might require a fairly high 『max samples』, such as 256.

最小和最大採樣射線控制每一個像素髮射一級採樣射線的數量。Redshift先為每一個像素髮射Min Sample所定義的數量,如果它檢測在圍繞這個像素的區域有噪點,它會發射更多的採樣去清除噪點,最終直到Max Samples定義的數量。如果正在使用景深和運動模糊,建議使用至少8-16的Min Samples。如果要為場景營造景深的氛圍或者使用大幅度的運動模糊,你需要提高Max Samples,比如用256。

Adaptive Error Threshold自適應錯誤閾值

This parameter controls how sensitive the noise detection algorithm will be. Lower numbers will detect noise more aggressively which means that more rays will be shot per pixel and vice-versa. It is recommended that you use the 『show samples』 feature to visualize the effect of this parameter. The default 0.01 value should work well for a variety of scenes. For production-quality results, we recommend lower settings such as 0.003.

這個參數控制演算法檢測Noise的敏感程度,值越小對噪點的檢測就越敏感,這就意味著每個像素需要反射更多的採樣射線,建議你勾選Show Samples來顯示出這個參數的效果。默認值0.01適用於大多數場景。對於產品級別的渲染,我們推薦使用更低的數值。比如0.003。

Show Samples顯示採樣

This option enables a debug rendering mode which shows the numbers of rays that were shot for each pixel in a grayscale form. Darker pixels mean that fewer rays were shot while brighter pixels mean that more rays were shot. A pure white color means that 『max samples』 rays were shot for that pixel. When this rendering mode is enabled, the noisier parts of the scene will be brighter – depending on the 『adaptive error threshold』 parameter. We』ll demonstrate the effect below.

調試渲染模式用灰度模式顯示出每一個像素髮射的一級採樣射線的數量。暗的地方意味著發射的採樣射線很少,亮的地方意味著發射的採樣射線很多。純白色意味著發射的採樣射線達到Max Samples定義的最大值。開啟這種渲染模式後,場景中的噪點區域會比別的地方亮,這是受「Adaptive Error Threshold」所控制的。我們將在下面的例子中看到這一點。

Don』t automatically reduce samples of other effects不自動降低其它效果的採樣射線

We recommend not using this option. Redshift contains it solely for the benefit of users coming from other renderers. This option might be deprecated in the future.

我們並不推薦使用這個功能。Redshift提供這一功能為的是滿足以前使用其他渲染器的用戶。在將來的版本中,這一功能會在未來的版本中去掉。

Randomize Pattern On Each Frame隨機每幀的採樣點

Techniques such as depth of field, motion blur, brute-force GI, glossy reflections/refractions, AO and area lighting share a common sampling pattern which, by default, is consistent per-frame. When the sample counts for these effects are not high enough and noise is visible, noise can appear to be 『stuck』 on the camera when rendering an animation. This can be visually distracting. Enabling 「Randomize Pattern On Each Frame」 randomizes the noise pattern on each frame which makes the noise look more like moving TV static or film grain. This, in some cases, can be more visually appealing.

景深模糊,運動模糊,Brute-force GI,折反射光澤,AO和區域燈光,這些演算法會使用相同的採樣模式。默認情況,採樣點在每一幀的分布都一樣。當這些演算法使用採樣率不夠時會有噪點。在渲染動畫時噪點可能會「釘」在畫面的某個位置。對於畫面而言,這是可能的瑕疵。開啟Randomize Pattern ON Each Frame會在每一幀全使用不同的採樣點,從而使噪點在每一幀出現的位置不同,看起來更像是電視干擾或者電影膠片的顆粒。相對而言,這樣的噪點稍好一些。

How to useunified sampling 怎樣使用Uinified Sampling

Important 重要提示

The following instructions should only be used when 「Don』t automatically reduce samples」 is disabled! Near the end of this document is a separate section discussing the 「don』t automatically reduce samples」 option.

下面是的內容是針對關閉「Don』t automatically reduce samples」時要採取的步驟。這篇文檔的結尾部分有一個單獨的章節討論Don』t automatically reduce Samples功能。

The optimal way of adjusting the unified sampling parameters is this:

理想中Unified Sampling參數的調整方法如下

1、Disable depth of field and motion blur and set min/max samples both to a low number such as 4 or 16.

取消景深模糊和運動模糊,同時設置Min/Max Samples為4或者16.

2、Adjust 『num samples』 of brute-force GI, area lighting, glossy reflection/refractions and AO etc until you get a visually acceptable frame. Please refer to the 『noise』 documentation for more info.

調節Brute-Force GI、區域光、折反射光澤和AO等等中的「Num Samples」,直到所得的渲染圖片質量可以接受。

3、Re-enable depth of field and motion blur and raise both min/max samples to a level that produces clean results. Typically these two effects require at least 32 samples and then can often require as many as 200 or more.

重新開啟景深模糊和運動模糊,提高Min/Max Samples的參數,使得圖片渲染結果相對平滑。通常這兩個模式開啟後,需要採樣參數至少是32,有時甚至需要200以上的採樣次數。

4、Once happy with the result, reduce 『min samples』 to 4 or 16

如果對結果比較滿意,那麼將Min Samples降低到4或者16。

5、Make slight adjustments to 『adaptive error threshold』 until you see no grain on depth of field or motion blur. The default 0.01 setting should work on a wide variety of scenes but it』s possible that, on certain scenes, you might need to reduce it to a value like 0.003. We recommend using 『show samples』 to see which pixels require the most rays. Ideally, there should be good parts of the image that are not solid-white. If everything comes back as solid white, this means that either the scene is indeed noisy (due to DOF or motion blur) and needs a high 『max samples』 setting or that the 『adaptive error threshold』 is too low and could be raised a bit.

微調Adaptive Error Threshold,直到景深模糊和運動模糊不再出現顆粒感。默認值0.01能滿足絕大部分情況,但有些時候,可能需要將這個值設定到0.003。我們建議開啟Show Samples來觀察那些區域需要更多採樣射線。理想情況是圖片中應該有大面積區域不是純白色。如果整個圖片區域都是純白,那意味著這個場景的噪點級別比較高(受景深和運動模糊影響),需要很大的「Max Samples」數值,要不然就是「Adaptive Error Threshold」設定太低,需要提高。

We demonstrate the above process on a simple scene that uses both depth of field and motion blur. Even though a bit of noise is usually acceptable, for this particular example we』ll attempt to produce a near-flawless image. This will help demonstrate that unified sampling does not mean 『faster but with more noise』: with unified sampling it』s possible to get frames that are almost 100% identical to fixed-rate sampling and rendered faster!

我們將通過一個包含景深模糊的簡單場景來展示上面和過程。儘管有一些點噪點。這樣就可以間接說明Unified Sampling並非是一種「為了提高速度而向噪點妥協」的策略:通過使用Unified Sampling,我們可以用更快的速度到與固定採樣率(Fixed-Rate)渲染完全相同的結果。

First, let』s see the final frame we』d like to produce:

首先我們來看一下需要最終渲染聘為的圖片質量

Final Desired Image最終所在達到的效果圖片。

Step1: Disable motion blur and depth of field. Set min/max samples to 4 each. We are using defaults for brute-force GI and the physical sun samples. There』s evident GI noise in the shadows and the sunlight shadow silhouettes are also noisy

步驟1:取消運動模糊和景深模糊。將Min/Max Samples都設置到4。我們使用Brute-Force GI和Physical Sun Shadow的默認採樣設置。很顯然,圖片中的GI和陽光的陰影輪廓中都有很多噪點。

Step2A: Increase the default brute-force GI samples from 16 to 256. This clears GI noise which is especially visible in the shadows (and a little bit in the white tiles too)

步驟2A:將默認Brute-Force GI採樣從16增加到256。從而將陰影內部(白方塊中也有一些)的噪點去除一些。

Step2B: Increase the physical sun shadow samples from 8 to 128. This clears the noise on the shadow silhouettes

步驟2B:將Physical Sun Shadow Samples從8提高到128。這將去除陰影輪廓中的噪點。

Step 3: Enable depth of field and motion blur. Increase both min/max samples until depth of field and motion blur look clean. For this example, 256 samples were enough. This frame rendered in about 11 seconds on a GTX470.

步驟3:打開景深模糊和運動模糊。將Min/Max Samples同時提高,直到景深模糊和運動模糊都是乾淨的。比如,這裡256就夠了。這一幀的渲染時間是11秒,顯卡是GTX470。

Step 4: Reduce min samples to 16. Leave the 『adaptive error threshold』 to 0.01. Frame looks nearly as good as with fixed rate and rendered in 8 seconds on a GTX470. Scenes requiring even more 『max samples』 (because of, say, bright-but-noisy motion blurred reflections) would have benefited even more.

步驟4:將Min Samples降低到16.Adaptive Error threshold仍保持0.01.圖片看起來渲染效果與使用固定採樣率相同,但相同的硬體GTX470隻需要8秒。如果場景渲染需要更多Max Samples(因為要渲染高亮有噪點的運動模糊反射),那麼這種方法的效率會更高。

And this is what 『show samples』 tells us about how much effort was spent per-pixel. The out-of-focus or heavily motion blurred parts of the image required more work to clean up.

這張圖片顯示的是Show Samples開啟的效果。從中可以看到每個像素所用到的採樣數量。要實現很淺的景深以及很強的運動模糊,渲染圖片上的模糊區域需要進一步調整來清除噪點。

If a deadline is looming and you cannot afford to go around your scene adjusting area light samples, material gloss samples, AO samples, etc, you can simply increase unified sampling』s 『max samples』 to a high number and reduce 『adaptive error threshold』 a bit. Doing so will produce a nearly identical frame as with the method described above - but it could take longer to render! This is because you skipped the part of 『helping』 the renderer by telling it where to focus the effort - so it will have to blindly keep shooting primary rays until the noise isgone.

假如項目時間緊迫,你沒有時間去調整區域光採樣、材質光澤採樣、AO採樣等等,那麼只需要直接將Unified Sampling中的Max Samples提高,並且稍微降低一些Adaptive error threshold即可。這種方法與通過上面講述的調整方法所得到的渲染圖片效果幾乎是相同的。但是渲染時間可能會長一些。這是因為你沒有嘗試告訴渲染器應該將渲染採樣資源集中到那些區域,因而渲染器只是盲目的不斷增加採樣射線,直到去除噪點。

How much slower the result will be (compared to the suggested method) depends on how noisy the scene is. If the scene contains very-difficult-to-clean GI which would normally need 2000-4000 brute-force GI rays but the user, instead, left the default 16 brute-force rays setting, unified sampling』s 『max samples』 would have to be raised into the thousands in order to compensate!

渲染速度(對比使用上面介紹的方法)究竟會降低多少取決一場景本身和噪點狀況。如果場景中的GI噪點本身就很多,可能需要Burte-Force GI提供2000-4000的採樣射線。如果場景中的GI噪點本身就很多,可能需要Brute-Force GI短提供2000-4000的採樣射線。如果你不調整Brute-Force採樣的默認值16,就需要在Unified Sampling的Max Samples中將數值調整到幾千來平衡。

For optimal performance, it is recommended that you tweak the individual 『num samples』 settings, like suggested, instead of simply raising the unified 『max samples』.

如果希望提高渲染效率,還是推薦使用上面的方法來調整每個演算法各自的Num Samples設置,而不是簡單地提高全局Max Samples。

What 「Don』t automatically reduce samples of other effects」 does

不要自動為其他類型降低採樣率的作用是什麼?

By default, Redshift distributes samples across effects. It only does that when 「don』t automatically reduce samples of other effects」 option is disabled.

Redshift默認會在各種渲染採樣過程中分配全局採樣。但前提是用戶必須取消「don』t automatically reduce samples of other effects」

To demonstrate what this 『sample distribution』 (or 『sample reduction』) means, let』s consider a simple example.

讓我們來看一個簡單的例子來的展示「採樣分配」(或者成為優化採樣)的作用。

In the scene shown below, unified sampling has been configured with 「min samples」 and 「max samples」 to be either 1 or 2. This means 「shoot 1 or 2 primary rays per pixel」. The primary (camera) rays are colored green. Now, let』s assume that these primary rays are hitting a glossy reflective material that』s using 4 reflection samples. The reflection rays are colored red.

在下面的場景中,Unified Sampling中Min Samples和Max Samples分別設置為1和2。也就是說,每像素髮射1或者2條Primary Rays (主採樣射線)。Primary Rays(相機採樣)用綠色顯示。現在讓我們假設這些主採樣射線將遇到使用採樣率為4的磨砂反光材質。反射採樣射線用紅色顯示。

As it can be seen, in both cases, there are a total of 4 reflection rays per pixel. This is because Redshift distributes the reflection rays across the primary rays.

可以看到,兩種情況下,每個像素的反射採樣射線都是4條,因為Redshift的反射採樣是從主採樣射線中分出去的。

Redshift distributes reflection samples when 「Don』t automatically reduce samples of other effects」 is disabled只要關閉「Don』t automatically reduce samples of other effects」,Redshift就會分配反射採樣。

When Dont automatically reduce samples is enabled, this division no longer happens which makes Redshift shoot more reflection rays!

當「Dont automatically reduce samples」被啟用時,這個分割不再發生,使Redshift發射更多的反射採樣射線!

On the other hand,when「Don』t automatically reduce samples of other effects」is enabled,No sample distribution/reduction happens另一方面,假如開啟Don』t automatically reduce samples of other effects

Even though above we showed reflection samples, the same distribution/reduction (or not) happens for all secondary ray types: brute-force GI, ambient occlusion, area lighting, reflection, refraction, etc.

以上的例子我們只展示了反射採樣的情況,實際上這種採樣分配(或者優化)也同樣會反生在其他二級採樣射線類型的過程中:如Brute-Force、AO、區域光、反射、折射等等。

Why is the sample distribution useful? Well, think of the following scenario: you have your scene ready with all the settings tweaked to perfection. Then the director walks in and asks for longer motion blur or a stronger depth –of-field effect. Doing either of these and maintaining the same visual quality means increasing your primary rays. While (say) 128 samples might have worked well for your previous depth of field effect, you might find yourself having to use 512 unified samples or more. That would directly translate into a render time that is 4 times slower than before.

為什麼分配採樣是很有用的呢?請考慮這種情況:你已經將場景中所有的參數設定完美。然後導演走過來,要求加強運動或者景深模糊,你也許只能使用512或者更高的Unified Samples。這會導致渲染時間比之前慢4倍。

By distributing/reducing the number of other effects, Redshift ensures that you can afford increasing the unified samples without making your entire rendering time that many times slower!

通過拆分或降低其它效果的採樣數,Redshift可以在滿足更高的Unified Samples設定的前提下,不至於讓整個渲染時間完全按比例增加。

How to use when 「Don』t automatically reduce samples of other effects」 is enabled 開啟時如何調整

There are two ways of doing unified sampling when 「Don』t automatically reduce samples of other effects」 is enabled.

在開啟Don』t automatically reduce samples of other effects時,可以用兩種方法設置Unified Sampling。

The first, easy, way is to set all 『num samples』 to 1 (for everything, including GI, glossy, area lights, etc) and let unified sampling take care of noise by simply shooting more rays per pixel. Some Mental Ray users refer to this technique as 「brute-force unified sampling」.

首先第一種,也是最容易的一種,是將所有Num Samples設為1(每種採樣都設為1,包括GI、Glossy、區域光等等),然後讓Unified Sampling來負責覺得究竟使用多少採樣才能取消噪點。一些Mental Ray用戶將這種技術稱為「暴力全局採樣(Brute-Force unified Sampling)」

This technique is easy and can work in wide variety of scenes. In certain ways, it emulates what some 『unbiased』 renderers do.

這一技術使用方便,而且適合很多場景。某種意義上說,他模仿了無偏(unbiased )渲染器的行為

However, if a particular effect (say, area lighting), is producing an excessive amount of noise, the unified sampling 『max samples』 will have to be raised to a high value such as 500 or even more. This, combined with a fairly low adaptive error threshold might force excessive pixel sampling which can be bad for performance, especially if the scene contains a lot of reflections of refractions.

但是某中一種特殊的渲染過程(就是區域光採樣)會製造很多的噪點,此時Unified Sampling中的Max Sampling必須要設定得非常高,比如500甚至更高。如果這種情況下,Adaptive Error Threshold還設定得相當小的話,可能會讓渲染器不得不在每像素均發射大量的採樣光線,從而對整體渲染效率產生極大的影響。如果場景還包括反射、折射的話,情況就更為嚴重。

So, the next best option is to start with very low samples for everything (maybe even use only 1 sample) but slightly increase 『num samples』 of particularly noisy effects. For example, if your glossy reflections are clean but brute force GI is still noisy, you can try slightly increasing its 『num rays』 from 1 sample to 2 or 4 samples. The cleaner the glossy, GI and lighting results are, the less work the unified sampling will have to do.

因此,第二種最佳的方法應運而生。先將所有採樣值設定得很低(比如說還是1),但有針對性的將某些效果中的採樣率提高一些。比如說光澤反射效果已經很乾凈,但Brute-Force GI 仍然有噪點,那麼將它的「Num Rays」設定為2或者4即可。換句話說,Glossy、GI以及燈光採樣結果越乾淨,全局採樣所要做的就越少。

However, it』s a bit hard to suggest a solid workflow with the 「Don』t automatically reduce samples of other effects」 option enabled as the results are dependent on the scene setup, both performance-wise and visual-quality-wise. Sometimes it』ll make more sense to render with 1 sample for all effects while, other times, a bit of per-effect tweaking might be necessary.

話雖如此,希望在打開「Don』t automatically reduce samples of other effects」後設定合理的參數依然沒有一個十全十美的固定方法。因為對於每種類型的場景,結果可能是不一樣的。要麼效率優先,要麼質量優先,需要權衡。有時使用全部採樣設為1的方法合適,有時有針對性的每種採樣設置中調整比較好。


推薦閱讀:
相关文章